Move return code check of FAI-run before wrinting to /etc of live system
[grml-live.git] / grml-live
index 5ef31a1..1f9b37d 100755 (executable)
--- a/grml-live
+++ b/grml-live
@@ -696,6 +696,12 @@ else
                   -u "$HOSTNAME" "$FAI_ACTION" "$CHROOT_OUTPUT" $FAI_ARGS | tee -a $LOGFILE
       RC="$PIPESTATUS" # notice: bash-only
 
+      if [ "$RC" != 0 ] ; then
+         log    "Error: critical error while executing fai [exit code ${RC}]. Exiting."
+         eerror "Error: critical error while executing fai [exit code ${RC}]. Exiting." ; eend 1
+         bailout 1
+      fi
+
       # provide inform fai about the ISO we build, needs to be provided
       # *after* FAI stage, otherwise FAI skips the debootstrap stage if
       # there is not BASEFILE (as it checks for presence of /etc) :(
@@ -705,12 +711,6 @@ else
 
       FORCE_ISO_REBUILD=true
 
-      if [ "$RC" != 0 ] ; then
-         log    "Error: critical error while executing fai [exit code ${RC}]. Exiting."
-         eerror "Error: critical error while executing fai [exit code ${RC}]. Exiting." ; eend 1
-         bailout 1
-      fi
-
       # move fai logs into grml_logs directory
       mkdir -p "$LOG_OUTPUT"/fai/
       cp -r "$CHROOT_OUTPUT"/var/log/fai/"$HOSTNAME"/last/* "$LOG_OUTPUT"/fai/