X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=blobdiff_plain;f=grml-debootstrap;h=5f2744dc3d325a044cc3fcb463a17e050c1e8247;hp=79f10ad912d2a1b6f22fe1064d16aacb9f67873e;hb=4dd9091112e9ed334b3e610d1f6f4ce71646a263;hpb=f7894c712f146f42cedcd4352f1f3b2f90ce64c2 diff --git a/grml-debootstrap b/grml-debootstrap index 79f10ad..5f2744d 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -381,7 +381,7 @@ elif [ -n "$INTERACTIVE" ] ; then INFOTEXT="Please recheck configuration before execution: " [ -n "$TARGET" ] && INFOTEXT="$INFOTEXT - Target: $TARGET" + Target: $TARGET" [ -n "$GRUB" ] && INFOTEXT="$INFOTEXT Install grub: $GRUB" [ -n "$RELEASE" ] && INFOTEXT="$INFOTEXT @@ -393,7 +393,7 @@ elif [ -n "$INTERACTIVE" ] ; then Is this ok for you? Notice: canceling will exit ${PN}." - dialog --title "$PN" \ + dialog --title "$PN" --no-collapse \ --yesno "$INFOTEXT" 0 0 else # if not running automatic installation display configuration and prompt for execution: @@ -464,7 +464,7 @@ fi # stages setup {{{ if [ -z "$STAGES" ] ; then - STAGES="/etc/debootstrap/stages_${SHORT_TARGET}" + STAGES="/var/cache/grml-debootstrap/stages_${SHORT_TARGET}" [ -d "$STAGES" ] || mkdir -p "$STAGES" fi @@ -523,7 +523,7 @@ ISODIR=${ISODIR%%/} # }}} # provide variables to chroot system {{{ -CHROOT_VARIABLES="/etc/debootstrap/variables_${SHORT_TARGET}" +CHROOT_VARIABLES="/var/cache/grml-debootstrap/variables_${SHORT_TARGET}" touch $CHROOT_VARIABLES chmod 600 $CHROOT_VARIABLES # make sure nobody except root can read it [ -n "$ARCH" ] && echo "ARCH=$ARCH" > $CHROOT_VARIABLES @@ -554,6 +554,11 @@ bailout(){ [ -d "$MNTPOINT/$ISODIR" ] && umount "$MNTPOINT/$ISODIR" 1>/dev/null 2>&1 einfo "Unmounting $MNTPOINT" ; umount "$MNTPOINT" ; eend $? + if [ -n "$STAGES" ] ; then + echo -n "Removing stages directory ${STAGES}: " + rm -rf "$STAGES" && echo done + fi + # remove directory only if we used the default with process id inside the name if echo "$MNTPOINT" | grep -q '/mnt/debootstrap\.' ; then einfo "Removing directory ${MNTPOINT}" ; rmdir $MNTPOINT ; eend $? @@ -666,13 +671,15 @@ preparechroot() { # make sure we have our files for later use via chroot-script cp /etc/debootstrap/config $MNTPOINT/etc/debootstrap/ # make sure we adjust the configuration variables accordingly: - sed -i "s/RELEASE=.*/RELEASE='${RELEASE}'/" $MNTPOINT/etc/debootstrap/config - sed -i "s/TARGET=.*/TARGET='${TARGET}'/" $MNTPOINT/etc/debootstrap/config - sed -i "s/GRUB=.*/GRUB='${GRUB}'/" $MNTPOINT/etc/debootstrap/config - sed -i "s/GROOT=.*/GROOT='${GROOT}'/" $MNTPOINT/etc/debootstrap/config + sed -i "s/RELEASE=.*/RELEASE=\"$RELEASE\"/" $MNTPOINT/etc/debootstrap/config + sed -i "s/TARGET=.*/TARGET=\"$TARGET\"/" $MNTPOINT/etc/debootstrap/config + sed -i "s/GRUB=.*/GRUB=\"$GRUB\"/" $MNTPOINT/etc/debootstrap/config + sed -i "s/GROOT=.*/GROOT=\"$GROOT\"/" $MNTPOINT/etc/debootstrap/config cp /etc/debootstrap/packages $MNTPOINT/etc/debootstrap/packages - cp $CHROOT_VARIABLES $MNTPOINT/etc/debootstrap/variables # do NOT use $CHROOT_VARIABLES inside chroot! + + # notice: do NOT use $CHROOT_VARIABLES inside chroot but statically file instead! + cp $CHROOT_VARIABLES $MNTPOINT/etc/debootstrap/variables cp -a /etc/debootstrap/extrapackages/ $MNTPOINT/etc/debootstrap/ @@ -688,6 +695,9 @@ preparechroot() { # setup default locales [ -n "$LOCALES" ] && cp /etc/debootstrap/locale.gen $MNTPOINT/etc/locale.gen + # MAKEDEV is just a forking bomb crap, let's do it on our own instead :) + ( cd $MNTPOINT/dev && tar zxf /etc/debootstrap/devices.tar.gz ) + # copy any existing existing files to chroot [ -d /etc/debootstrap/boot ] && cp -a /etc/debootstrap/boot/* $MNTPOINT/boot/ [ -d /etc/debootstrap/etc ] && cp -a /etc/debootstrap/etc/* $MNTPOINT/etc/ @@ -729,13 +739,13 @@ grub_install() { for device in $SELECTED_PARTITIONS ; do GRUB=$(grubdevice $device) einfo "Installing grub on ${GRUB}:" - [ -x /usr/sbin/grub-install ] && GRUBINSTALL=/usr/sbin/grub-install || GRUBINSTALL=/sbin/grub-install + [ -x /usr/sbin/grub-install ] && GRUBINSTALL=/usr/sbin/grub-install --no-floppy || GRUBINSTALL=/sbin/grub-install $GRUBINSTALL --root-directory="$MNTPOINT" "(${GRUB})" eend $? done else einfo "Installing grub on ${GRUB}:" - [ -x /usr/sbin/grub-install ] && GRUBINSTALL=/usr/sbin/grub-install || GRUBINSTALL=/sbin/grub-install + [ -x /usr/sbin/grub-install ] && GRUBINSTALL=/usr/sbin/grub-install --no-floppy || GRUBINSTALL=/sbin/grub-install $GRUBINSTALL --root-directory="$MNTPOINT" "(${GRUB})" eend $? fi @@ -776,13 +786,19 @@ fscktool() { for i in mkfs tunefs mount_target debootstrap_system preparechroot \ chrootscript grub_install umount_chroot fscktool ; do if stage "${i}" ; then - $i && ( stage "${i}" done && rmdir "${STAGES}/${1}" ) || bailout 2 "i" + $i && ( stage "${i}" done && rm -f "${STAGES}/${i}" ) || bailout 2 "i" fi done # }}} -# stages {{{ - echo done > $STAGES/grml-debootstrap +# finalize {{{ +einfo "Removing ${CHROOT_VARIABLES}" ; rm "$CHROOT_VARIABLES" ; eend $? +einfo "Removing ${STAGES}" ; rmdir "$STAGES" ; eend $? + +# Remove temporary mountpoint again +if echo "$MNTPOINT" | grep -q '/mnt/debootstrap\.' ; then + einfo "Removing directory ${MNTPOINT}" ; rmdir "$MNTPOINT" ; eend $? +fi # }}} # end dialog of autoinstallation {{{