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 # Need to stay compatable with debstd, so force use of level 1.
16 # Pre-parse command line before we load Dh_lib, becuase we use a
17 # different style of arguments.
41 BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
45 # Tolerate old style debstd invocations
46 if ($ARGV[0] && $dh{FIRSTPACKAGE} eq $ARGV[0]) {
50 # debinit handles the installation of an init.d script
51 sub debinit { my ($script, $filename, $package, @params)=@_;
54 open (IN,$filename) || warn("$filename: $!");
59 if (/NO_RESTART_ON_UPGRADE/) {
60 $norestart='--no-restart-on-upgrade';
66 $initparams="--update-rcd-params='".join(" ",@initparams)."'";
69 doit("dh_installinit",$norestart,"-p$package",$initparams,"--init-script=$script",@params);
72 # Do package specific things for a package.
73 sub do_package { my ($package, $tmp, $prefix)=@_;
74 # Deal with scripts in etc directories
75 if (-d "$prefix/rc.boot") {
76 warning("file $prefix/rc.boot was ignored.");
79 # etc files that could need some tweaking
80 foreach $f ('services','inittab','crontab','protocols','profile',
81 'shells','rpc','syslog.conf','conf.modules','modules',
82 'aliases','diversions','inetd.conf','X11/Xresources',
83 'X11/config','X11/window-managers','X11/xinit','purge') {
84 if ( -f "$prefix$f") {
85 warning("file $prefix$f was ignored.");
89 if (-f "${prefix}init.d") {
90 debinit($package,"${prefix}init.d",$package,"");
93 # The case of a daemon without the final d
94 if (-f "${prefix}init") {
97 debinit($p,"${prefix}init",$package,"--remove-d");
101 if (-f "${prefix}info") {
102 warning("debhelper does not yet support info files, so ${prefix}info was ignored.");
105 # Set up undocumented man page symlinks.
106 if (defined($ds{UNDOC}) && $ds{UNDOC}) {
107 open (FIND,"find $tmp -type f -perm +111 2>/dev/null |") || warning("find: $!");
110 ($binpath, $binname)=m:$tmp/(.*)/(.*):;
112 # Check if manpages exist
114 if ($binpath eq 'sbin' || $binpath eq 'usr/sbin') {
117 elsif ($binpath eq 'usr/X11R6/bin') {
120 elsif ($binpath eq 'bin' || $binpath eq 'usr/bin') {
123 elsif ($binpath eq 'usr/games') {
126 if ($section && `find $tmp/usr/man $tmp/usr/X11R6/man -name "$binname.*" 2>/dev/null` eq '') {
127 doit("dh_undocumented","-p$package","$binname.$section");
134 # Special case of changelog
136 if ($ARGV[0] && $ARGV[0]=~m/change|news|history/) {
137 $changelogfile=shift;
140 doit("dh_installdirs"); # here just to make the debian/tmp, etc directories.
141 doit("dh_installdocs",@ARGV);
142 doit("dh_installexamples");
143 if ($changelogfile) {
144 doit("dh_installchangelogs",$changelogfile);
147 doit("dh_installchangelogs");
149 doit("dh_installmenu");
150 doit("dh_installcron");
153 if (! $ds{NOAUTOMAN}) {
154 doit("dh_installmanpages","-p$dh{FIRSTPACKAGE}");
158 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
159 if ($PACKAGE eq $dh{FIRSTPACKAGE}) {
160 if (-f "debian/clean") {
161 warning("file debian/clean ignored.");
163 do_package($PACKAGE,"debian/tmp","debian/");
166 do_package($PACKAGE,"debian/$PACKAGE","debian/$PACKAGE.");
167 if ( -x "debian/$PACKAGE.prebuild") {
168 warning("file debian/$PACKAGE.prebuild ignored.");
173 doit("dh_movefiles");
176 if (! $ds{NOCOMPRESS}) {
181 doit("dh_suidregister");
182 doit("dh_shlibdeps");
183 doit("dh_gencontrol");
184 doit("dh_makeshlibs");
186 # Check to see if the install scripts have #DEBHELPER# in them, if not,
189 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
190 foreach $file (qw{postinst postrm preinst prerm}) {
191 $f=pkgfile($PACKAGE,$file);
208 warning("The following scripts do not contain \"#DEBHELPER#\" in them,");
209 warning("and so debhelper will not automatically add commands to them:");
210 warning(join(" ",@filelist));
213 doit("dh_installdeb");
219 # This causes the main binary package to be built, which
220 # real debstd does not do. Shouldn't be a problem though,
221 # if that package gets built twice.