X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=blobdiff_plain;f=grml-debootstrap;h=3466eb42e78a13cc6ebcc8c8e750e967c944e708;hp=0821225640a2299a829399076ce13439e950a64d;hb=a158cf56b91b091294200584fbc1c88618494bf5;hpb=c651514965e8ff75d21a59b2dd857e5803157eb5 diff --git a/grml-debootstrap b/grml-debootstrap index 0821225..3466eb4 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -11,7 +11,7 @@ set -e # exit on any error # variables {{{ PN="$(basename $0)" -VERSION='0.23' +VERSION='0.24' MNTPOINT="/mnt/debootstrap.$$" # inside the chroot system locales might not be available, so use minimum: @@ -62,14 +62,14 @@ Configuration options: --hostname Hostname of Debian system. --password Use specified password as password for user root. --bootappend Add specified appendline to kernel whilst booting. - --chroot-scripts Execute scripts specified chroot-scripts directory. - --scripts Execute scripts from specified scripts directory. + --chroot-scripts Execute chroot scripts from specified directory. + --scripts Execute scripts from specified directory. Other options: - -v, --verbose Increase verbosity. - -h, --help Print this usage information and exit. - -V, --version Show summary of options and exit. + -v, --verbose Increase verbosity. + -h, --help Print this usage information and exit. + -V, --version Show summary of options and exit. Usage examples can be found in the grml-debootstrap manpage. Send bugreports to the grml-team: bugs (at) grml.org || http://grml.org/bugs/ @@ -764,9 +764,11 @@ preparechroot() { cp $VERBOSE $_opt_debconf $MNTPOINT/etc/debootstrap/debconf-selections # copy scripts that should be executed inside the chroot: - _opt_chroot_scripts=${_opt_chroot_scripts:-$CONFFILES/chroot_scripts/} - [ -f $_opt_chroot_scripts -a "$CHROOT_SCRIPTS" = 'yes' ] && \ - cp -a $VERBOSE $_opt_chroot_scripts $MNTPOINT/etc/debootstrap/ + _opt_chroot_scripts=${_opt_chroot_scripts:-$CONFFILES/chroot-scripts/} + [ -d $_opt_chroot_scripts -a "$CHROOT_SCRIPTS" = 'yes' ] && { + mkdir -p $MNTPOINT/etc/debootstrap/chroot-scripts + cp -a $VERBOSE $_opt_chroot_scripts/* $MNTPOINT/etc/debootstrap/chroot-scripts/ + } # notice: do NOT use $CHROOT_VARIABLES inside chroot but statically file instead! cp $VERBOSE $CHROOT_VARIABLES $MNTPOINT/etc/debootstrap/variables @@ -779,7 +781,6 @@ preparechroot() { # provide system's /etc/hosts to the target: if ! [ -f "$MNTPOINT/etc/hosts" ] ; then cp $VERBOSE /etc/hosts $MNTPOINT/etc/hosts - sed -i "s#127.0.0.1 .*#127.0.0.1 localhost $HOSTNAME#" /etc/hosts fi # setup default locales @@ -809,8 +810,9 @@ preparechroot() { # execute all scripts in /etc/debootstrap/scripts/ {{{ execute_scripts() { - if [ -f $_opt_scripts -a "$SCRIPTS" = 'yes' ] ; then - for script in /etc/debootstrap/scripts/* ; do + if [ -d "$_opt_scripts" ] || [ "$SCRIPTS" = 'yes' ] ; then + [ -d "$_opt_scripts" ] && scripts="$_opt_scripts" || scripts="$CONFFILES/scripts/" + for script in ${scripts}/* ; do if [ -x "$script" ] ; then einfo "Executing script $script" $script ; eend $?