Use a function to fail on fatal error

Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Matt Darfeuille 2017-02-20 18:52:03 +01:00 committed by Tom Eastep
parent 50a9b4cc6a
commit a496edef54
No known key found for this signature in database
GPG Key ID: 96E6B3F2423A4D10
4 changed files with 8 additions and 16 deletions

View File

@ -241,8 +241,7 @@ case "$HOST" in
debian|gentoo|redhat|slackware|archlinux|linux|suse|openwrt)
;;
*)
echo "ERROR: Unknown HOST \"$HOST\"" >&2
exit 1;
fatal_error "Unknown HOST \"$HOST\""
;;
esac

View File

@ -254,12 +254,10 @@ case "$HOST" in
echo "Installing Openwrt-specific configuration..."
;;
linux)
echo "ERROR: Shorewall-init is not supported on this system" >&2
exit 1
fatal_error "Shorewall-init is not supported on this system"
;;
*)
echo "ERROR: Unsupported HOST distribution: \"$HOST\"" >&2
exit 1;
fatal_error "Unsupported HOST distribution: \"$HOST\""
;;
esac

View File

@ -269,8 +269,7 @@ case "$HOST" in
linux)
;;
*)
echo "ERROR: Unknown HOST \"$HOST\"" >&2
exit 1;
fatal_error "ERROR: Unknown HOST \"$HOST\""
;;
esac

View File

@ -266,8 +266,7 @@ case "$HOST" in
linux)
;;
*)
echo "ERROR: Unknown HOST \"$HOST\"" >&2
exit 1;
fatal_error "Unknown HOST \"$HOST\""
;;
esac
@ -278,8 +277,7 @@ if [ $PRODUCT = shorewall ]; then
#
if [ "$DIGEST" != SHA ]; then
if [ "$BUILD" = "$HOST" ] && ! eval perl -e \'use Digest::$DIGEST\;\' 2> /dev/null ; then
echo "ERROR: Perl compilation with Digest::$DIGEST failed" >&2
exit 1;
fatal_error "Perl compilation with Digest::$DIGEST failed"
fi
cp -af Perl/Shorewall/Chains.pm Perl/Shorewall/Chains.pm.bak
@ -302,8 +300,7 @@ if [ $PRODUCT = shorewall ]; then
sed -i 's/Digest::SHA/Digest::SHA1/' Perl/Shorewall/Config.pm
DIGEST=SHA1
else
echo "ERROR: Shorewall $VERSION requires either Digest::SHA or Digest::SHA1" >&2
exit 1
fatal_error "Shorewall $VERSION requires either Digest::SHA or Digest::SHA1"
fi
fi
fi
@ -334,8 +331,7 @@ fi
run_install -d $OWNERSHIP -m 0755 ${DESTDIR}${SBINDIR}
[ -n "${INITFILE}" ] && run_install -d $OWNERSHIP -m 0755 ${DESTDIR}${INITDIR}
if [ -z "$DESTDIR" -a $PRODUCT != shorewall ]; then
[ -x ${LIBEXECDIR}/shorewall/compiler.pl ] || \
{ echo " ERROR: Shorewall >= 4.5.0 is not installed" >&2; exit 1; }
[ -x ${LIBEXECDIR}/shorewall/compiler.pl ] || fatal_error "Shorewall >= 4.5.0 is not installed"
fi
echo "Installing $Product Version $VERSION"