-Replaced /bin/sh by /bin/bash to be able to use the source built-in keyword.
[hvlinux.git] / stage0 / stage0-install
index c358247..fe9b2f7 100755 (executable)
@@ -1,8 +1,20 @@
 #!/bin/bash
-set -o errexit
 
 LFS_STAGE=stage0
 
+# Let shell functions inherit ERR trap.  Same as `set -E'.
+set -o errtrace
+
+# Setting ERR trap does implicit `set -o errexit'.
+trap myerr ERR
+
+function myerr()
+{
+    echo
+    echo "*** An error occured during ${LFS_STAGE}"
+    exit 1
+}
+
 # Reading system configuration informations, functions and package versions.
 source ../sysinfos
 source ../functions
@@ -21,11 +33,6 @@ echo "Performing pre-install"
 # directory of the user.
 su - lfs -c "cd ${PWD}; ./install-1"
 
-if [ $? -ne 0 ]; then
-    echo "*** An error occured during ${LFS_STAGE}"
-    exit 1
-fi
-
 echo "Total build time: $(get_total_build_time ${LFS_LOG_FILE})h"
 
 exit 0