"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "install.sh" between
aif-2.1.0.tar.gz and aif-2.1.1.tar.gz

About: Arno’s iptables firewall is a stateful firewall script for both single and multi-homed machines with DSL/ADSL support.

install.sh  (aif-2.1.0):install.sh  (aif-2.1.1)
#!/bin/bash #!/bin/bash
MY_VERSION="1.12" MY_VERSION="1.13c"
# ------------------------------------------------------------------------------ ------------ # ------------------------------------------------------------------------------ ------------
# -= Arno's Iptables Firewall(AIF) =- # -= Arno's Iptables Firewall(AIF) =-
# Single- & multi-homed firewall script with DSL/ADSL support # Single- & multi-homed firewall script with DSL/ADSL support
# #
# ~ In memory of my dear father ~ # ~ In memory of my dear father ~
# #
# (C) Copyright 2001-2019 by Arno van Amersfoort # (C) Copyright 2001-2020 by Arno van Amersfoort
# Homepage : https://rocky.eld.leidenuniv.nl/ # Homepage : https://rocky.eld.leidenuniv.nl/
# Email : a r n o v a AT r o c k y DOT e l d DOT l e i d e n u n i v DOT n l # Email : a r n o v a AT r o c k y DOT e l d DOT l e i d e n u n i v DOT n l
# (note: you must remove all spaces and substitute the @ and the . # (note: you must remove all spaces and substitute the @ and the .
# at the proper locations!) # at the proper locations!)
# ------------------------------------------------------------------------------ ------------ # ------------------------------------------------------------------------------ ------------
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation. # version 2 as published by the Free Software Foundation.
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
skipping to change at line 105 skipping to change at line 105
return 2 # Full mismatch return 2 # Full mismatch
fi fi
return 0 # Match return 0 # Match
} }
copy_ask_if_exist() copy_ask_if_exist()
{ {
local diff_retval=-1 local diff_retval=-1
local retval local retval
local default_yn="${3:-'n'}" # Default to n(o)
local fallback_ext="$4"
if [ -z "$(find "$1" -type f)" ]; then if [ -z "$(find "$1" -type f)" ]; then
echo "ERROR: Missing source file(s) \"$1\"" echo "ERROR: Missing source file(s) \"$1\"" >&2
exit 2 exit 2
fi fi
unset IFS unset IFS
for source in `find "$1" -type f |grep -v -e '/\.svn/' -e '/\.git/'`; do for source in `find "$1" -type f |grep -v -e '/\.svn/' -e '/\.git/'`; do
if echo "$2" |grep -q '/$'; then if echo "$2" |grep -q '/$'; then
fn="$(echo "$source" |sed "s,^$1,,")" fn="$(echo "$source" |sed "s,^$1,,")"
if [ -z "$fn" ]; then if [ -z "$fn" ]; then
target="${2}$(basename "$1")" target="${2}$(basename "$1")"
else else
skipping to change at line 136 skipping to change at line 138
if [ ! -d "$target_dir" ]; then if [ ! -d "$target_dir" ]; then
printf "\033[40m\033[1;31m* WARNING: Target directory $target_dir does not exist. Skipping copy of $source!\033[0m\n" >&2 printf "\033[40m\033[1;31m* WARNING: Target directory $target_dir does not exist. Skipping copy of $source!\033[0m\n" >&2
continue continue
fi fi
if [ -f "$source" -a -f "$target" ]; then if [ -f "$source" -a -f "$target" ]; then
# Ignore files that are the same in the target # Ignore files that are the same in the target
shell_diff "$source" "$target" shell_diff "$source" "$target"
diff_retval=$? # 0 = full match, 1 = match (excluding comments), 2 = full mismatch (including comments) diff_retval=$? # 0 = full match, 1 = match (excluding comments), 2 = full mismatch (including comments)
if [ $diff_retval -eq 2 ] && ! get_user_yn "File \"$target\" already exist if [ $diff_retval -eq 2 ] && ! get_user_yn "File \"$target\" already exist
s. Overwrite" "n"; then s. Overwrite" "$default_yn"; then
if [ -z "$3" ]; then if [ -z "$fallback_ext" ]; then
echo "Skipped..." echo "Skipped..."
continue continue
else else
# Copy as e.g. .dist-file: # Copy as e.g. .dist-file:
target="${target}.${3}" target="${target}.${fallback_ext}"
rm -f "$target" rm -f "$target"
fi fi
fi fi
fi fi
retval=0 retval=0
if [ $diff_retval -eq 2 ]; then if [ $diff_retval -eq 2 ]; then
# copy file & create backup of old file if exists # copy file & create backup of old file if exists
cp -bv --preserve=mode,timestamps "$source" "$target" cp -bv --preserve=mode,timestamps "$source" "$target"
retval=$? retval=$?
skipping to change at line 300 skipping to change at line 302
if get_user_yn "WARNING: An old version is still installed. Removing it firs t is *STRONGLY* recommended. Remove" "y"; then if get_user_yn "WARNING: An old version is still installed. Removing it firs t is *STRONGLY* recommended. Remove" "y"; then
rm -fv /etc/init.d/arno-iptables-firewall rm -fv /etc/init.d/arno-iptables-firewall
mv -fv /etc/arno-iptables-firewall/custom-rules /etc/arno-iptables-firewal l/custom-rules.old mv -fv /etc/arno-iptables-firewall/custom-rules /etc/arno-iptables-firewal l/custom-rules.old
mv -fv /etc/arno-iptables-firewall/firewall.conf /etc/arno-iptables-firewa ll/firewall.conf.old mv -fv /etc/arno-iptables-firewall/firewall.conf /etc/arno-iptables-firewa ll/firewall.conf.old
rm -fv /etc/arno-iptables-firewall/plugins/*.plugin rm -fv /etc/arno-iptables-firewall/plugins/*.plugin
rm -fv /etc/rc*.d/*arno-iptables-firewall rm -fv /etc/rc*.d/*arno-iptables-firewall
fi fi
fi fi
} }
check_dist_version()
{
if [ -f /usr/sbin/arno-iptables-firewall ]; then
if ! get_user_yn "WARNING: It seems a distribution version is already instal
led. It's *STRONGLY* recommended to remove it first. Continue anyway" "y"; then
return 1
fi
fi
return 0
}
# Check plugins for (old) versions with different priority # Check plugins for (old) versions with different priority
check_plugins() check_plugins()
{ {
if [ -d /usr/local/share/arno-iptables-firewall/plugins ] && ls /usr/local/sha re/arno-iptables-firewall/plugins/*.plugin >/dev/null 2>&1; then if [ -d /usr/local/share/arno-iptables-firewall/plugins ] && ls /usr/local/sha re/arno-iptables-firewall/plugins/*.plugin >/dev/null 2>&1; then
unset IFS unset IFS
for PLUGIN_FILE in ./share/arno-iptables-firewall/plugins/*.plugin; do for PLUGIN_FILE in ./share/arno-iptables-firewall/plugins/*.plugin; do
PLUGIN_NAME="$(basename "$PLUGIN_FILE" |sed 's/^[0-9]*//')" PLUGIN_NAME="$(basename "$PLUGIN_FILE" |sed 's/^[0-9]*//')"
ls /usr/local/share/arno-iptables-firewall/plugins/*.plugin 2>/dev/null |g rep "/[0-9]*${PLUGIN_NAME}$" |grep -v "/$(basename "$PLUGIN_FILE")$" |while IFS= $EOL read PLUGIN_OLD; do ls /usr/local/share/arno-iptables-firewall/plugins/*.plugin 2>/dev/null |g rep "/[0-9]*${PLUGIN_NAME}$" |grep -v "/$(basename "$PLUGIN_FILE")$" |while IFS= $EOL read PLUGIN_OLD; do
echo "* Removing old plugin: $PLUGIN_OLD" echo "* Removing old plugin: $PLUGIN_OLD"
skipping to change at line 333 skipping to change at line 346
sanity_check sanity_check
# We want to run in the dir the install script is in # We want to run in the dir the install script is in
cd "$(dirname $0)" cd "$(dirname $0)"
if ! get_user_yn "Continue install" "n"; then if ! get_user_yn "Continue install" "n"; then
echo "*Install aborted" echo "*Install aborted"
exit 1 exit 1
fi fi
# Make sure there still isn't an old version installed # Make sure an old version is not still installed
check_18_version check_18_version
# Make sure a dist version is not already installed
if ! check_dist_version; then
echo "*Install aborted"
exit 1
fi
copy_overwrite ./bin/arno-iptables-firewall /usr/local/sbin/ copy_overwrite ./bin/arno-iptables-firewall /usr/local/sbin/
copy_overwrite ./bin/arno-fwfilter /usr/local/bin/ copy_overwrite ./bin/arno-fwfilter /usr/local/bin/
# Remove old version: # Remove old version:
rm -f /usr/local/sbin/arno-fwfilter rm -f /usr/local/sbin/arno-fwfilter
mkdir -pv /usr/local/share/arno-iptables-firewall/plugins || exit 1 mkdir -pv /usr/local/share/arno-iptables-firewall/plugins || exit 1
copy_overwrite ./share/arno-iptables-firewall/ /usr/local/share/arno-iptables-fi rewall/ copy_overwrite ./share/arno-iptables-firewall/ /usr/local/share/arno-iptables-fi rewall/
if [ ! -e /usr/local/sbin/traffic-accounting-show ]; then if [ ! -f /usr/local/sbin/traffic-accounting-show ]; then
ln -sv /usr/local/share/arno-iptables-firewall/plugins/traffic-accounting-show /usr/local/sbin/traffic-accounting-show ln -sv /usr/local/share/arno-iptables-firewall/plugins/traffic-accounting-show /usr/local/sbin/traffic-accounting-show
fi fi
mkdir -pv /usr/local/share/man/man1 || exit 1 mkdir -pv /usr/local/share/man/man1 || exit 1
mkdir -pv /usr/local/share/man/man8 || exit 1 mkdir -pv /usr/local/share/man/man8 || exit 1
gzip -c -v ./share/man/man8/arno-iptables-firewall.8 >/usr/local/share/man/man8/ arno-iptables-firewall.8.gz gzip -c -v ./share/man/man8/arno-iptables-firewall.8 >/usr/local/share/man/man8/ arno-iptables-firewall.8.gz
gzip -c -v ./share/man/man1/arno-fwfilter.1 >/usr/local/share/man/man8/arno-fwfi lter.1.gz gzip -c -v ./share/man/man1/arno-fwfilter.1 >/usr/local/share/man/man8/arno-fwfi lter.1.gz
mkdir -pv /usr/local/share/doc/arno-iptables-firewall || exit 1 mkdir -pv /usr/local/share/doc/arno-iptables-firewall || exit 1
copy_overwrite ./README /usr/local/share/doc/arno-iptables-firewall/ copy_overwrite ./README /usr/local/share/doc/arno-iptables-firewall/
# Install init.d script, but only if init.d folder exists # Install init.d script, but only if init.d folder exists
if [ -d "/etc/init.d" ]; then if [ -d "/etc/init.d" ]; then
copy_ask_if_exist ./etc/init.d/arno-iptables-firewall /etc/init.d/ copy_overwrite ./etc/init.d/arno-iptables-firewall /etc/init.d/
fi fi
# Make sure only one service file exists in /lib/.. or /usr/lib/ where we prefer /lib/ # Make sure only one service file exists in /lib/.. or /usr/lib/ where we prefer /lib/
rm -f /usr/lib/systemd/system/arno-iptables-firewall.service rm -f /usr/lib/systemd/system/arno-iptables-firewall.service
# Install service file if systemd directory is available, use fallbacks to suppo rt different systems # Install service file if systemd directory is available, use fallbacks to suppo rt different systems
if [ -d "/lib/systemd/system" ]; then if [ -d "/lib/systemd/system" ]; then
copy_overwrite ./lib/systemd/system/arno-iptables-firewall.service /lib/system d/system/ copy_overwrite ./lib/systemd/system/arno-iptables-firewall.service /lib/system d/system/
elif [ -d "/usr/lib/systemd/system" ]; then elif [ -d "/usr/lib/systemd/system" ]; then
copy_overwrite ./lib/systemd/system/arno-iptables-firewall.service /usr/lib/sy stemd/system/ copy_overwrite ./lib/systemd/system/arno-iptables-firewall.service /usr/lib/sy stemd/system/
elif [ -d "/etc/systemd/system" ]; then elif [ -d "/etc/systemd/system" ]; then
copy_ask_if_exist ./lib/systemd/system/arno-iptables-firewall.service /etc/syst emd/system/ copy_ask_if_exist ./lib/systemd/system/arno-iptables-firewall.service /etc/sys temd/system/ "y"
else else
echo "NOTE: Could not find any systemd/system directory, skipping systemd conf iguration" >&2 echo "NOTE: Could not find any systemd/system directory, skipping systemd conf iguration" >&2
fi fi
# Install rsyslog config file (if rsyslog is available) # Install rsyslog config file (if rsyslog is available)
if [ -d "/etc/rsyslog.d" ]; then if [ -d "/etc/rsyslog.d" ]; then
copy_ask_if_exist ./etc/rsyslog.d/arno-iptables-firewall.conf /etc/rsyslog.d/ copy_ask_if_exist ./etc/rsyslog.d/arno-iptables-firewall.conf /etc/rsyslog.d/ "y"
fi fi
copy_ask_if_exist ./etc/logrotate.d/arno-iptables-firewall /etc/logrotate.d/ "y"
mkdir -pv /etc/arno-iptables-firewall || exit 1 mkdir -pv /etc/arno-iptables-firewall || exit 1
copy_overwrite ./etc/arno-iptables-firewall/firewall.conf /etc/arno-iptables-fir ewall/firewall.conf.dist copy_overwrite ./etc/arno-iptables-firewall/firewall.conf /etc/arno-iptables-fir ewall/firewall.conf.dist
copy_ask_if_exist ./etc/arno-iptables-firewall/firewall.conf /etc/arno-iptables- firewall/ copy_ask_if_exist ./etc/arno-iptables-firewall/firewall.conf /etc/arno-iptables- firewall/
copy_skip_if_exist ./etc/arno-iptables-firewall/custom-rules /etc/arno-iptables- firewall/ copy_skip_if_exist ./etc/arno-iptables-firewall/custom-rules /etc/arno-iptables- firewall/
mkdir -pv /etc/arno-iptables-firewall/plugins || exit 1 mkdir -pv /etc/arno-iptables-firewall/plugins || exit 1
copy_ask_if_exist ./etc/arno-iptables-firewall/plugins/ /etc/arno-iptables-firew all/plugins/ "dist" copy_ask_if_exist ./etc/arno-iptables-firewall/plugins/ /etc/arno-iptables-firew all/plugins/ "n" "dist"
mkdir -pv /etc/arno-iptables-firewall/conf.d || exit 1 mkdir -pv /etc/arno-iptables-firewall/conf.d || exit 1
echo "Files with a .conf extension in this directory will be sourced by the envi ronment file" >/etc/arno-iptables-firewall/conf.d/README echo "Files with a .conf extension in this directory will be sourced by the envi ronment file" >/etc/arno-iptables-firewall/conf.d/README
check_plugins check_plugins
echo "" echo ""
echo "** Install done **" echo "** Install done **"
echo "" echo ""
 End of changes. 15 change blocks. 
13 lines changed or deleted 35 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)