# Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
# Bug-Reports: see http://grml.org/bugs/
# License: This file is licensed under the GPL v2 or any later version.
-# Latest change: Tue Sep 18 20:32:35 CEST 2007 [mika]
+# Latest change: Tue Sep 18 22:46:28 CEST 2007 [mika]
################################################################################
# read configuration files, set some misc variables {{{
while getopts "c:s:t:Fhv" opt; do
case "$opt" in
c) CLASSES="$OPTARG" ;;
- # f) FLAVOUR="$OPTARG" ;; # TODO
F) FORCE=1 ;;
h) usage ; bailout 0 ;;
s) SUITE="$OPTARG" ;;
# does this suck? YES!
if [ -n "$SUITE" ] ; then
- sed -ie "s/SUITE=.*/SUITE=\"$SUITE\"/" $LIVE_CONF
+ sed -i "s/SUITE=.*/SUITE=\"$SUITE\"/" $LIVE_CONF
DIST="\|\ etch\ \|\ stable\ \|\ lenny\ \|\ testing\ \|\ sid\ \|\ unstable\ "
- sed -ie "s/\(deb .\+\)\([ \t]+\)$DIST\([ \t]+\)\(main \)/\1\2 $SUITE \3\4/" $LIVE_CONF
- sed -ie "s/\(deb .\+\)\([ \t]+\)$DIST\([ \t]+\)\(main \)/\1\2 $SUITE \3\4/" /etc/grml/fai/apt/sources.list
+ sed -i "s/\(deb .\+\)\([ \t]+\)$DIST\([ \t]+\)\(main \)/\1\2 $SUITE \3\4/" $LIVE_CONF
+ sed -i "s/\(deb .\+\)\([ \t]+\)$DIST\([ \t]+\)\(main \)/\1\2 $SUITE \3\4/" /etc/grml/fai/apt/sources.list
DIST='\"etch\|=\"stable=\"lenny=\"testing=\"sid=\"unstable'
- sed -ie "s#FAI_DEBOOTSTRAP=$DIST#FAI_DEBOOTSTRAP=\"$SUITE#" $LIVE_CONF
- sed -ie "s#FAI_DEBOOTSTRAP=$DIST#FAI_DEBOOTSTRAP=\"$SUITE#" /etc/grml/fai/make-fai-nfsroot.conf
+ sed -i "s#FAI_DEBOOTSTRAP=$DIST#FAI_DEBOOTSTRAP=\"$SUITE#" $LIVE_CONF
+ sed -i "s#FAI_DEBOOTSTRAP=$DIST#FAI_DEBOOTSTRAP=\"$SUITE#" /etc/grml/fai/make-fai-nfsroot.conf
fi
# }}}
[ -n "$CHROOT_TARGET" ] || CHROOT_TARGET="$TARGET/grml_chroot"
if [ -d "$CHROOT_TARGET" ] ; then
- echo " [x] $CHROOT_TARGET exists already, skipping the stage 'fai dirnstall'"
+ echo " [x] $CHROOT_TARGET exists already, skipping the stage 'fai dirinstall'"
else
mkdir -p "$CHROOT_TARGET" || bailout 5 "Problem with creating $CHROOT_TARGET for FAI"
if [ -n "${MIRROR_DIRECTORY}" ] ; then
umount $CHROOT_TARGET/proc 2>/dev/null || /bin/true
umount $CHROOT_TARGET/sys 2>/dev/null || /bin/true
[ -n "$MIRROR_DIRECTORY" ] && umount "${CHROOT_TARGET}/${MIRROR_DIRECTORY}"
- # notice: 'fai dirinstall' does not seem to exit appropriate ->
- # we need better error handling
- if [ -r "$CHROOT_TARGET"/etc/grml_cd ] ; then
- echo " [*] Finished execution of stage 'fai dirinstall'"
- else
+
+ # notice: 'fai dirinstall' does not seem to exit appropriate, so:
+ ERROR=''
+ [ -r "/var/log/fai/dirinstall/$HOSTNAME/software.log" ] &&
+ grep -q 'dpkg: error processing' /var/log/fai/dirinstall/$HOSTNAME/software.log && ERROR=1
+
+ [ -r "/var/log/fai/dirinstall/$HOSTNAME/shell.log" ] &&
+ grep -q 'FAILED with exit code' /var/log/fai/dirinstall/$HOSTNAME/shell.log && ERROR=2
+
+ if [ -n "$ERROR" ] ; then
echo " [!] There was an error during execution of stage 'fai dirinstall'"
+ echo " Check out /var/log/fai/dirinstall/$HOSTNAME/... for details. [exit ${ERROR}]"
exit 1
+ else
+ echo " [*] Finished execution of stage 'fai dirinstall'"
fi
fi
# }}}