Signed-off-by: Matt Darfeuille <[email protected]>
---
Shorewall-core/install.sh | 48 +++++-----------------------------------
Shorewall-init/install.sh | 49 +++++------------------------------------
Shorewall-lite/install.sh | 56 +++++------------------------------------------
Shorewall/install.sh | 47 +++++----------------------------------
4 files changed, 20 insertions(+), 180 deletions(-)
diff --git a/Shorewall-core/install.sh b/Shorewall-core/install.sh
index 6e4a131..e6b056c 100755
--- a/Shorewall-core/install.sh
+++ b/Shorewall-core/install.sh
@@ -36,50 +36,12 @@ usage() # $1 = exit status
exit $1
}
-fatal_error()
-{
- echo " ERROR: $@" >&2
- exit 1
-}
-
-split() {
- local ifs
- ifs=$IFS
- IFS=:
- set -- $1
- echo $*
- IFS=$ifs
-}
-
-qt()
-{
- "$@" >/dev/null 2>&1
-}
-
-mywhich() {
- local dir
-
- for dir in $(split $PATH); do
- if [ -x $dir/$1 ]; then
- echo $dir/$1
- return 0
- fi
- done
-
- return 2
-}
-
cant_autostart()
{
echo
echo "WARNING: Unable to configure shorewall to start automatically at
boot" >&2
}
-delete_file() # $1 = file to delete
-{
- rm -f $1
-}
-
install_file() # $1 = source $2 = target $3 = mode
{
if cp -f $1 $2; then
@@ -98,17 +60,17 @@ install_file() # $1 = source $2 = target $3 = mode
exit 1
}
-require()
-{
- eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
-}
-
#
# Change to the directory containing this script
#
cd "$(dirname $0)"
#
+# Source common functions
+#
+. ./lib.installer || { echo "ERROR: Can not load common functions." >&2; exit
1; }
+
+#
# Parse the run line
#
finished=0
diff --git a/Shorewall-init/install.sh b/Shorewall-init/install.sh
index 937131e..4ff3ee6 100755
--- a/Shorewall-init/install.sh
+++ b/Shorewall-init/install.sh
@@ -41,38 +41,6 @@ usage() # $1 = exit status
exit $1
}
-fatal_error()
-{
- echo " ERROR: $@" >&2
- exit 1
-}
-
-split() {
- local ifs
- ifs=$IFS
- IFS=:
- set -- $1
- echo $*
- IFS=$ifs
-}
-
-qt()
-{
- "$@" >/dev/null 2>&1
-}
-
-mywhich() {
- local dir
-
- for dir in $(split $PATH); do
- if [ -x $dir/$1 ]; then
- return 0
- fi
- done
-
- return 2
-}
-
cant_autostart()
{
echo
@@ -97,24 +65,17 @@ install_file() # $1 = source $2 = target $3 = mode
exit 1
}
-make_directory() # $1 = directory , $2 = mode
-{
- mkdir -p $1
- chmod 0755 $1
- [ -n "$OWNERSHIP" ] && chown $OWNERSHIP $1
-}
-
-require()
-{
- eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
-}
-
#
# Change to the directory containing this script
#
cd "$(dirname $0)"
#
+# Source common functions
+#
+. ./lib.installer || { echo "ERROR: Can not load common functions." >&2; exit
1; }
+
+#
# Parse the run line
#
diff --git a/Shorewall-lite/install.sh b/Shorewall-lite/install.sh
index adc2390..92fe219 100755
--- a/Shorewall-lite/install.sh
+++ b/Shorewall-lite/install.sh
@@ -34,50 +34,12 @@ usage() # $1 = exit status
exit $1
}
-fatal_error()
-{
- echo " ERROR: $@" >&2
- exit 1
-}
-
-split() {
- local ifs
- ifs=$IFS
- IFS=:
- set -- $1
- echo $*
- IFS=$ifs
-}
-
-qt()
-{
- "$@" >/dev/null 2>&1
-}
-
-mywhich() {
- local dir
-
- for dir in $(split $PATH); do
- if [ -x $dir/$1 ]; then
- echo $dir/$1
- return 0
- fi
- done
-
- return 2
-}
-
cant_autostart()
{
echo
echo "WARNING: Unable to configure $Product to start automatically at
boot" >&2
}
-delete_file() # $1 = file to delete
-{
- rm -f $1
-}
-
install_file() # $1 = source $2 = target $3 = mode
{
if cp -f $1 $2; then
@@ -96,19 +58,6 @@ install_file() # $1 = source $2 = target $3 = mode
exit 1
}
-make_directory() # $1 = directory , $2 = mode
-{
- mkdir -p $1
- chmod 755 $1
- [ -n "$OWNERSHIP" ] && chown $OWNERSHIP $1
-
-}
-
-require()
-{
- eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
-}
-
#
# Change to the directory containing this script
#
@@ -123,6 +72,11 @@ else
fi
#
+# Source common functions
+#
+. ./lib.installer || { echo "ERROR: Can not load common functions." >&2; exit
1; }
+
+#
# Parse the run line
#
finished=0
diff --git a/Shorewall/install.sh b/Shorewall/install.sh
index 38c43cf..7bce503 100755
--- a/Shorewall/install.sh
+++ b/Shorewall/install.sh
@@ -39,38 +39,6 @@ usage() # $1 = exit status
exit $1
}
-fatal_error()
-{
- echo " ERROR: $@" >&2
- exit 1
-}
-
-split() {
- local ifs
- ifs=$IFS
- IFS=:
- set -- $1
- echo $*
- IFS=$ifs
-}
-
-qt()
-{
- "$@" >/dev/null 2>&1
-}
-
-mywhich() {
- local dir
-
- for dir in $(split $PATH); do
- if [ -x $dir/$1 ]; then
- return 0
- fi
- done
-
- return 2
-}
-
run_install()
{
if ! install $*; then
@@ -86,21 +54,11 @@ cant_autostart()
echo "WARNING: Unable to configure $PRODUCT to start automatically at
boot" >&2
}
-delete_file() # $1 = file to delete
-{
- rm -f $1
-}
-
install_file() # $1 = source $2 = target $3 = mode
{
run_install $T $OWNERSHIP -m $3 $1 ${2}
}
-require()
-{
- eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
-}
-
cd "$(dirname $0)"
if [ -f shorewall.service ]; then
@@ -112,6 +70,11 @@ else
fi
#
+# Source common functions
+#
+. ./lib.installer || { echo "ERROR: Can not load common functions." >&2; exit
1; }
+
+#
# Parse the run line
#
#
--
2.8.3
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Shorewall-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/shorewall-devel