[ -n "$RELEASE" ] && INFOTEXT="$INFOTEXT
Using release: $RELEASE"
[ -n "$HOSTNAME" ] && INFOTEXT="$INFOTEXT
- Using hostname $HOSTNAME"
+ Using hostname: $HOSTNAME"
[ -n "$MIRROR" ] && INFOTEXT="$INFOTEXT
Using mirror: $MIRROR"
[ -n "$ISO" ] && INFOTEXT="$INFOTEXT
Using ISO: $ISO"
+ [ -n "$ARCH" ] && INFOTEXT="$INFOTEXT
+ Using arch: $ARCH"
INFOTEXT="$INFOTEXT
[ $? -eq 0 ] || bailout 0
else # if not running automatic installation display configuration and prompt for execution:
- einfo "$PN - Please recheck configuration before execution:"
+ einfo "$PN [${VERSION}] - Please recheck configuration before execution:"
echo
echo " Target: $TARGET"
fi
[ -n "$RELEASE" ] && echo " Using release: $RELEASE"
- [ -n "$MIRROR" ] && echo " Using mirror: $MIRROR"
[ -n "$HOSTNAME" ] && echo " Using hostname: $HOSTNAME"
+ [ -n "$MIRROR" ] && echo " Using mirror: $MIRROR"
[ -n "$ISO" ] && echo " Using ISO: $ISO"
+ [ -n "$ARCH" ] && echo " Using arch: $ARCH"
if [ -n "$VIRTUAL" ] ; then
echo " Deploying as Virtual Machine."
[ -n "$VMSIZE" ] && echo " Using Virtual Disk file with size of ${VMSIZE}."
fi
# }}}
+# architecture setup {{{
+if [ -n "$ARCH" ] ; then
+ ARCHCMD="--arch $ARCH"
+ ARCHINFO=" (${ARCH})"
+else
+ ARCH="$(dpkg --print-architecture)"
+ ARCHCMD="--arch $ARCH"
+ ARCHINFO=" (${ARCH})"
+fi
+# }}}
+
checkconfiguration
# finally make sure at least $TARGET is set [the partition for the new system] {{{
fi
# }}}
-# architecture setup {{{
-if [ -n "$ARCH" ] ; then
- ARCHCMD="--arch $ARCH"
- ARCHINFO=" (${ARCH})"
-else
- ARCH="$(dpkg --print-architecture)"
- ARCHCMD="--arch $ARCH"
- ARCHINFO=" (${ARCH})"
-fi
-# }}}
-
# make sure we have the right syntax when using an iso image {{{
if [ -n "$ISO" ] ; then
case $ISO in
# if dm-mod isn't available then kpartx will fail with
# "Is device-mapper driver missing from kernel? [...]"
- if ! kpartx -av $TARGET >/dev/null 2>&1 ; then
+ if ! kpartx -av $TARGET >/dev/null 2>&1 || ! grep -q device-mapper /proc/misc >/dev/null 2>&1 ; then
einfo "Device-mapper not ready yet, trying to load dm-mod module."
modprobe dm-mod ; eend $?
fi
rm -f "${MNTPOINT}/tmp/core.img"
einfo "Updating grub configuration file."
+ if [ -n "$BOOT_APPEND" ] ; then
+ sed -i "/GRUB_CMDLINE_LINUX_DEFAULT/ s#\"\$# ${BOOT_APPEND}\"#" "${MNTPOINT}"/etc/default/grub
+ fi
chroot "${MNTPOINT}" update-grub
umount "${MNTPOINT}"/proc
fi
if grep -q "$MNTPOINT" /proc/mounts || [ -n "$DIRECTORY" ] ; then
- einfo "Running $DEBOOTSTRAP $DEBOOTSTRAP_OPT for release ${RELEASE}${ARCHINFO} using ${MIRROR}${ISO}"
- if [ -n "$MIRROR" ] ; then
- einfo "Executing: $DEBOOTSTRAP $ARCHCMD $KEYRING $DEBOOTSTRAP_OPT $RELEASE $MNTPOINT $MIRROR"
- $DEBOOTSTRAP $ARCHCMD $KEYRING $DEBOOTSTRAP_OPT $RELEASE $MNTPOINT $MIRROR
- else
- einfo "Executing: $DEBOOTSTRAP $ARCHCMD $KEYRING $DEBOOTSTRAP_OPT $RELEASE $MNTPOINT $ISO"
- $DEBOOTSTRAP $ARCHCMD $KEYRING $DEBOOTSTRAP_OPT $RELEASE $MNTPOINT $ISO
- fi
- eend $?
+ :
else
- eerror "Error: $MNTPOINT not mounted, can not continue."
- eend 1
+ eerror "Error: $MNTPOINT not mounted, can not continue."
+ eend 1 ; exit 1
+ fi
+
+ einfo "Running $DEBOOTSTRAP $DEBOOTSTRAP_OPT for release ${RELEASE}${ARCHINFO} using ${MIRROR}${ISO}"
+ if [ -n "$MIRROR" ] ; then
+ einfo "Executing: $DEBOOTSTRAP $ARCHCMD $KEYRING $DEBOOTSTRAP_OPT $RELEASE $MNTPOINT $MIRROR"
+ $DEBOOTSTRAP $ARCHCMD $KEYRING $DEBOOTSTRAP_OPT $RELEASE $MNTPOINT $MIRROR
+ RC=$?
+ else
+ einfo "Executing: $DEBOOTSTRAP $ARCHCMD $KEYRING $DEBOOTSTRAP_OPT $RELEASE $MNTPOINT $ISO"
+ $DEBOOTSTRAP $ARCHCMD $KEYRING $DEBOOTSTRAP_OPT $RELEASE $MNTPOINT $ISO
+ RC=$?
fi
+
+ if [ $RC -ne 0 ] ; then
+ if [ -r "$MNTPOINT/debootstrap/debootstrap.log" ] && \
+ [ -s "$MNTPOINT/debootstrap/debootstrap.log" ] ; then
+ einfo "Presenting last ten lines of debootstrap.log:"
+ tail -10 $MNTPOINT/debootstrap/debootstrap.log
+ einfo "End of debootstrap.log"
+ fi
+ fi
+
+ eend $RC
}
# }}}