diff options
author | joey <joey> | 1999-08-17 04:21:03 +0000 |
---|---|---|
committer | joey <joey> | 1999-08-17 04:21:03 +0000 |
commit | 4a03496417f521caa06f7f4e02592aa5f0b6a390 (patch) | |
tree | 8f3de50f990fffb8781cb3906282e1ce072c1b26 /dh_lib | |
parent | 7511571c6481101f17f9858357e62d133a8dcb1a (diff) | |
download | debhelper-4a03496417f521caa06f7f4e02592aa5f0b6a390.tar.gz |
r5: Initial Import
Diffstat (limited to 'dh_lib')
-rw-r--r-- | dh_lib | 46 |
1 files changed, 42 insertions, 4 deletions
@@ -3,15 +3,17 @@ # Run a command, and display the command to stdout if verbose mode is on. # All commands that modifiy files in debian/$TMP should be ran via this # function. +# Unfortunatly, this function doesn't work if your command uses redirection, +# you will have to call verbose_echo by hand then. function doit() { - verbose_echo "$1" - $1 + verbose_echo "$*" + $* } # Echo something if the verbose flag is on. function verbose_echo() { if [ "$DH_VERBOSE" ]; then - echo " $1" + echo " $*" fi } @@ -40,10 +42,42 @@ function pkgext() { fi } +# Automatically add a shell script snippet to a debian script. +# Only works if the script has #DEBHELPER# in it. +# +# Parameters: +# 1: script to add to +# 2: filename of snippet +# 3: sed commands to run on the snippet. Ie, s/#PACKAGE#/$PACKAGE/ +function autoscript() { + autoscript_script=$1 + autoscript_filename=$2 + autoscript_sed=$3 + autoscript_debscript=debian/`pkgext $PACKAGE`$autoscript_script.debhelper + + if [ -e "$DH_AUTOSCRIPTDIR/$autoscript_filename" ]; then + autoscript_filename="$DH_AUTOSCRIPTDIR/$autoscript_filename" + else + if [ -e "/usr/lib/debhelper/autoscripts/$autoscript_filename" ]; then + autoscript_filename="/usr/lib/debhelper/autoscripts/$autoscript_filename" + else + error "/usr/lib/debhelper/autoscripts/$autoscript_filename does not exist" + fi + fi + + # Running doit doesn't cut it here. + verbose_echo echo "# Automatically added by `basename $0` on `822-date`" ">>" $autoscript_debscript + echo "# Automatically added by `basename $0` on `822-date`" >> $autoscript_debscript + verbose_echo sed "$autoscript_sed" $autoscript_filename ">>" $autoscript_debscript + sed "$autoscript_sed" $autoscript_filename >> $autoscript_debscript + verbose_echo echo "# End automatically added section" ">>" $autoscript_debscript + echo "# End automatically added section" >> $autoscript_debscript +} + # Argument processing and global variable initialization is below. # Parse command line. -set -- `getopt viap: $*` +set -- `getopt vianp: $*` for i; do case "$i" @@ -65,6 +99,10 @@ for i; do shift shift ;; + -n) + DH_NOSCRIPTS=1 + shift + ;; --) shift break |