From: joey Date: Tue, 17 Aug 1999 05:02:56 +0000 (+0000) Subject: r132: Initial Import X-Git-Tag: debian_version_0_1~106 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=5501271678d88ac578082ce2d0705ca211d7e980;p=debhelper.git r132: Initial Import --- diff --git a/Dh_Lib.pm b/Dh_Lib.pm index 2b80ce4..61d807a 100644 --- a/Dh_Lib.pm +++ b/Dh_Lib.pm @@ -230,19 +230,18 @@ sub pkgext { my $package=shift; # 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 { @@ -251,7 +250,7 @@ sub autoscript { my $package=shift; my $script=shift; my $filename=shift; my $se } # 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"); } diff --git a/debian/changelog b/debian/changelog index 4826b63..fb3aaa5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +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 Tue, 27 Oct 1998 18:19:48 -0800 + debhelper (1.1.23) unstable; urgency=low * dh_clean: At the suggestion of James Troup now deletes diff --git a/dh_installemacsen b/dh_installemacsen index 008d953..79c7dda 100755 --- a/dh_installemacsen +++ b/dh_installemacsen @@ -1,36 +1,37 @@ -#!/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/"); + } + } +} diff --git a/dh_installmenu b/dh_installmenu index 9fbbfb2..2db1660 100755 --- a/dh_installmenu +++ b/dh_installmenu @@ -1,4 +1,4 @@ -#!/bin/sh -e +#!/usr/bin/perl -w # # Integration with debian menu system: # @@ -8,37 +8,38 @@ # # 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/"); + } + } +} diff --git a/dh_installwm b/dh_installwm index be3a137..0cae914 100755 --- a/dh_installwm +++ b/dh_installwm @@ -1,21 +1,22 @@ -#!/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/"); + } +} diff --git a/dh_md5sums b/dh_md5sums index 9c47a90..4ab9041 100755 --- a/dh_md5sums +++ b/dh_md5sums @@ -1,27 +1,35 @@ -#!/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 () { + 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"); +} diff --git a/dh_suidregister b/dh_suidregister index bc8aa5f..f6d02bc 100755 --- a/dh_suidregister +++ b/dh_suidregister @@ -54,6 +54,10 @@ for PACKAGE in $DH_DOPACKAGES; do 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 diff --git a/dh_suidregister.1 b/dh_suidregister.1 index edce61d..ee804af 100644 --- a/dh_suidregister.1 +++ b/dh_suidregister.1 @@ -26,6 +26,10 @@ will automatically register all files it finds. 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