eerror() {
[ "${RC_ENDCOL}" != "yes" ] && [ "${LAST_E_CMD}" = "ebegin" ] && echo
- printf " ${BAD}*${NORMAL} $*\n"
+ printf " ${BAD}*${NORMAL} $*\n" >&2
LAST_E_CMD=eerror
return 0
}
[ $? -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
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
}
# }}}
# 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
}
# }}}