X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=blobdiff_plain;f=grml-debootstrap;h=a9d5f9987bd61e4c6fe576ecaba98954d5aa63b6;hp=a82aaafc7436dfa063f77ea3c802917bde729c89;hb=ab9101c1aa74672b653af1f483552c832a6fa780;hpb=4fac6ee3c5b66fb3f070defb9ceb5ab4b158e679 diff --git a/grml-debootstrap b/grml-debootstrap index a82aaaf..a9d5f99 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -1203,18 +1203,29 @@ execute_scripts() { # execute chroot-script {{{ chrootscript() { if ! [ -r "$MNTPOINT/bin/chroot-script" ] ; then - mount_target + mount_target fi - if [ -x "$MNTPOINT/bin/chroot-script" ] ; then - einfo "Executing chroot-script now" - mount --bind /dev "$MNTPOINT"/dev - chroot "$MNTPOINT" /bin/chroot-script ; RC=$? - umount "$MNTPOINT"/dev - eend $RC + if ! [ -x "$MNTPOINT/bin/chroot-script" ] ; then + eerror "Fatal: $MNTPOINT/bin/chroot-script could not be found." + eend 1 else - eerror "Fatal: $MNTPOINT/bin/chroot-script could not be found." - eend 1 + einfo "Executing chroot-script now" + mount --bind /dev "$MNTPOINT"/dev + chroot "$MNTPOINT" /bin/chroot-script ; RC=$? + umount "$MNTPOINT"/dev + eend $RC + fi + + # finally get rid of chroot-script again, there's no good reason to + # keep it on the installed system + if grep -q GRML_CHROOT_SCRIPT_MARKER "${MNTPOINT}/bin/chroot-script" ; then + einfo "Removing chroot-script again" + rm -f "${MNTPOINT}/bin/chroot-script" + eend $? + else + einfo "Keeping chroot-script as string GRML_CHROOT_SCRIPT_MARKER could not be found" + eend 0 fi } # }}}