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 # Pre-parse command line before we load Dh_lib, becuase we use a
14 # different style of arguments.
38 BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
42 # Tolerate old style debstd invocations
43 if ($ARGV[0] && $dh{FIRSTPACKAGE} eq $ARGV[0]) {
47 # debinit handles the installation of an init.d script
48 sub debinit { my ($script, $filename, $package, @params)=@_;
51 open (IN,$filename) || warn("$filename: $!");
56 if (/NO_RESTART_ON_UPGRADE/) {
57 $norestart='--no-restart-on-upgrade';
63 $initparams="--update-rcd-params='".join(" ",@initparams)."'";
66 doit("dh_installinit",$norestart,"-p$package",$initparams,"--init-script=$script",@params);
69 # Do package specific things for a package.
70 sub do_package { my ($package, $tmp, $prefix)=@_;
71 # Deal with scripts in etc directories
72 if (-d "$prefix/rc.boot") {
73 warning("file $prefix/rc.boot was ignored.");
76 # etc files that could need some tweaking
77 foreach $f ('services','inittab','crontab','protocols','profile',
78 'shells','rpc','syslog.conf','conf.modules','modules',
79 'aliases','diversions','inetd.conf','X11/Xresources',
80 'X11/config','X11/window-managers','X11/xinit','purge') {
81 if ( -f "$prefix$f") {
82 warning("file $prefix$f was ignored.");
86 if (-f "${prefix}init.d") {
87 debinit($package,"${prefix}init.d",$package,"");
90 # The case of a daemon without the final d
91 if (-f "${prefix}init") {
94 debinit($p,"${prefix}init",$package,"--remove-d");
98 if (-f "${prefix}info") {
99 warning("debhelper does not yet support info files, so ${prefix}info was ignored.");
102 # Set up undocumented man page symlinks.
103 if (defined($ds{UNDOC}) && $ds{UNDOC}) {
104 open (FIND,"find $tmp -type f -perm +111 2>/dev/null |") || warning("find: $!");
107 ($binpath, $binname)=m:$tmp/(.*)/(.*):;
109 # Check if manpages exist
111 if ($binpath eq 'sbin' || $binpath eq 'usr/sbin') {
114 elsif ($binpath eq 'usr/X11R6/bin') {
117 elsif ($binpath eq 'bin' || $binpath eq 'usr/bin') {
120 elsif ($binpath eq 'usr/games') {
123 if ($section && `find $tmp/usr/man $tmp/usr/X11R6/man -name "$binname.*" 2>/dev/null` eq '') {
124 doit("dh_undocumented","-p$package","$binname.$section");
131 # Special case of changelog
133 if ($ARGV[0] && $ARGV[0]=~m/change|news|history/) {
134 $changelogfile=shift;
137 doit("dh_installdirs"); # here just to make the debian/tmp, etc directories.
138 doit("dh_installdocs",@ARGV);
139 doit("dh_installexamples");
140 if ($changelogfile) {
141 doit("dh_installchangelogs",$changelogfile);
144 doit("dh_installchangelogs");
146 doit("dh_installmenu");
147 doit("dh_installcron");
150 if (! $ds{NOAUTOMAN}) {
151 doit("dh_installmanpages","-p$dh{FIRSTPACKAGE}");
155 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
156 if ($PACKAGE eq $dh{FIRSTPACKAGE}) {
157 if (-f "debian/clean") {
158 warning("file debian/clean ignored.");
160 do_package($PACKAGE,"debian/tmp","debian/");
163 do_package($PACKAGE,"debian/$PACKAGE","debian/$PACKAGE.");
164 if ( -x "debian/$PACKAGE.prebuild") {
165 warning("file debian/$PACKAGE.prebuild ignored.");
170 doit("dh_movefiles");
173 if (! $ds{NOCOMPRESS}) {
178 doit("dh_suidregister");
179 doit("dh_shlibdeps");
180 doit("dh_gencontrol");
181 doit("dh_makeshlibs");
183 # Check to see if the install scripts have #DEBHELPER# in them, if not,
186 foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
187 foreach $file (qw{postinst postrm preinst prerm}) {
188 $f=pkgfile($PACKAGE,$file);
205 warning("The following scripts do not contain \"#DEBHELPER#\" in them,");
206 warning("and so debhelper will not automatically add commands to them:");
207 warning(join(" ",@filelist));
210 doit("dh_installdeb");
216 # This causes the main binary package to be built, which
217 # real debstd does not do. Shouldn't be a problem though,
218 # if that package gets built twice.