X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=blobdiff_plain;f=grml-debootstrap;h=2544c8542fab181c58114c3c54b611a161b002b7;hp=99e71acf8c7725831f112c330f3588a77a8209e1;hb=7614eb950deb2b036bc22b328929d79065f63153;hpb=b901134bfb0a25bf1b6c8f25b953bb2231e21e90 diff --git a/grml-debootstrap b/grml-debootstrap index 99e71ac..2544c85 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -566,11 +566,7 @@ fi PARTITION='' DIRECTORY='' -case $TARGET in - /dev/*) - PARTITION=1 - ;; - *) +set_target_directory(){ # assume we are installing into a directory, don't run mkfs and grub related stuff therefore DIRECTORY=1 MNTPOINT="$TARGET" @@ -578,7 +574,14 @@ case $TARGET in TUNE2FS='' FSCK='' GRUB='' +} + +case $TARGET in + /dev/shm/*) set_target_directory ;; + /dev/*) + PARTITION=1 ;; + *) set_target_directory ;; esac # }}} @@ -629,12 +632,13 @@ bailout(){ # make sure nothing is left inside chroot so we can unmount it [ -x "$MNTPOINT"/etc/init.d/ssh ] && "$MNTPOINT"/etc/init.d/ssh stop [ -x "$MNTPOINT"/etc/init.d/mdadm ] && "$MNTPOINT"/etc/init.d/mdadm stop - # ugly, but make sure we really don't leav anything - [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount /sys 1>/dev/null 2>&1 - [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount -a 1>/dev/null 2>&1 - [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount /proc 1>/dev/null 2>&1 - [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount /proc 1>/dev/null 2>&1 - [ -d "$MNTPOINT/$ISODIR" ] && umount "$MNTPOINT/$ISODIR" 1>/dev/null 2>&1 + # ugly, but make sure we really don't leav anything (/proc /proc is intended) + for ARG in /sys -a /proc /proc ; do + [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount $ARG 1>/dev/null 2>&1 || true + done + umount "$MNTPOINT"/dev 1>/dev/null 2>&1 || true + + [ -d "$MNTPOINT/$ISODIR" ] && umount "$MNTPOINT/$ISODIR" 1>/dev/null 2>&1 || true if [ -n "$DIRECTORY" ] ; then einfo "Not unmounting $MNTPOINT as you requested me to install into a directory of your own choice." ; eend 0