r3742 - in jhalfs/branches/ablfs: . BLFS/xsl common/libs

pierre at higgs.linuxfromscratch.org pierre at higgs.linuxfromscratch.org
Wed Oct 30 08:51:57 PDT 2013


Author: pierre
Date: Wed Oct 30 08:51:56 2013
New Revision: 3742

Log:
Merge trunk r3741 (error handling)

Modified:
   jhalfs/branches/ablfs/BLFS/xsl/scripts.xsl
   jhalfs/branches/ablfs/common/libs/func_install_blfs
   jhalfs/branches/ablfs/jhalfs

Modified: jhalfs/branches/ablfs/BLFS/xsl/scripts.xsl
==============================================================================
--- jhalfs/branches/ablfs/BLFS/xsl/scripts.xsl	Wed Oct 30 08:44:46 2013	(r3741)
+++ jhalfs/branches/ablfs/BLFS/xsl/scripts.xsl	Wed Oct 30 08:51:56 2013	(r3742)
@@ -433,7 +433,18 @@
 URL=</xsl:text>
       <xsl:value-of select="id('bootscripts')//itemizedlist//ulink/@url"/><xsl:text>
 BOOTPACKG=$(basename $URL)
-[[ ! -f "$BOOTPACKG" ]] && { wget -T 30 -t 5 $URL; rm -f unpacked; }
+if [[ ! -f $BOOTPACKG ]] ; then
+  if [[ -f $SRC_ARCHIVE/$PKG_DIR/$BOOTPACKG ]] ; then
+    cp $SRC_ARCHIVE/$PKG_DIR/$BOOTPACKG $BOOTPACKG
+  elif [[ -f $SRC_ARCHIVE/$BOOTPACKG ]] ; then
+    cp $SRC_ARCHIVE/$BOOTPACKG $BOOTPACKG
+  else
+    wget -T 30 -t 5 $URL
+    cp $BOOTPACKG $SRC_ARCHIVE
+  fi
+  rm -f unpacked
+fi
+
 if [[ -e unpacked ]] ; then
   UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
   if ! [[ -d $UNPACKDIR ]]; then

Modified: jhalfs/branches/ablfs/common/libs/func_install_blfs
==============================================================================
--- jhalfs/branches/ablfs/common/libs/func_install_blfs	Wed Oct 30 08:44:46 2013	(r3741)
+++ jhalfs/branches/ablfs/common/libs/func_install_blfs	Wed Oct 30 08:51:56 2013	(r3742)
@@ -122,7 +122,7 @@
 sed -n -e '/PACKAGE=/,/md5sum/p' \
        -e '/PACKAGE1=/,/^fi/p' \
        -e '/PATCH=/,/^fi/p' \
-       -e '/URL=/,/unpacked/p' \
+       -e '/URL=/,/^fi/p' \
     $BUILDDIR$BLFS_ROOT/scripts/* >> $BUILDDIR$BLFS_ROOT/download_script
 chmod u+x $BUILDDIR$BLFS_ROOT/download_script
 

Modified: jhalfs/branches/ablfs/jhalfs
==============================================================================
--- jhalfs/branches/ablfs/jhalfs	Wed Oct 30 08:44:46 2013	(r3741)
+++ jhalfs/branches/ablfs/jhalfs	Wed Oct 30 08:51:56 2013	(r3742)
@@ -1,6 +1,8 @@
 #!/bin/bash
 # $Id$
 set -e
+# Pass trap handlers to functions
+set -E
 
 # VT100 colors
 declare -r  BLACK=$'\e[1;30m'
@@ -37,8 +39,14 @@
 #-----------------------#
   # If +e then disable text output
   if [[ "$-" =~ e ]]; then
-    echo -e "\n${RED}ERROR:${GREEN} basic error trapped!${OFF}\n" >&2
+    LASTLINE="$1"
+    LASTERR="$2"
+    LASTFUNC="$3"
+    LASTSOURCE="$4"
+#    echo -e "\n${RED}ERROR:${GREEN} basic error trapped!${OFF}\n" >&2
+    echo -e "\n${RED}ERROR:${GREEN} Error $LASTERR at $LASTSOURCE line ${LASTLINE}!${OFF}\n" >&2
   fi
+  exit $LASTERR
 }
 
 see_ya() {
@@ -57,7 +65,7 @@
 #####
 set -e
 trap see_ya 0
-trap simple_error ERR
+trap 'simple_error "${LINENO}" "$?" "${FUNCNAME}" "${BASH_SOURCE}"' ERR
 trap 'echo -e "\n\n${RED}INTERRUPT${OFF} trapped\n" &&  exit 2'  1 2 3 15 17 18 23
 #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 
@@ -374,6 +382,7 @@
     echo Downloading and validating the BLFS book
     echo '(may take some time...)'
     install_blfs_tools 2>&1 | tee -a $LOGDIR/$LOG
+    [[ ${PIPESTATUS[0]} != 0 ]] && exit 1
   fi
   #
 



More information about the alfs-log mailing list