3 # Script to be called from debian/rules to setup all the debian specifc
5 # Christoph Lameter, <clameter@debian.org> October 10, 1996
7 # All the parameters are documentation files to be installed.
8 # (but doc files can also be listed in debian/docs)
10 # This has been gutted and extensively rewritten to function as a debhelper
11 # command by Joey Hess. And then completly rewritten in perl.
13 use Debian::Debhelper::Dh_Lib;
15 # Need to stay compatable with debstd, so force use of level 1.
18 # Pre-parse command line before we parse the command line, becuase we use a
19 # different style of arguments.
44 # Tolerate old style debstd invocations
45 if ($ARGV[0] && $dh{FIRSTPACKAGE} eq $ARGV[0]) {
49 # debinit handles the installation of an init.d script
50 sub debinit { my ($script, $filename, $package, @params)=@_;
53 open (IN,$filename) || warn("$filename: $!");
58 if (/NO_RESTART_ON_UPGRADE/) {
59 $norestart='--no-restart-on-upgrade';
65 $initparams="--update-rcd-params='".join(" ",@initparams)."'";
68 doit("dh_installinit",$norestart,"-p$package",$initparams,"--init-script=$script",@params);
71 # Do package specific things for a package.
72 sub do_package { my ($package, $tmp, $prefix)=@_;
73 # Deal with scripts in etc directories
74 if (-d "$prefix/rc.boot") {
75 warning("file $prefix/rc.boot was ignored.");
78 # etc files that could need some tweaking
79 foreach $f ('services','inittab','crontab','protocols','profile',
80 'shells','rpc','syslog.conf','conf.modules','modules',
81 'aliases','diversions','inetd.conf','X11/Xresources',
82 'X11/config','X11/window-managers','X11/xinit','purge') {
83 if ( -f "$prefix$f") {
84 warning("file $prefix$f was ignored.");
88 if (-f "${prefix}init.d") {
89 debinit($package,"${prefix}init.d",$package,"");
92 # The case of a daemon without the final d
93 if (-f "${prefix}init") {
96 debinit($p,"${prefix}init",$package,"--remove-d");
100 if (-f "${prefix}info") {
101 warning("debhelper does not yet support info files, so ${prefix}info was ignored.");
104 # Set up undocumented man page symlinks.
105 if (defined($ds{UNDOC}) && $ds{UNDOC}) {
106 open (FIND,"find $tmp -type f -perm +111 2>/dev/null |") || warning("find: $!");
109 ($binpath, $binname)=m:$tmp/(.*)/(.*):;
111 # Check if manpages exist
113 if ($binpath eq 'sbin' || $binpath eq 'usr/sbin') {
116 elsif ($binpath eq 'usr/X11R6/bin') {
119 elsif ($binpath eq 'bin' || $binpath eq 'usr/bin') {
122 elsif ($binpath eq 'usr/games') {
125 if ($section && `find $tmp/usr/share/man $tmp/usr/X11R6/man -name "$binname.*" 2>/dev/null` eq '') {
126 doit("dh_undocumented","-p$package","$binname.$section");
133 # Special case of changelog
135 if ($ARGV[0] && $ARGV[0]=~m/change|news|history/) {
136 $changelogfile=shift;
139 doit("dh_installdirs"); # here just to make the debian/tmp, etc directories.
140 doit("dh_installdocs",@ARGV);
141 doit("dh_installexamples");
142 if ($changelogfile) {
143 doit("dh_installchangelogs",$changelogfile);
146 doit("dh_installchangelogs");
148 doit("dh_installmenu");
149 doit("dh_installcron");
152 if (! $ds{NOAUTOMAN}) {
153 doit("dh_installmanpages","-p$dh{FIRSTPACKAGE}");
157 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
158 if ($PACKAGE eq $dh{FIRSTPACKAGE}) {
159 if (-f "debian/clean") {
160 warning("file debian/clean ignored.");
162 do_package($PACKAGE,"debian/tmp","debian/");
165 do_package($PACKAGE,"debian/$PACKAGE","debian/$PACKAGE.");
166 if ( -x "debian/$PACKAGE.prebuild") {
167 warning("file debian/$PACKAGE.prebuild ignored.");
172 doit("dh_movefiles");
175 if (! $ds{NOCOMPRESS}) {
180 doit("dh_suidregister");
181 doit("dh_shlibdeps");
182 doit("dh_gencontrol");
183 doit("dh_makeshlibs");
185 # Check to see if the install scripts have #DEBHELPER# in them, if not,
188 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
189 foreach $file (qw{postinst postrm preinst prerm}) {
190 $f=pkgfile($PACKAGE,$file);
207 warning("The following scripts do not contain \"#DEBHELPER#\" in them,");
208 warning("and so debhelper will not automatically add commands to them:");
209 warning(join(" ",@filelist));
212 doit("dh_installdeb");
218 # This causes the main binary package to be built, which
219 # real debstd does not do. Shouldn't be a problem though,
220 # if that package gets built twice.