# 2: script to add to
# 3: filename of snippet
# 4: sed to run on the snippet. Ie, s/#PACKAGE#/$PACKAGE/
-sub autoscript { my $package=shift; my $script=shift; my $filename=shift; my $sed=shift;
- error "autoscript() not yet implemented (lazy, lazy!)";
-
+sub autoscript { my $package=shift; my $script=shift; my $filename=shift; my $sed=shift || "";
# This is the file we will append to.
my $outfile="debian/".pkgext($package)."$script.debhelper";
# Figure out what shell script snippet to use.
my $infile;
- if ( -e "$main::ENV{DH_AUTOSCRIPTDIR}/$filename" ) {
- $infile="$main::ENV{DH_AUTOSCRIPTDIR}/$filename";
+ if (defined($ENV{DH_AUTOSCRIPTDIR}) &&
+ -e "$ENV{DH_AUTOSCRIPTDIR}/$filename") {
+ $infile="$ENV{DH_AUTOSCRIPTDIR}/$filename";
}
else {
- if ( -e "/usr/lib/debhelper/autoscripts/$filename" ) {
+ if (-e "/usr/lib/debhelper/autoscripts/$filename") {
$infile="/usr/lib/debhelper/autoscripts/$filename";
}
else {
}
# TODO: do this in perl, perhaps?
- complex_doit("echo \"# Automatically added by ".basename($0).">> $outfile");
+ complex_doit("echo \"# Automatically added by ".basename($0)."\">> $outfile");
complex_doit("sed \"$sed\" $infile >> $outfile");
complex_doit("echo '# End automatically added section' >> $outfile");
}
+debhelper (1.1.24) unstable; urgency=low
+
+ * dh_suidregister: remove suid/sgid bits from all files registered. The
+ reason is this: if you're using suidmanager, and you want a file that
+ ships suid to never be suid on your system, shipping it suid in the .deb
+ will create a window where it is suid before suidmanager fixes it's
+ permissions. This change should be transparent to users and developers.
+
+ -- Joey Hess <joeyh@master.debian.org> Tue, 27 Oct 1998 18:19:48 -0800
+
debhelper (1.1.23) unstable; urgency=low
* dh_clean: At the suggestion of James Troup <james@nocrew.org> now deletes
-#!/bin/sh -e
+#!/usr/bin/perl -w
#
# Registration with emacsen-common.
-PATH=debian:$PATH:/usr/lib/debhelper
-. dh_lib
+BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
+use Dh_Lib;
+init();
-for PACKAGE in $DH_DOPACKAGES; do
- TMP=`tmpdir $PACKAGE`
+foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
+ $TMP=tmpdir($PACKAGE);
- emacsen_install=`pkgfile $PACKAGE emacsen-install`
- emacsen_remove=`pkgfile $PACKAGE emacsen-remove`
+ $emacsen_install=pkgfile($PACKAGE,"emacsen-install");
+ $emacsen_remove=pkgfile($PACKAGE,"emacsen-remove");
- if [ "$emacsen_install" ]; then
- if [ ! -d "$TMP/usr/lib/emacsen-common/packages/install" ]; then
- doit "install -d $TMP/usr/lib/emacsen-common/packages/install"
- fi
- doit "install $emacsen_install $TMP/usr/lib/emacsen-common/packages/install/$PACKAGE"
- fi
+ if ($emacsen_install ne '') {
+ if (! -d "$TMP/usr/lib/emacsen-common/packages/install") {
+ doit("install","-d","$TMP/usr/lib/emacsen-common/packages/install");
+ }
+ doit("install",$emacsen_install,"$TMP/usr/lib/emacsen-common/packages/install/$PACKAGE");
+ }
- if [ "$emacsen_remove" ]; then
- if [ ! -d "$TMP/usr/lib/emacsen-common/packages/remove" ]; then
- doit "install -d $TMP/usr/lib/emacsen-common/packages/remove"
- fi
- doit "install $emacsen_remove $TMP/usr/lib/emacsen-common/packages/remove/$PACKAGE"
- fi
+ if ($emacsen_remove ne '') {
+ if (! -d "$TMP/usr/lib/emacsen-common/packages/remove") {
+ doit("install","-d","$TMP/usr/lib/emacsen-common/packages/remove");
+ }
+ doit("install","$emacsen_remove","$TMP/usr/lib/emacsen-common/packages/remove/$PACKAGE");
+ }
- if [ "$emacsen_install" -o "$emacsen_remove" ]; then
- if [ ! "$DH_NOSCRIPTS" ]; then
- autoscript "postinst" "postinst-emacsen" \
- "s/#PACKAGE#/$PACKAGE/"
- autoscript "prerm" "prerm-emacsen" \
- "s/#PACKAGE#/$PACKAGE/"
- fi
- fi
-done
+ if ($emacsen_install ne '' || $emacsen_remove ne '') {
+ if (! $dh{NOSCRIPTS}) {
+ autoscript($PACKAGE,"postinst","postinst-emacsen",
+ "s/#PACKAGE#/$PACKAGE/");
+ autoscript($PACKAGE,"prerm","prerm-emacsen",
+ "s/#PACKAGE#/$PACKAGE/");
+ }
+ }
+}
-#!/bin/sh -e
+#!/usr/bin/perl -w
#
# Integration with debian menu system:
#
#
# Also, add to postinst and postrm.
-PATH=debian:$PATH:/usr/lib/debhelper
-. dh_lib
-
-for PACKAGE in $DH_DOPACKAGES; do
- TMP=`tmpdir $PACKAGE`
- menu=`pkgfile $PACKAGE menu`
- menu_method=`pkgfile $PACKAGE menu-method`
-
- if [ "$menu" ]; then
- if [ ! -d $TMP/usr/lib/menu ]; then
- doit "install -d $TMP/usr/lib/menu"
- fi
- doit "install -p -m644 $menu $TMP/usr/lib/menu/$PACKAGE"
+BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
+use Dh_Lib;
+init();
+foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
+ $TMP=tmpdir($PACKAGE);
+ $menu=pkgfile($PACKAGE,"menu");
+ $menu_method=pkgfile($PACKAGE,"menu-method");
+
+ if ($menu ne '') {
+ if (! -d "$TMP/usr/lib/menu") {
+ doit("install","-d","$TMP/usr/lib/menu");
+ }
+ doit("install","-p","-m644",$menu,"$TMP/usr/lib/menu/$PACKAGE");
+
# Add the scripts if a menu-method file doesn't exist.
# The scripts for menu-method handle everything these do, too.
- if [ ! "$menu_method" -a ! "$DH_NOSCRIPTS" ]; then
- autoscript "postinst" "postinst-menu"
- autoscript "postrm" "postrm-menu"
- fi
- fi
+ if ($menu_method eq "" && ! $dh{NOSCRIPTS}) {
+ autoscript($PACKAGE,"postinst","postinst-menu");
+ autoscript($PACKAGE,"postrm","postrm-menu")
+ }
+ }
- if [ "$menu_method" ]; then
- if [ ! -d $TMP/etc/menu-methods ]; then
- doit "install -d $TMP/etc/menu-methods"
- fi
- doit "install -p $menu_method $TMP/etc/menu-methods/$PACKAGE"
+ if ($menu_method ne '') {
+ if (!-d "$TMP/etc/menu-methods") {
+ doit("install","-d","$TMP/etc/menu-methods");
+ }
+ doit("install","-p",$menu_method,"$TMP/etc/menu-methods/$PACKAGE");
- if [ ! "$DH_NOSCRIPTS" ]; then
- autoscript "postinst" "postinst-menu-method" "s/#PACKAGE#/$PACKAGE/"
- autoscript "postrm" "postrm-menu-method" "s/#PACKAGE#/$PACKAGE/"
- fi
- fi
-done
+ if (! $dh{NOSCRIPTS}) {
+ autoscript($PACKAGE,"postinst","postinst-menu-method","s/#PACKAGE#/$PACKAGE/");
+ autoscript($PACKAGE,"postrm","postrm-menu-method","s/#PACKAGE#/$PACKAGE/");
+ }
+ }
+}
-#!/bin/sh -e
+#!/usr/bin/perl -w
#
# Add to postinst and postrm to register a window manager.
-PATH=debian:$PATH:/usr/lib/debhelper
-. dh_lib
+BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
+use Dh_Lib;
+init();
-wm=$1
+$wm=shift;
-if [ -z "$wm" ]; then
- error "No window manager was specified."
-fi
+if ($wm eq '') {
+ error("No window manager filename was specified.");
+}
-for PACKAGE in $DH_DOPACKAGES; do
- TMP=`tmpdir $PACKAGE`
-
- if [ ! "$DH_NOSCRIPTS" ]; then
- autoscript "postinst" "postinst-wm" "s/#WM#/$wm/"
- autoscript "postrm" "postrm-wm" "s/#WM#/$wm/"
- fi
-done
+foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
+# $TMP=tmpdir($PACKAGE);
+
+ if (! $dh{NOSCRIPTS}) {
+ autoscript($PACKAGE,"postinst","postinst-wm","s/#WM#/$wm/");
+ autoscript($PACKAGE,"postrm","postrm-wm","s/#WM#/$wm/");
+ }
+}
-#!/bin/sh -e
+#!/usr/bin/perl -w
#
# Generate a DEBIAN/md5sums file, that lists the md5sums of all files in the
# package.
-PATH=debian:$PATH:/usr/lib/debhelper
-. dh_lib
+use Cwd;
+BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
+use Dh_Lib;
+init();
-for PACKAGE in $DH_DOPACKAGES; do
- TMP=`tmpdir $PACKAGE`
+foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
+ $TMP=tmpdir($PACKAGE);
- if [ ! -d "$TMP/DEBIAN" ]; then
- doit "install -d $TMP/DEBIAN"
- fi
+ if (! -d "$TMP/DEBIAN") {
+ doit("install","-d","$TMP/DEBIAN");
+ }
# Check if we should exclude conffiles.
- if [ ! "$DH_INCLUDE" -a -r $TMP/DEBIAN/conffiles ]; then
- # Generate exclude regexp. Using perl here may be overkill,
- # but it does insure conffiles with spaces in them work.
- exclude=`perl -ne 'chomp; s/^\///; print "! -path \"$_\" "' $TMP/DEBIAN/conffiles`
- fi
+ my $exclude="";
+ if (! $dh{INCLUDE} && -r "$TMP/DEBIAN/conffiles") {
+ # Generate exclude regexp.
+ open (CONFF,"$TMP/DEBIAN/conffiles");
+ while (<CONFF>) {
+ chomp;
+ s/^\///;
+ $exclude.="! -path \"$_\" ";
+ }
+ close CONFF;
+ }
- olddir=`pwd`
- complex_doit "cd $TMP ; find * -type f $exclude ! -regex '^DEBIAN/.*' -print0 | xargs -0 md5sum > DEBIAN/md5sums ; cd $olddir"
- doit "chmod 644 $TMP/DEBIAN/md5sums"
- doit "chown root.root $TMP/DEBIAN/md5sums"
-done
+ $olddir=getcwd();
+ complex_doit("cd $TMP ; find * -type f $exclude ! -regex '^DEBIAN/.*' -print0 | xargs -0 md5sum > DEBIAN/md5sums ; cd $olddir");
+ doit("chmod",644,"$TMP/DEBIAN/md5sums");
+ doit("chown","root.root","$TMP/DEBIAN/md5sums");
+}
autoscript "postinst" "postinst-suid" "$sedstr"
autoscript "postrm" "postrm-suid" "$sedstr"
+
+ if [ -e "$TMP/$file" ]; then
+ doit "chmod a-s $TMP/$file"
+ fi
done
fi
done
Note that this program modifies your postinst and postrm files. See
.BR dh_installdeb (1)
for an explanation of how this works.
+.P
+Also note that all files registered by this program will *not* be suid in the
+resulting .deb file. The postinst of the package will set their permissions
+(even if the user doesn't have suidmanager installed).
.SH OPTIONS
.TP
.B debhelper options