Merge trunk r3741 (error handling)
This commit is contained in:
parent
04ba33625a
commit
199132680a
3 changed files with 24 additions and 4 deletions
|
@ -433,7 +433,18 @@ pushd $SRC_DIR/blfs-bootscripts
|
||||||
URL=</xsl:text>
|
URL=</xsl:text>
|
||||||
<xsl:value-of select="id('bootscripts')//itemizedlist//ulink/@url"/><xsl:text>
|
<xsl:value-of select="id('bootscripts')//itemizedlist//ulink/@url"/><xsl:text>
|
||||||
BOOTPACKG=$(basename $URL)
|
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
|
if [[ -e unpacked ]] ; then
|
||||||
UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
|
||||||
if ! [[ -d $UNPACKDIR ]]; then
|
if ! [[ -d $UNPACKDIR ]]; then
|
||||||
|
|
|
@ -122,7 +122,7 @@ echo -e '#!/bin/bash\nset -e\n' > $BUILDDIR$BLFS_ROOT/download_script
|
||||||
sed -n -e '/PACKAGE=/,/md5sum/p' \
|
sed -n -e '/PACKAGE=/,/md5sum/p' \
|
||||||
-e '/PACKAGE1=/,/^fi/p' \
|
-e '/PACKAGE1=/,/^fi/p' \
|
||||||
-e '/PATCH=/,/^fi/p' \
|
-e '/PATCH=/,/^fi/p' \
|
||||||
-e '/URL=/,/unpacked/p' \
|
-e '/URL=/,/^fi/p' \
|
||||||
$BUILDDIR$BLFS_ROOT/scripts/* >> $BUILDDIR$BLFS_ROOT/download_script
|
$BUILDDIR$BLFS_ROOT/scripts/* >> $BUILDDIR$BLFS_ROOT/download_script
|
||||||
chmod u+x $BUILDDIR$BLFS_ROOT/download_script
|
chmod u+x $BUILDDIR$BLFS_ROOT/download_script
|
||||||
|
|
||||||
|
|
13
jhalfs
13
jhalfs
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# $Id$
|
# $Id$
|
||||||
set -e
|
set -e
|
||||||
|
# Pass trap handlers to functions
|
||||||
|
set -E
|
||||||
|
|
||||||
# VT100 colors
|
# VT100 colors
|
||||||
declare -r BLACK=$'\e[1;30m'
|
declare -r BLACK=$'\e[1;30m'
|
||||||
|
@ -37,8 +39,14 @@ simple_error() { # Basic error trap.... JUST DIE
|
||||||
#-----------------------#
|
#-----------------------#
|
||||||
# If +e then disable text output
|
# If +e then disable text output
|
||||||
if [[ "$-" =~ e ]]; then
|
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
|
fi
|
||||||
|
exit $LASTERR
|
||||||
}
|
}
|
||||||
|
|
||||||
see_ya() {
|
see_ya() {
|
||||||
|
@ -57,7 +65,7 @@ see_ya() {
|
||||||
#####
|
#####
|
||||||
set -e
|
set -e
|
||||||
trap see_ya 0
|
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
|
trap 'echo -e "\n\n${RED}INTERRUPT${OFF} trapped\n" && exit 2' 1 2 3 15 17 18 23
|
||||||
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||||
|
|
||||||
|
@ -374,6 +382,7 @@ if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then
|
||||||
echo Downloading and validating the BLFS book
|
echo Downloading and validating the BLFS book
|
||||||
echo '(may take some time...)'
|
echo '(may take some time...)'
|
||||||
install_blfs_tools 2>&1 | tee -a $LOGDIR/$LOG
|
install_blfs_tools 2>&1 | tee -a $LOGDIR/$LOG
|
||||||
|
[[ ${PIPESTATUS[0]} != 0 ]] && exit 1
|
||||||
fi
|
fi
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
Reference in a new issue