diff options
author | dancer <dancer> | 2001-09-27 07:10:47 +0000 |
---|---|---|
committer | dancer <dancer> | 2001-09-27 07:10:47 +0000 |
commit | 8b0e81e0d2125a3f4827fd27bd006e07e04a4222 (patch) | |
tree | 6511dd6b22d0edbbfb1d0d6bc9ba74e292c2da65 /pbuilder-runhooks | |
parent | 8800772aebfe465da543d4c136e1a87e5a1e09fa (diff) | |
download | pbuilder-8b0e81e0d2125a3f4827fd27bd006e07e04a4222.tar pbuilder-8b0e81e0d2125a3f4827fd27bd006e07e04a4222.tar.gz |
new file from dale amon.
Diffstat (limited to 'pbuilder-runhooks')
-rw-r--r-- | pbuilder-runhooks | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/pbuilder-runhooks b/pbuilder-runhooks new file mode 100644 index 0000000..4f2b822 --- /dev/null +++ b/pbuilder-runhooks @@ -0,0 +1,91 @@ +#! /bin/bash +#========================================================================== +# Execute any hooks required for this segment +# +# Title: pbuilder-runhooks +# Description User hooks for pbuilder package +# Programmed by: Dale Amon <amon@vnl.com> +# Date: $Date$ +# Version: $Revision$ +# +# $HOOKDIR is set in /etc/pbuilderrc and contains a list of executable +# programs or scripts. The type is only limited by what you expect will +# be available in your chrooted environment after debootstrap has done +# an initial install. The functions muxt be named in the format: +# <prefex><digit><digit><descriptive name>. Currently only X is defined; +# scripts prefixed with X will be run just before the chroot environment +# is exited and the base.tgz file is created or updated. +# +# HISTORY: +# $Log$ +# Revision 1.1 2001/09/27 07:10:47 dancer +# new file from dale amon. +# +# 20010925 Dale Amon <amon@vnl.com> +# Created. +# Thanks to Jens Ruehmkorf +# <ruehmkorf@informatik.uni-koeln.de> +# for discussions and ideas. +# +# TODO: * Are there any other executable backup types we should +# filtered besides *~ and *.bak? +# +#========================================================================== +# Debugging scaffold +#BUILDPLACE=/var/cache/pbuilder/build/31456 +#. pbuilder-checkparams + +# If values unassigned, use a default +hooks=/tmp/hooks + +#========================================================================== +# Set up fresh chroot'd hooks tmp script directory +# + +function loadhooks () { + if [ -e $BUILDPLACE/$hooks ]; then + rm -rf $BUILDPLACE/$hooks + fi + cp -a $HOOKDIR $BUILDPLACE/tmp/ +} + +#-------------------------------------------------------------------------- +# Tidy up after ourselves. (Anything we leave behind ends up in base.tgz) +# + +function unloadhooks () { + rm -rf $BUILDPLACE/$hooks +} + +#-------------------------------------------------------------------------- +# Execute every script found in the chroot'd target directory. We only +# test for whether a file is executable because we have no idea what +# the user had put in their dist. If they want PL/1 and ADA on the base +# dist or have decided to use emacslisp for everything, it's their +# problem. +# +# Args: Required prefix on hook fn name +# Returns: none +# + +function executehooks () { + local prefix=$1 + pushd $BUILDPLACE/$hooks + for fn in $prefix[0-9][0-9]* ; do + case $fn in + *~) echo "E: skipping an editor backup file $fn";; + *.bak) echo "E: skipping a backup file $fn";; + *) if [ -x $fn ]; then + chroot $BUILDPLACE $hooks/$fn + echo " -> user script $fn finished" + else + filetype=`file --dereference $fn` + echo "E: execute priv not set on file $filetype" + fi + ;; + esac + done + popd +} + +#-------------------------------------------------------------------------- |