From: Michael Prokop Date: Mon, 14 Dec 2009 23:33:02 +0000 (+0100) Subject: Merge branch 't/pre_scripts' X-Git-Tag: v0.33~8 X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=commitdiff_plain;h=ee2a7490fd324489ab008239c0b8657e880df2db;hp=-c Merge branch 't/pre_scripts' --- ee2a7490fd324489ab008239c0b8657e880df2db diff --combined grml-debootstrap index 681acc7,53f1e20..48f7c64 --- a/grml-debootstrap +++ b/grml-debootstrap @@@ -64,7 -64,8 +64,8 @@@ Configuration options --password Use specified password as password for user root. --bootappend Add specified appendline to kernel whilst booting. --chroot-scripts Execute chroot scripts from specified directory. - --scripts Execute scripts from specified directory. + --pre-scripts Execute scripts from specified directory (before chroot-scripts). + --scripts Execute scripts from specified directory (after chroot-scripts). Other options: @@@ -141,6 -142,7 +142,7 @@@ f [ "$_opt_packages_set" ] && PACKAGES='yes' [ "$_opt_debconf_set" ] && DEBCONF='yes' [ "$_opt_scripts_set" ] && SCRIPTS='yes' + [ "$_opt_pre_scripts_set" ] && PRE_SCRIPTS='yes' [ "$_opt_chroot_scripts_set" ] && CHROOT_SCRIPTS='yes' [ "$_opt_keep_src_list" ] && KEEP_SRC_LIST='yes' [ "$_opt_hostname" ] && HOSTNAME=$_opt_hostname @@@ -574,10 -576,6 +576,10 @@@ set_target_directory() TUNE2FS='' FSCK='' GRUB='' + # make sure we normalise the path to an absolute directory name so something like: + # mkdir -p foo/a bar/a; (cd foo; grml-debootstrap -t a)&; (cd bar; grml-debootstrap -t a)&; wait + # works + TARGET="$(readlink -f $TARGET)" } if [ -b "$TARGET" ] ; then @@@ -860,6 -858,22 +862,22 @@@ preparechroot() } # }}} + # execute all scripts in /etc/debootstrap/pre-scripts/ {{{ + execute_pre_scripts() { + # make sure we have $MNTPOINT available for our scripts + export MNTPOINT + if [ -d "$_opt_pre_scripts" ] || [ "$PRE_SCRIPTS" = 'yes' ] ; then + [ -d "$_opt_pre_scripts" ] && pre_scripts="$_opt_pre_scripts" || pre_scripts="$CONFFILES/pre-scripts/" + for script in ${pre_scripts}/* ; do + if [ -x "$script" ] ; then + einfo "Executing pre-script $script" + $script ; eend $? + fi + done + fi + } + # }}} + # execute all scripts in /etc/debootstrap/scripts/ {{{ execute_scripts() { # make sure we have $MNTPOINT available for our scripts @@@ -958,7 -972,7 +976,7 @@@ fscktool() # now execute all the functions {{{ for i in mkfs tunefs mount_target debootstrap_system preparechroot \ - chrootscript execute_scripts grub_install umount_chroot \ + execute_pre_scripts chrootscript execute_scripts grub_install umount_chroot \ fscktool ; do if stage "${i}" ; then $i && ( stage "${i}" done && rm -f "${STAGES}/${i}" ) || bailout 2 "i"