diff options
-rw-r--r-- | .foo | 0 | ||||
-rw-r--r-- | BUGS | 3 | ||||
-rw-r--r-- | autoscripts/postinst-init | 2 | ||||
-rw-r--r-- | autoscripts/postinst-init-norestart | 1 | ||||
-rw-r--r-- | autoscripts/postinst-suid | 6 | ||||
-rw-r--r-- | autoscripts/postrm-init | 3 | ||||
-rw-r--r-- | autoscripts/postrm-suid | 3 | ||||
-rw-r--r-- | autoscripts/prerm-init | 1 | ||||
-rwxr-xr-x | dh_du | 19 | ||||
-rw-r--r-- | dh_du.1 | 42 | ||||
-rwxr-xr-x | dh_gencontrol | 19 | ||||
-rw-r--r-- | dh_gencontrol.1 | 55 | ||||
-rwxr-xr-x | dh_getopt.pl | 138 | ||||
-rwxr-xr-x | dh_installdeb | 46 | ||||
-rw-r--r-- | dh_installdeb.1 | 67 | ||||
-rwxr-xr-x | dh_installdirs | 39 | ||||
-rw-r--r-- | dh_installdirs.1 | 59 | ||||
-rwxr-xr-x | dh_installinit | 58 | ||||
-rw-r--r-- | dh_installinit.1 | 70 | ||||
-rwxr-xr-x | dh_makeshlibs | 30 | ||||
-rw-r--r-- | dh_makeshlibs.1 | 47 | ||||
-rwxr-xr-x | dh_md5sums | 22 | ||||
-rw-r--r-- | dh_md5sums.1 | 45 | ||||
-rw-r--r-- | dh_movefiles.1 | 46 | ||||
-rwxr-xr-x | dh_shlibdeps | 24 | ||||
-rw-r--r-- | dh_shlibdeps.1 | 56 | ||||
-rwxr-xr-x | dh_suidregister | 58 | ||||
-rw-r--r-- | dh_suidregister.1 | 62 | ||||
-rw-r--r-- | dh_testversion.1 | 46 | ||||
-rw-r--r-- | dh_testversion.in | 23 | ||||
-rwxr-xr-x | dh_undocumented | 51 | ||||
-rw-r--r-- | dh_undocumented.1 | 68 | ||||
-rwxr-xr-x | examples/rules.indep | 56 |
33 files changed, 1265 insertions, 0 deletions
@@ -0,0 +1,3 @@ +dh_compress: doesn't verbose echo that it's cd'd to $TMP. +dh_installdirs, dh_md5sums: uses ../.. to cd back to original location, but + we don't know that $TMP is 2 levels deep. diff --git a/autoscripts/postinst-init b/autoscripts/postinst-init new file mode 100644 index 00000000..976c6b34 --- /dev/null +++ b/autoscripts/postinst-init @@ -0,0 +1,2 @@ +update-rc.d #SCRIPT# #INITPARMS# >/dev/null +/etc/init.d/#SCRIPT# start diff --git a/autoscripts/postinst-init-norestart b/autoscripts/postinst-init-norestart new file mode 100644 index 00000000..05357d07 --- /dev/null +++ b/autoscripts/postinst-init-norestart @@ -0,0 +1 @@ +update-rc.d #SCRIPT# #INITPARMS# >/dev/null diff --git a/autoscripts/postinst-suid b/autoscripts/postinst-suid new file mode 100644 index 00000000..1294d313 --- /dev/null +++ b/autoscripts/postinst-suid @@ -0,0 +1,6 @@ +if [ -e /etc/suid.conf -a -x /usr/sbin/suidregister ]; then + suidregister -s #PACKAGE# /#FILE# #OWNER# #GROUP# #PERMS# +else + chown #OWNER#.#GROUP# /#FILE# + chmod #PERMS# /#FILE# +fi diff --git a/autoscripts/postrm-init b/autoscripts/postrm-init new file mode 100644 index 00000000..9596dd97 --- /dev/null +++ b/autoscripts/postrm-init @@ -0,0 +1,3 @@ +if [ "$1" = "purge" ] ; then + update-rc.d #SCRIPT# remove #INITPARMS# >/dev/null +fi diff --git a/autoscripts/postrm-suid b/autoscripts/postrm-suid new file mode 100644 index 00000000..9712d256 --- /dev/null +++ b/autoscripts/postrm-suid @@ -0,0 +1,3 @@ +if [ -e /etc/suid.conf -a -x /usr/sbin/suidunregister ]; then + suidunregister -s #PACKAGE# /#FILE# +fi diff --git a/autoscripts/prerm-init b/autoscripts/prerm-init new file mode 100644 index 00000000..64975a38 --- /dev/null +++ b/autoscripts/prerm-init @@ -0,0 +1 @@ +/etc/init.d/#SCRIPT# stop @@ -0,0 +1,19 @@ +#!/bin/sh -e +# +# Generate a DEBIAN/du file, that lists the disk usage of the directories in +# the package. + +PATH=debian:$PATH:/usr/lib/debhelper +. dh_lib + +for PACKAGE in $DH_DOPACKAGES; do + TMP=`tmpdir $PACKAGE` + + if [ ! -d "debian/$TMP/DEBIAN" ]; then + doit "install -d debian/$TMP/DEBIAN" + fi + + verbose_echo "du -k debian/$TMP | sed \"s: debian/$TMP/: :\" | grep -v \" DEBIAN$\" | grep -v \" debian/$TMP$\" > debian/$TMP/DEBIAN/du" + du -k debian/$TMP | sed "s: debian/$TMP/: :" | grep -v " DEBIAN$" | grep -v " debian/$TMP$" >debian/$TMP/DEBIAN/du + doit "chown root.root debian/tmp/DEBIAN/du" +done diff --git a/dh_du.1 b/dh_du.1 new file mode 100644 index 00000000..98a9c80a --- /dev/null +++ b/dh_du.1 @@ -0,0 +1,42 @@ +.TH DH_DU 1 +.SH NAME +dh_du \- generate DEBIAN/du file +.SH SYNOPSIS +.B dh_md5sums +.I "[-v] [-a] [-i] [-ppackage]" +.SH "DESCRIPTION" +dh_du is a debhelper program that is responsible for generating +a DEBIAN/du file, which lists the disk usage of directories in the package. +This file isn't used by anthing yet, but it could be helpful for a future +debian installer program. +.P +The du file is installed with proper permissions and ownerships. +.SH OPTIONS +.TP +.B \-v +Verbose mode; show all commands that modify the package build directory. +.TP +.B \-a +Generate du files for all architecture dependent packages. +.TP +.B \-i +Generate du files for all architecture independent packages. +.TP +.B \-ppackage +Generate du file for the package named "package". +.SH NOTES +The +.B \-a +.B \-i +and +.B \-p +arguments are cumulative. If none are specified, then all packages listed in +the control file will be effected. +.SH ENVIRONMENT +.TP +.I DH_VERBOSE +Enables verbose mode +.SH "SEE ALSO" +.BR /usr/doc/debhelper/README +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_gencontrol b/dh_gencontrol new file mode 100755 index 00000000..e2a4e701 --- /dev/null +++ b/dh_gencontrol @@ -0,0 +1,19 @@ +#!/bin/sh -e +# +# Generate and install the control file. Simple dpkg-gencontrol wrapper. + +PATH=debian:$PATH:/usr/lib/debhelper +. dh_lib + +for PACKAGE in $DH_DOPACKAGES; do + TMP=`tmpdir $PACKAGE` + EXT=`pkgext $PACKAGE` + + if [ ! -d $TMP/DEBIAN ]; then + doit "install -o root -g root -d $TMP/DEBIAN" + fi + + # Generate and install control file. + doit "dpkg-gencontrol -p$PACKAGE -Tdebian/${EXT}substvars -P$TMP $DH_U_PARAMS" + doit "chown root.root $TMP/DEBIAN/control" +done diff --git a/dh_gencontrol.1 b/dh_gencontrol.1 new file mode 100644 index 00000000..7b78248f --- /dev/null +++ b/dh_gencontrol.1 @@ -0,0 +1,55 @@ +.TH DH_INSTALLDEBFILES 1 +.SH NAME +dh_gencontrol \- generate and install control file +.SH SYNOPSIS +.B dh_gencontrol +.I "[-v] [-a] [-i] [-ppackage] [-Ptmpdir] [-uparams]" +.SH "DESCRIPTION" +dh_gencontrol is a debhelper program that is responsible for generating and +installing control files, and installing them into the DEBIAN directory with +the proper permissions. +.P +This program is merely a wrapper around +.BR dpkg-gencontrol (1) +You may prefer to simply run +.BR dpkg-gencontrol (1) +by hand. +.SH OPTIONS +.TP +.B \-v +Verbose mode; show all commands that modify the package build directory. +.TP +.B \-a +Install files for all architecture dependent packages. +.TP +.B \-i +Install files for all architecture independent packages. +.TP +.B \-ppackage +Install files for the package named "package". +.TP +.B \-Ptmpdir +Use "tmpdir" for package build directory. +.TP +.B \-uparams +Pass "params" to +.BR dpkg-gencontrol (1) +.SH NOTES +The +.B \-a +.B \-i +and +.B \-p +arguments are cumulative. If none are specified, then all packages listed in +the control file will be effected. +.SH ENVIRONMENT +.TP +.I DH_VERBOSE +Enables verbose mode +.SH "SEE ALSO" +.BR /usr/doc/debhelper/README +.BR dpkg-shlibdeps (1) +.SH "CONFORMS TO" +Debian policy, version 2.3.0.0 +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_getopt.pl b/dh_getopt.pl new file mode 100755 index 00000000..bb7d5133 --- /dev/null +++ b/dh_getopt.pl @@ -0,0 +1,138 @@ +#!/usr/bin/perl +# +# Because the getopt() program is so horribly broken, I wrote my own argument +# processer that uses the find Getopt::Long module. This is used by all +# debhelper scripts. +# +# Joey Hess, GPL copyright 1998. + +# Returns a list of packages in the control file. +# Must pass "arch" or "indep" to specify arch-dependant or -independant +# packages. +sub GetPackages { $type=shift; + my $package; + my $arch; + my @list; + open (CONTROL,"<debian/control") || + ( $parse_error="cannot read debian/control: $!\n" ); + while (<CONTROL>) { + chomp; + s/\s+$//; + if (/^Package:\s+(.*)/) { + $package=$1; + } + if (/^Architecture:\s+(.*)/) { + $arch=$1; + } + if (!$_ or eof) { # end of stanza. + if ($package && + (($type eq 'indep' && $arch eq 'all') || + ($type eq 'arch' && $arch ne 'all'))) { + push @list, $package; + undef $package, $arch; + } + } + } + close CONTROL; + + return @list; +} + +# Passed an option name and an option value, adds packages to the list +# of packages. We need this so the list will be built up in the right +# order. +sub AddPackage { my($option,$value)=@_; + if ($option eq 'i' or $option eq 'indep') { + push @packages, GetPackages('indep'); + $indep=1; + } + elsif ($option eq 'a' or $option eq 'arch') { + push @packages, GetPackages('arch'); + $arch=1; + } + elsif ($option eq 'p' or $option eq 'package') { + push @packages, $value; + } + else { + $parse_error="bad option $option - should never happen!\n"; + } +} + +use Getopt::Long; + +# Enable bundling of short command line options. +Getopt::Long::config("bundling"); + +# Parse options. +GetOptions( + "v" => \$verbose, + "verbose" => \$verbose, + + "i" => \&AddPackage, + "indep" => \&AddPackage, + + "a" => \&AddPackage, + "arch" => \&AddPackage, + + "p=s" => \&AddPackage, + "package=s" => \&AddPackage, + + "n" => \$noscripts, + "noscripts" => \$noscripts, + + "x" => \$include, # is -x for some unknown historical reason.. + "include-conffiles" => \$include, + + "d" => \$d_flag, + "remove-d" => \$d_flag, + + "r" => \$r_flag, + "no-restart-on-upgrade" => \$r_flag, + + "k" => \$k_flag, + "keep" => \$k_flag, + + "P=s" => \$tmpdir, + "tmpdir=s" => \$tmpdir, + + "u=s", => \$u_params, + "update-rcd-params=s", => \$u_params, + "dpkg-shlibdeps-params=s", => \$u_params, + + "m=s", => \$major, + "major=s" => \$major, + + "V:s", => \$version_info, + "version-info:s" => \$version_info, + + "A" => \$all, + "all" => \$all, +); + +# Check to see if -V was specified. If so, but no parameters were passed, +# the variable will be defined but empty. +if (defined($version_info)) { + $version_info_set=1; +} + +# Now output everything, in a format suitable for a shell to eval it. +# Note the last line sets $@ in the shell to whatever arguements remain. +print qq{ +DH_VERBOSE='$verbose' +DH_DOPACKAGES='@packages' +DH_DOINDEP='$indep' +DH_DOARCH='$arch' +DH_NOSCRIPTS='$noscripts' +DH_EXCLUDE='$include' +DH_D_FLAG='$d_flag' +DH_R_FLAG='$r_flag' +DH_K_FLAG='$k_flag' +DH_TMPDIR='$tmpdir' +DH_U_PARAMS='$u_params' +DH_M_PARAMS='$major' +DH_V_FLAG='$version_info' +DH_V_FLAG_SET='$version_info_set' +DH_PARAMS_ALL='$all' +DH_PARSE_ERROR='$parse_error' +set -- @ARGV +}; diff --git a/dh_installdeb b/dh_installdeb new file mode 100755 index 00000000..43aca902 --- /dev/null +++ b/dh_installdeb @@ -0,0 +1,46 @@ +#!/bin/sh -e +# +# Install files from debian/ into the package's DEBIAN directory. + +PATH=debian:$PATH:/usr/lib/debhelper +. dh_lib + +for PACKAGE in $DH_DOPACKAGES; do + TMP=`tmpdir $PACKAGE` + EXT=`pkgext $PACKAGE` + + if [ ! -d $TMP/DEBIAN ]; then + doit "install -o root -g root -d $TMP/DEBIAN" + fi + + # Install debian install scripts. + # If any .debhelper files exist, add them into the scripts. + for file in postinst preinst prerm postrm; do + if [ -f debian/$EXT$file ]; then + # Add this into the script, where it has #DEBHELPER# + if [ -f debian/$EXT$file.debhelper ]; then + complex_doit "perl -pe 's~#DEBHELPER#~qx{cat debian/$EXT$file.debhelper}~eg' < debian/$EXT$file > $TMP/DEBIAN/$file" + doit "chown root.root $TMP/DEBIAN/$file" + doit "chmod 755 $TMP/DEBIAN/$file" + else + doit "install -o root -g root -p debian/$EXT$file $TMP/DEBIAN/$file" + fi + else + # Auto-generate script header and add .debhelper + # content to it. + if [ -f debian/$EXT$file.debhelper ]; then + complex_doit "echo '#!/bin/sh -e' > $TMP/DEBIAN/$file" + complex_doit "cat debian/$EXT$file.debhelper >> $TMP/DEBIAN/$file" + doit "chown root.root $TMP/DEBIAN/$file" + doit "chmod 755 $TMP/DEBIAN/$file" + fi + fi + done + + # Install non-executable files + for file in shlibs conffiles; do + if [ -f debian/$EXT$file ]; then + doit "install -o root -g root -m 644 -p debian/$EXT$file $TMP/DEBIAN/$file" + fi + done +done diff --git a/dh_installdeb.1 b/dh_installdeb.1 new file mode 100644 index 00000000..08b6cbae --- /dev/null +++ b/dh_installdeb.1 @@ -0,0 +1,67 @@ +.TH DH_INSTALLDEBFILES 1 +.SH NAME +dh_installdeb \- install files into the DEBIAN directory +.SH SYNOPSIS +.B dh_installdeb +.I "[-v] [-a] [-i] [-ppackage] [-Ptmpdir]" +.SH "DESCRIPTION" +dh_installdeb is a debhelper program that is responsible for installing +files into the DEBIAN directory in package build directories with the +correct permissions. +.P +dh_installdeb automatically installs the following files from debian/ into +the DEBIAN directory: +.IP postinst +.IP preinst +.IP postrm +.IP prerm +.IP shlibs +.IP conffiles +.P +(For packages other than the first binary package listed in debian/control, +prefix these filenames with then name of the "package.", for example, +"foo.postinst".) +.P +The files postinst, preinst, postrm, and prerm are handled specially: If a +corresponding file named debian/script.debhelper exists, the contents of that +file are merged into the script as follows: If the script exists, then +anywhere in it that "#DEBHELPER#" appears, the text of the .debhelper file is +inserted. If the script does not exist, then a script is generated from +the .debhelper file. The .debhelper files are created by other debhelper +programs, such as +.BR dh_installmenu (1) +, and are shell scripts. +.SH OPTIONS +.TP +.B \-v +Verbose mode; show all commands that modify the package build directory. +.TP +.B \-a +Install files for all architecture dependent packages. +.TP +.B \-i +Install files for all architecture independent packages. +.TP +.B \-ppackage +Install files for the package named "package". +.TP +.B \-Ptmpdir +Use "tmpdir" for package build directory. +.SH NOTES +The +.B \-a +.B \-i +and +.B \-p +arguments are cumulative. If none are specified, then all packages listed in +the control file will be effected. +.SH ENVIRONMENT +.TP +.I DH_VERBOSE +Enables verbose mode +.SH "SEE ALSO" +.BR /usr/doc/debhelper/README +.SH "CONFORMS TO" +Debian policy, version 2.3.0.0 +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_installdirs b/dh_installdirs new file mode 100755 index 00000000..bab883d7 --- /dev/null +++ b/dh_installdirs @@ -0,0 +1,39 @@ +#!/bin/sh -e +# +# Reads debian/dirs, creates the directories listed there there + +PATH=debian:$PATH:/usr/lib/debhelper +. dh_lib + +for PACKAGE in $DH_DOPACKAGES; do + TMP=`tmpdir $PACKAGE` + EXT=`pkgext $PACKAGE` + + if [ ! -d $TMP/usr/doc/$PACKAGE ]; then + doit "install -d $TMP/usr/doc/$PACKAGE" + fi + + dirs="" + + if [ -e debian/${EXT}dirs ]; then + dirs=`tr "\n" " " < debian/${EXT}dirs` + fi + + if [ "$PACKAGE" = "$MAINPACKAGE" -a "$*" ]; then + dirs="$* $dirs" + fi + + if [ "$dirs" ]; then + # Check to see if any of the dirs are absolute. + for dir in "$dirs" ; do + if expr "$dir" : "/" >/dev/null ; then + error "Absolute directory name \"$dir\" specified." + fi + done + # Create dirs. + verbose_echo "cd $TMP && install -d $dirs && cd ../.." + cd $TMP + install -d $dirs + cd ../.. + fi +done diff --git a/dh_installdirs.1 b/dh_installdirs.1 new file mode 100644 index 00000000..41dd0fd8 --- /dev/null +++ b/dh_installdirs.1 @@ -0,0 +1,59 @@ +.TH DH_INSTALLDIRS 1 +.SH NAME +dh_installdirs \- create subdirectories in package build directories +.SH SYNOPSIS +.B dh_installdirs +.I "[-v] [-a] [-i] [-ppackage] [-Ptmpdir] [dir ...]" +.SH "DESCRIPTION" +dh_installdirs is a debhelper program that is responsible for creating +subdirectories in package build directories. +.P +Any directory names specified as parameters will be created in the package +build directory of the first binary package listed in debian/control, if +dh_installdirs is acting on that package. +.P +A file named debian/dirs (for the first binary package in debian/control), +or debian/package.dirs (for each additional package in debian/control) can +list other directories to be created. Seperate the directory names with +whitespace. +.P +Be sure to only use directory names relative to the package build +directory. Ie, "/usr/bin" should not be used, use "usr/bin" instead. +.SH OPTIONS +.TP +.B \-v +Verbose mode; show all commands that modify the package build directory. +.TP +.B \-a +Create directories for all architecture dependent packages. +.TP +.B \-i +Create directories for all architecture independent packages. +.TP +.B \-ppackage +Create directories for the package named "package". +.TP +.B \-Ptmpdir +Use "tmpdir" for package build directory. +.TP +.B dir ... +Create these directories in the package build directory of the first binary +package listed in debian/control, if we are acting on that package. +.SH NOTES +The +.B \-a +.B \-i +and +.B \-p +arguments are cumulative. If none are specified, then all packages listed in +the control file will be effected. +.SH ENVIRONMENT +.TP +.I DH_VERBOSE +Enables verbose mode +.SH "SEE ALSO" +.BR /usr/doc/debhelper/README +.SH BUGS +Directories with spaces in them will not currently be installed. +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_installinit b/dh_installinit new file mode 100755 index 00000000..2ea3440f --- /dev/null +++ b/dh_installinit @@ -0,0 +1,58 @@ +#!/bin/sh -e +# +# Install debian/init[.d], and set up the postinst and postrm for init +# scripts. + +PATH=debian:$PATH:/usr/lib/debhelper +. dh_lib + +for PACKAGE in $DH_DOPACKAGES; do + TMP=`tmpdir $PACKAGE` + EXT=`pkgext $PACKAGE` + + if [ -e debian/${EXT}init ]; then + if [ ! -d $TMP/etc/init.d ]; then + doit "install -d $TMP/etc/init.d" + fi + + # Figure out what filename to install it as. + if [ "$DH_D_FLAG" ]; then + # -d on the command line sets DH_D_FLAG. We will + # remove a trailing 'd' from the package name and + # use that as the name. + script=`expr $PACKAGE : '\(.*\)d$'` || true + if [ ! "$script" ]; then + echo `basename $0`" warning: \"$PACKAGE\" has no final -d, but -d was specified." + script=$PACKAGE + fi + else + script=$PACKAGE + fi + doit "install -p -m755 debian/${EXT}init $TMP/etc/init.d/$script" + + # This is set by the -u "foo" command line switch, it's + # the parameters to pass to update-rc.d. If not set, + # we have to say "defaults". + if [ "$DH_U_PARAMS" = "" ]; then + DH_U_PARAMS="defaults" + fi + + # -r on the command line sets DH_R_FLAG. If it's set, there + # is no restart on upgrade. + if [ ! "$DH_NOSCRIPTS" ]; then + if [ "$DH_R_FLAG" ]; then + autoscript "postinst" "postinst-init-norestart" \ + "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/" + autoscript "postrm" "postrm-init" \ + "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/" + else + autoscript "postinst" "postinst-init" \ + "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/" + autoscript "postrm" "postrm-init" \ + "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/" + autoscript "prerm" "prerm-init" \ + "s/#SCRIPT#/$script/;s/#INITPARMS#/$DH_U_PARAMS/" + fi + fi + fi +done diff --git a/dh_installinit.1 b/dh_installinit.1 new file mode 100644 index 00000000..4eb4ee07 --- /dev/null +++ b/dh_installinit.1 @@ -0,0 +1,70 @@ +.TH DH_INSTALLINIT 1 +.SH NAME +dh_installinit \- install init scripts into package build directories +.SH SYNOPSIS +.B dh_installinit +.I "[-v] [-a] [-i] [-ppackage] [-Ptmpdir] [-n] [-r] [-d] [-u params]" +.SH "DESCRIPTION" +dh_installmenu is a debhelper program that is responsible for installing +init scripts into package build directories. +.P +It also automatically generates the postinst and postrm and prerm commands +needed to set up the symlinks in /etc/rc*.d/ and to start and stop the init +scripts. +.P +If a file named debian/init exists, then it is installed into +etc/init.d/package in the package build directory (with "package" replaced +by the package name, unless the -d flag is specified, see below) +.P +For packages other than the first binary package listed in +the control file, use debian/package.init instead (replace "package" with +the name of the package.) +.SH OPTIONS +.TP +.B \-v +Verbose mode; show all commands that modify the package build directory. +.TP +.B \-a +Install init scripts into all architecture dependent packages. +.TP +.B \-i +Install init scripts into all architecture independent packages. +.TP +.B \-ppackage +Install init scripts into the package named "package". +.TP +.B \-Ptmpdir +Use "tmpdir" for package build directory. +.TP +.B \-n +Do not modify postinst/postrm/prerm scripts. +.TP +.B \-r +Do not restart daemon on upgrade. +.TP +.B \-d +Remove trailing "d" from the name of the package, and use the result for the +filename the init script is installed as in etc/init.d/ . This may be useful +for daemons with named ending in "d". +.TP +.B \-u params +Pass "params" to +.BR update-rc.d (8) +If not specified, "default" will be passed to +.BR update-rc.d (8) +.SH NOTES +The +.B \-a +.B \-i +and +.B \-p +arguments are cumulative. If none are specified, then all packages listed in +the control file will be effected. +.SH ENVIRONMENT +.TP +.I DH_VERBOSE +Enables verbose mode +.SH "SEE ALSO" +.BR /usr/doc/debhelper/README +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_makeshlibs b/dh_makeshlibs new file mode 100755 index 00000000..a09e26f6 --- /dev/null +++ b/dh_makeshlibs @@ -0,0 +1,30 @@ +#!/bin/sh -e +# +# Automatically generate shlibs files. + +PATH=debian:$PATH:/usr/lib/debhelper +. dh_lib + +for PACKAGE in $DH_DOPACKAGES; do + TMP=`tmpdir $PACKAGE` + + if [ -e "debian/$TMP/DEBIAN/shlibs" ]; then + error "debian/$TMP/DEBIAN/shlibs already exists." + fi + + for file in `find debian/$TMP -type f -name "*.so*" | tr "\n" " "` ; do + LIBRARY=`expr $file : ".*/\(.*\)\.so\..*"` || true + VERSION=`expr $file : ".*/.*\.so\.\(.*\)"` || true + MAJOR=`expr $VERSION : "\([0-9]*\)\."` || true + LIBSTUB=`expr $file : "\(.*\/.*\.so\)\..*"` || true + if [ ! -d "debian/$TMP/DEBIAN" ] ; then + doit "install -d debian/$TMP/DEBIAN" + fi + verbose_echo "echo \"$LIBRARY $MAJOR $PACKAGE\" >>debian/$TMP/DEBIAN/shlibs" + echo "$LIBRARY $MAJOR $PACKAGE" >>debian/$TMP/DEBIAN/shlibs + done + + if [ -e "debian/$TMP/DEBIAN/shlibs" ]; then + doit "chown root.root debian/$TMP/DEBIAN/shlibs" + fi +done diff --git a/dh_makeshlibs.1 b/dh_makeshlibs.1 new file mode 100644 index 00000000..51ba8fee --- /dev/null +++ b/dh_makeshlibs.1 @@ -0,0 +1,47 @@ +.TH DH_MAKESHLIBS 1 +.SH NAME +dh_makeshlibs \- automatically create shlibs file +.SH SYNOPSIS +.B dh_makeshlibs +.I "[-v] [-a] [-i] [-ppackage]" +.SH "DESCRIPTION" +dh_makeshlibs is a debhelper program that automatically scans for shared +libraries, and generates a shlibs file for the libraries it finds. +.P +For this program to work, you cannot have already installed a DEBIAN/shlibs +file. If such a file exits, the program will exit with an error. +.SH OPTIONS +.TP +.B \-v +Verbose mode; show all commands that modify the package build directory. +.TP +.B \-a +Generate shlibs files for all architecture dependent packages. +.TP +.B \-i +Generate shlibs files for all architecture independent packages. +.TP +.B \-ppackage +Generate shlibs file for the package named "package". +.SH NOTES +The +.B \-a +.B \-i +and +.B \-p +arguments are cumulative. If none are specified, then all packages listed in +the control file will be effected. +.SH ENVIRONMENT +.TP +.I DH_VERBOSE +Enables verbose mode +.SH "SEE ALSO" +.BR /usr/doc/debhelper/README +.SH BUGS +There is no guarentee that the program will get the shlibs file right. For +example, it may not correctly guess the major number of your package. In +casews like these (and perhaps in general, just to be safe), it is better to +create a debian/shlibs file by hand. +This is a "do what I Mean" type program - you have been warned! +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_md5sums b/dh_md5sums new file mode 100755 index 00000000..634e2fd6 --- /dev/null +++ b/dh_md5sums @@ -0,0 +1,22 @@ +#!/bin/sh -e +# +# Generate a DEBIAN/md5sums file, that lists the md5sums of all +# non-conffiles in the package + +PATH=debian:$PATH:/usr/lib/debhelper +. dh_lib + +for PACKAGE in $DH_DOPACKAGES; do + TMP=`tmpdir $PACKAGE` + + if [ ! -d "debian/$TMP/DEBIAN" ]; then + doit "install -d debian/$TMP/DEBIAN" + fi + + doit "pushd debian/$TMP" >/dev/null + # Doit isn't smart enough to hande this next command so echo by hand. (sigh) + verbose_echo 'md5sum `find * -type f ! -regex "^DEBIAN/.*"` > DEBIAN/md5sums </dev/null' + md5sum `find * -type f ! -regex "^DEBIAN/.*"` >DEBIAN/md5sums </dev/null + doit "chown root.root DEBIAN/md5sums" + doit "popd 2>/dev/null" >/dev/null +done diff --git a/dh_md5sums.1 b/dh_md5sums.1 new file mode 100644 index 00000000..422a4aa7 --- /dev/null +++ b/dh_md5sums.1 @@ -0,0 +1,45 @@ +.TH DH_MD5SUMS 1 +.SH NAME +dh_md5sums \- generate DEBIAN/md5sums file +.SH SYNOPSIS +.B dh_md5sums +.I "[-v] [-a] [-i] [-ppackage]" +.SH "DESCRIPTION" +dh_md5sums is a debhelper program that is responsible for generating +a DEBIAN/md5sums file, which lists the md5sums of each file in the package. +.P +All files in DEBIAN/ are omitted from the md5sums file. +.P +The md5sums file is installed with proper permissions and ownerships. +.SH OPTIONS +.TP +.B \-v +Verbose mode; show all commands that modify the package build directory. +.TP +.B \-a +Generate md5sums files for all architecture dependent packages. +.TP +.B \-i +Generate md5sums files for all architecture independent packages. +.TP +.B \-ppackage +Generate md5sums file for the package named "package". +.SH NOTES +The +.B \-a +.B \-i +and +.B \-p +arguments are cumulative. If none are specified, then all packages listed in +the control file will be effected. +.SH ENVIRONMENT +.TP +.I DH_VERBOSE +Enables verbose mode +.SH BUGS +It would be better if it did not include md5sums of conffiles, since this +info is duplicated elsewhere. +.SH "SEE ALSO" +.BR /usr/doc/debhelper/README +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_movefiles.1 b/dh_movefiles.1 new file mode 100644 index 00000000..228f9401 --- /dev/null +++ b/dh_movefiles.1 @@ -0,0 +1,46 @@ +.TH DH_MOVEFILES 1 +.SH NAME +dh_movefiles \- moves files out of debian/tmp into subpackages +.SH SYNOPSIS +.B dh_movefiles +.I "[-v] [-a] [-i] [-ppackage] [-Ptmpdir]" +.SH "DESCRIPTION" +dh_movefiles is a debhelper program that is responsible for moving files out +of debian/tmp and into other package build directories. This may be useful +if your package has a Makefile that installs everything into debian/tmp, and +you need to break that up into subpackages. +.P +Files named debian/package.files list the files to be moved, separated by +whitespace. +.SH OPTIONS +.TP +.B \-v +Verbose mode; show all commands that modify the package build directory. +.TP +.B \-a +Move files for all architecture dependent packages. +.TP +.B \-i +Move files for all architecture independent packages. +.TP +.B \-ppackage +Move files for the package named "package". +.TP +.B \-Ptmpdir +Use "tmpdir" for package build directory. +.SH NOTES +The +.B \-a +.B \-i +and +.B \-p +arguments are cumulative. If none are specified, then all packages listed in +the control file will be effected. +.SH ENVIRONMENT +.TP +.I DH_VERBOSE +Enables verbose mode +.SH "SEE ALSO" +.BR /usr/doc/debhelper/README +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_shlibdeps b/dh_shlibdeps new file mode 100755 index 00000000..e30c4a5b --- /dev/null +++ b/dh_shlibdeps @@ -0,0 +1,24 @@ +#!/bin/sh -e +# +# Find dependancies. Simple dpkg-shlibdeps wrapper. + +PATH=debian:$PATH:/usr/lib/debhelper +. dh_lib + +for PACKAGE in $DH_DOPACKAGES; do + TMP=`tmpdir $PACKAGE` + EXT=`pkgext $PACKAGE` + + # Run dpkg-shlibdeps to generate dependancies. + filelist="" + for file in `find $TMP -type f \( -perm +111 -or -name "*.so*" \) | tr "\n" " "` ; do + case "`file $file`" in + *ELF*) + filelist="$file $filelist" + ;; + esac + done + if [ "$filelist" ]; then + doit "dpkg-shlibdeps -Tdebian/${EXT}substvars $DH_U_PARAMS $filelist" + fi +done diff --git a/dh_shlibdeps.1 b/dh_shlibdeps.1 new file mode 100644 index 00000000..77d90c25 --- /dev/null +++ b/dh_shlibdeps.1 @@ -0,0 +1,56 @@ +.TH DH_INSTALLDEBFILES 1 +.SH NAME +dh_shlibdeps \- calculate shared library dependancies +.SH SYNOPSIS +.B dh_shlibdeps +.I "[-v] [-a] [-i] [-ppackage] [-Ptmpdir] [-uparams]" +.SH "DESCRIPTION" +dh_shlibdeps is a debhelper program that is responsible for calculating +shared library dependancies for all executables found in the package build +directory. +.P +This program is merely a wrapper around +.BR dpkg-shlibdeps (1) +that calls it once for each package listed in the control file. You may +prefer to simply run +.BR dpkg-shlibdeps (1) +by hand. +.SH OPTIONS +.TP +.B \-v +Verbose mode; show all commands that modify the package build directory. +.TP +.B \-a +Install files for all architecture dependent packages. +.TP +.B \-i +Install files for all architecture independent packages. +.TP +.B \-ppackage +Install files for the package named "package". +.TP +.B \-Ptmpdir +Use "tmpdir" for package build directory. +.TP +.B \-uparams +Pass "params" to +.BR dpkg-shlibdeps (1) +.SH NOTES +The +.B \-a +.B \-i +and +.B \-p +arguments are cumulative. If none are specified, then all packages listed in +the control file will be effected. +.SH ENVIRONMENT +.TP +.I DH_VERBOSE +Enables verbose mode +.SH "SEE ALSO" +.BR /usr/doc/debhelper/README +.BR dpkg-shlibdeps (1) +.SH "CONFORMS TO" +Debian policy, version 2.3.0.0 +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_suidregister b/dh_suidregister new file mode 100755 index 00000000..4ca72a1c --- /dev/null +++ b/dh_suidregister @@ -0,0 +1,58 @@ +#!/bin/sh -e +# +# If no parameters are given, and no debian/suid files exists, scan for +# suid/sgid files and suidregister them. +# +# If there are parameters, or there is a debian/suid, register the files +# listed there. + +PATH=debian:$PATH:/usr/lib/debhelper +. dh_lib + +for PACKAGE in $DH_DOPACKAGES; do + TMP=`tmpdir $PACKAGE` + EXT=`pkgext $PACKAGE` + + files="" + + if [ -e debian/${EXT}suid ]; then + files=`tr "\n" " " < debian/${EXT}suid` + fi + + if [ "$PACKAGE" = "$MAINPACKAGE" -a "$*" ]; then + files="$* $files" + fi + + if [ ! "$files" -a ! -e debian/${EXT}suid ]; then + # No files specified (and no empty debian/suid file), so + # guess what files to process. + files=`find debian/$TMP -type f -perm +6000` + + # We will strip the debian working directory off of the + # filenames. + tostrip="debian/$TMP/" + else + # We will strip leading /'s, so the user can feed this + # program either absolute filenames, or relative filenames, + # and it will do the right thing either way. + tostrip="/" + fi + + if [ "$files" ]; then + for file in $files; do + # Strip leading $tostrip from $file. If not there, + # leave $file untouched. + if [ `expr "$file" : "$tostrip\\(.*\\)"` ]; then + file=`expr "$file" : "$tostrip\\(.*\\)"` + fi + + # Create the sed string that will be used to + # fill in the blanks in the autoscript files. + # Fill with the owner, group, and perms of the file. + sedstr=`find debian/$TMP/$file -printf "s:#FILE#:$file:;s/#PACKAGE#/$PACKAGE/;s/#OWNER#/%u/;s/#GROUP#/%g/;s/#PERMS#/%m/"` + + autoscript "postinst" "postinst-suid" "$sedstr" + autoscript "postrm" "postrm-suid" "$sedstr" + done + fi +done diff --git a/dh_suidregister.1 b/dh_suidregister.1 new file mode 100644 index 00000000..e15e6d5f --- /dev/null +++ b/dh_suidregister.1 @@ -0,0 +1,62 @@ +.TH DH_SUIDREGISTER 1 +.SH NAME +dh_suidregister \- set up package to register files with suidregister +.SH SYNOPSIS +.B dh_suidregister +.I "[-v] [-a] [-i] [-ppackage] [file ...]" +.SH "DESCRIPTION" +dh_suidregister is a debhelper program that is responsible for modifying the +postinst and postrm scripts of a package so the package will register files +with +.BR suidregister (1) +when it is installed. +.P +Any files specified as parameters will be registered, if dh_suidregister is +acting on the first binary package listed in debian/control. +.P +The files debian/suid (for the first binary package in debian/control) or +debian/package.suid (for each additional package in debian/control) can +list other files to be registered. +.P +If neither of these methods is used to specify files, dh_suidregister will +scan the package build directory for files that have suid permissions, and +will automatically register all files it finds. +.P +Note that this package modifies your postinst and postrm files. See +.BR dh_installdebfiles (1) +for an explination of how this works. +.SH OPTIONS +.TP +.B \-v +Verbose mode; show all commands that modify the package build directory. +.TP +.B \-a +Register files for all architecture dependent packages. +.TP +.B \-i +Register files for all architecture independent packages. +.TP +.B \-ppackage +Register files for the package named "package". +.TP +.B file ... +Register these files in the first binary package listed in debian/control, +if we are acting on that package. +.SH NOTES +The +.B \-a +.B \-i +and +.B \-p +arguments are cumulative. If none are specified, then all packages listed in +the control file will be effected. +.SH ENVIRONMENT +.TP +.I DH_VERBOSE +Enables verbose mode +.SH "SEE ALSO" +.BR /usr/doc/debhelper/README +, +.BR suidregister (1) +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_testversion.1 b/dh_testversion.1 new file mode 100644 index 00000000..f385a8ca --- /dev/null +++ b/dh_testversion.1 @@ -0,0 +1,46 @@ +.TH DH_TESTROOT 1 +.SH NAME +dh_testversion \- ensure that the correct version of debhelper is installed +.SH SYNOPSIS +.B dh_testversion [operator] [version] +.SH "DESCRIPTION" +dh_testversion compares the version of debhelper against the version you +specify, and if the condition is not met, exits with an error message. +.P +You should use this in your debian/rules files if a new debhelper feature is +introduced, and your package requires that feature to build correctly. Use +debhelper's changelog to figure out the version you need. +.P +Be sure not to overuse dh_testversion. If debhelper version 9.5 +introduces a new dh_autofixbugs command, and your package uses it, then if +someone tries to build it with debhelper 1.0, the build will fail anyway when +dh_autofixbugs cannot be found, so there is no need for you to use +dh_testversion. +.SH OPTIONS +.TP +.B operator +Optional comparison operator used in comparing the versions. If not +specified, ">=" is used. For descriptions of the comparison operators, see +dpkg --help. +.TP +.B version +Version number to compare against the current version of debhelper. If not +specified, dh_testroot does nothing. +.SH EXAMPLES +.TP +.I dh_testversion 0.50 +Make sure debhelper version 0.50 or higher is installed. +.TP +.I dh_testversion ge 0.50 +Another way to make sure debhelper version 0.50 or higher is installed. +.TP +.I dh_testversion le 0.50 +Make sure a version of debhelper less than version 0.50 is installed. +.SH ENVIRONMENT +.TP +.I DH_VERBOSE +Enables verbose mode. +.SH "SEE ALSO" +.BR /usr/doc/debhelper/README +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/dh_testversion.in b/dh_testversion.in new file mode 100644 index 00000000..9e2f14ef --- /dev/null +++ b/dh_testversion.in @@ -0,0 +1,23 @@ +#!/bin/sh -e +# +# Debhelper version check. + +# Current version of debhelper is: +DH_VERSION=#DEBHELPER_VERSION# + +PATH=debian:$PATH:/usr/lib/debhelper +. dh_lib + +if [ "$1" -a "$2" ]; then + compare=$1 + ver=$2 +elif [ "$1" ]; then + compare=">=" + ver=$1 +fi + +if [ "$compare" -a "$ver" ] ; then + if ! dpkg --compare-versions $DH_VERSION $compare $ver; then + error "debhelper version $DH_VERSION is installed, but a version $compare $ver is needed to build this package." + fi +fi diff --git a/dh_undocumented b/dh_undocumented new file mode 100755 index 00000000..ebde8904 --- /dev/null +++ b/dh_undocumented @@ -0,0 +1,51 @@ +#!/bin/sh -e +# +# Passed a list of undocumented man pages, generates symlinks to +# undocumented.7 for those man pages. +# +# Also, it looks for debian/undocumented files for more lists of +# undocumented man pages. + +PATH=debian:$PATH:/usr/lib/debhelper +. dh_lib + +for PACKAGE in $DH_DOPACKAGES; do + TMP=`tmpdir $PACKAGE` + EXT=`pkgext $PACKAGE` + + undoc="" + + if [ -e debian/${EXT}undocumented ]; then + undoc=`tr "\n" " " < debian/${EXT}undocumented` + fi + + if [ "$PACKAGE" = "$MAINPACKAGE" -a "$*" ]; then + undoc="$* $undoc" + fi + + if [ "$undoc" ]; then + for file in $undoc; do + # Remove .gz extention from the filename, if present. + if [ `expr "$file" : '\(.*\).gz'` ]; then + file=`expr "$file" : '\(.*\).gz'` + fi + + # Determine what directory the file belongs in, + # /usr/man, or /usr/X11R6/man. + section=`expr "$file" : '.*\.\([123456789]\)'` + if [ `expr "$file" : '.*\.[123456789]\(x\)'` ] ; then + dir=usr/X11R6/man/man$section + reldir=../../../man + else + dir=usr/man/man$section + reldir=.. + fi + + if [ ! -d debian/$TMP/$dir ]; then + doit "install -d debian/$TMP/$dir" + fi + + doit ln -s $reldir/man7/undocumented.7.gz debian/$TMP/$dir/$file.gz + done + fi +done diff --git a/dh_undocumented.1 b/dh_undocumented.1 new file mode 100644 index 00000000..ab45baad --- /dev/null +++ b/dh_undocumented.1 @@ -0,0 +1,68 @@ +.TH DH_UNDOCUMENTED 1 +.SH NAME +dh_undocumented \- make symlinks to undocumented.7 man page +.SH SYNOPSIS +.B dh_undocumented +.I "[-v] [-a] [-i] [-ppackage] [manpage ...]" +.SH "DESCRIPTION" +dh_undocumented is a debhelper program that is responsible for making +symlinks to the +.BR undocumented (7) +man page for man pages that are not present in your package. +.P +The program takes a list of man pages that should be symlinked to +.BR undocumented (7) +It determines what directory the man pages should be placed in by examining +their extentions - pages ending in "x" go into /usr/X11R6/man/, while pages +that end in anything else go in /usr/man/. It also examines the extention to +see what section the man page belongs in. After figuring this out, it +generates the necessary symlinks to +.BR undocumented (7) +, placing the sylinks in the package build directory. +.P +The lists of man pages that need +.BR undocumented (7) +symlinks can be specified in two ways. Any man page names specified as +parameters will be set up in the first binary package listed in +debian/control, if dh_installdocs is acting on that package. +Also, if a file named debian/undocumented (for the first binary package in +debian/control), or debian/package.undocumented (for each additional package +in debian/control) can list other man page names to set up. +.SH OPTIONS +.TP +.B \-v +Verbose mode; show all commands that modify the package build directory. +.TP +.B \-a +Install undocumented man page symlinks for all architecture dependent packages. +.TP +.B \-i +Install undocumented man page symlinks for all architecture independent packages. +.TP +.B \-ppackage +Install undocumented man page symlinks for the package named "package". +.TP +.B manpage ... +Install undocumented man page symlinks for each of these man pages +into the first binary package listed in debian/control, if we are acting on +that package. +.SH NOTES +The +.B \-a +.B \-i +and +.B \-p +arguments are cumulative. If none are specified, then all packages listed in +the control file will be effected. +.SH ENVIRONMENT +.TP +.I DH_VERBOSE +Enables verbose mode +.SH "SEE ALSO" +.BR /usr/doc/debhelper/README +, +.BR undocumented (7) +.SH "CONFORMS TO" +Debian policy, version 2.3.0.0 +.SH AUTHOR +Joey Hess <joeyh@master.debian.org> diff --git a/examples/rules.indep b/examples/rules.indep new file mode 100755 index 00000000..a257a197 --- /dev/null +++ b/examples/rules.indep @@ -0,0 +1,56 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. +# This version is for packages that are architecure independant. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +build: build-stamp +build-stamp: + dh_testdir + # Add here commands to compile the pacckage. + #$(MAKE) + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + # Add here commands to clean up after the build process. + #-$(MAKE) distclean + dh_clean + +# Build architecture-independent files here. +binary-indep: build + dh_testdir + dh_testroot + dh_clean + dh_installdirs + # Add here commands to install the files into debian/tmp + #$(MAKE) PREFIX=debian/tmp install + dh_installdocs + dh_installexamples + dh_installmenu +# dh_installinit + dh_installcron +# dh_installmanpages +# dh_undocumented + dh_installchangelogs + dh_compress + dh_fixperms + dh_suidregister + dh_installdeb + dh_gencontrol + dh_du + dh_md5sums + dh_builddeb + +# Build architecture-dependent files here. +binary-arch: build +# We have nothing to do by default. + +source diff: + @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary |