forked from extern/shorewall_code
Fix bugs in rewritten install.sh and fallback.sh
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@2614 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
a8f1321713
commit
aea76779d2
@ -39,7 +39,7 @@ usage() # $1 = exit status
|
|||||||
restore_directory() # $1 = directory to restore
|
restore_directory() # $1 = directory to restore
|
||||||
{
|
{
|
||||||
if [ -d ${1}-${VERSION}.bkout ]; then
|
if [ -d ${1}-${VERSION}.bkout ]; then
|
||||||
if rm -rf $1 && mv ${1}-${VERSION}.bkout $1
|
if mv -f $1 ${1}-${VERSION} && mv ${1}-${VERSION}.bkout $1; then
|
||||||
echo
|
echo
|
||||||
echo "$1 restored"
|
echo "$1 restored"
|
||||||
else
|
else
|
||||||
@ -70,7 +70,7 @@ fi
|
|||||||
echo "Backing Out Installation of Shorewall $VERSION"
|
echo "Backing Out Installation of Shorewall $VERSION"
|
||||||
|
|
||||||
if [ -L /usr/share/shorewall/init ]; then
|
if [ -L /usr/share/shorewall/init ]; then
|
||||||
FIREWALL=$(ls -l /usr/share/shorewall/firewall | sed 's/^.*> //')
|
FIREWALL=$(ls -l /usr/share/shorewall/init | sed 's/^.*> //')
|
||||||
restore_file $FIREWALL
|
restore_file $FIREWALL
|
||||||
else
|
else
|
||||||
restore_file /etc/init.d/shorewall
|
restore_file /etc/init.d/shorewall
|
||||||
|
@ -52,12 +52,13 @@ cant_autostart()
|
|||||||
backup_directory() # $1 = directory to backup
|
backup_directory() # $1 = directory to backup
|
||||||
{
|
{
|
||||||
if [ -d $1 ]; then
|
if [ -d $1 ]; then
|
||||||
if -a $1 ${1}-${VERSION}.bkout ; then
|
if cp -a $1 ${1}-${VERSION}.bkout ; then
|
||||||
echo
|
echo
|
||||||
echo "$1 saved to ${1}-${VERSION}.bkout"
|
echo "$1 saved to ${1}-${VERSION}.bkout"
|
||||||
else
|
else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
backup_file() # $1 = file to backup
|
backup_file() # $1 = file to backup
|
||||||
@ -84,6 +85,11 @@ delete_file() # $1 = file to delete
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
install_file() # $1 = source $2 = target $3 = mode
|
||||||
|
{
|
||||||
|
run_install $OWNERSHIP -m $3 $1 ${2}
|
||||||
|
}
|
||||||
|
|
||||||
install_file_with_backup() # $1 = source $2 = target $3 = mode
|
install_file_with_backup() # $1 = source $2 = target $3 = mode
|
||||||
{
|
{
|
||||||
backup_file $2
|
backup_file $2
|
||||||
@ -181,11 +187,11 @@ echo "Installing Shorewall Version $VERSION"
|
|||||||
#
|
#
|
||||||
if [ -d ${PREFIX}/etc/shorewall ]; then
|
if [ -d ${PREFIX}/etc/shorewall ]; then
|
||||||
first_install=""
|
first_install=""
|
||||||
else
|
|
||||||
first_install="Yes"
|
|
||||||
backup_directory ${PREFIX}/etc/shorewall
|
backup_directory ${PREFIX}/etc/shorewall
|
||||||
backup_directory ${PREFIX}/usr/share/shorewall
|
backup_directory ${PREFIX}/usr/share/shorewall
|
||||||
backup_directory ${PREFIX}/var/lib/shorewall
|
backup_directory ${PREFIX}/var/lib/shorewall
|
||||||
|
else
|
||||||
|
first_install="Yes"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
install_file_with_backup shorewall ${PREFIX}/sbin/shorewall 0544
|
install_file_with_backup shorewall ${PREFIX}/sbin/shorewall 0544
|
||||||
@ -215,7 +221,7 @@ mkdir -p ${PREFIX}/var/lib/shorewall
|
|||||||
# Install the config file
|
# Install the config file
|
||||||
#
|
#
|
||||||
if [ ! -f ${PREFIX}/etc/shorewall/shorewall.conf ]; then
|
if [ ! -f ${PREFIX}/etc/shorewall/shorewall.conf ]; then
|
||||||
run_install $OWNERSHIP -m 0744 shorewall.conf ${PREFIX}/etc/shorewall/shorewall.conf
|
install_file $OWNERSHIP -m 0744 shorewall.conf ${PREFIX}/etc/shorewall/shorewall.conf
|
||||||
echo
|
echo
|
||||||
echo "Config file installed as ${PREFIX}/etc/shorewall/shorewall.conf"
|
echo "Config file installed as ${PREFIX}/etc/shorewall/shorewall.conf"
|
||||||
fi
|
fi
|
||||||
@ -228,7 +234,7 @@ fi
|
|||||||
# Install the zones file
|
# Install the zones file
|
||||||
#
|
#
|
||||||
if [ ! -f ${PREFIX}/etc/shorewall/zones ]; then
|
if [ ! -f ${PREFIX}/etc/shorewall/zones ]; then
|
||||||
run_install $OWNERSHIP -m 0744 zones ${PREFIX}/etc/shorewall/zones
|
install_file $OWNERSHIP -m 0744 zones ${PREFIX}/etc/shorewall/zones
|
||||||
echo
|
echo
|
||||||
echo "Zones file installed as ${PREFIX}/etc/shorewall/zones"
|
echo "Zones file installed as ${PREFIX}/etc/shorewall/zones"
|
||||||
fi
|
fi
|
||||||
@ -237,7 +243,7 @@ fi
|
|||||||
# Install the functions file
|
# Install the functions file
|
||||||
#
|
#
|
||||||
|
|
||||||
run_install functions ${PREFIX}/usr/share/shorewall/functions 0444
|
install_file functions ${PREFIX}/usr/share/shorewall/functions 0444
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Common functions installed in ${PREFIX}/usr/share/shorewall/functions"
|
echo "Common functions installed in ${PREFIX}/usr/share/shorewall/functions"
|
||||||
@ -245,7 +251,7 @@ echo "Common functions installed in ${PREFIX}/usr/share/shorewall/functions"
|
|||||||
#
|
#
|
||||||
# Install the Help file
|
# Install the Help file
|
||||||
#
|
#
|
||||||
run_install help ${PREFIX}/usr/share/shorewall/help 0544
|
install_file help ${PREFIX}/usr/share/shorewall/help 0544
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Help command executor installed in ${PREFIX}/usr/share/shorewall/help"
|
echo "Help command executor installed in ${PREFIX}/usr/share/shorewall/help"
|
||||||
@ -253,10 +259,10 @@ echo "Help command executor installed in ${PREFIX}/usr/share/shorewall/help"
|
|||||||
#
|
#
|
||||||
# Install the tcstart file
|
# Install the tcstart file
|
||||||
#
|
#
|
||||||
run_install tcstart ${PREFIX}/usr/share/shorewall/tcstart 0544
|
install_file tcstart ${PREFIX}/usr/share/shorewall/tcstart 0544
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Help Traffic Shaper installed in ${PREFIX}/usr/share/shorewall/tcstart"
|
echo "Traffic Shaper installed in ${PREFIX}/usr/share/shorewall/tcstart"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Install the policy file
|
# Install the policy file
|
||||||
@ -335,7 +341,7 @@ fi
|
|||||||
# Install the Stopped Routing file
|
# Install the Stopped Routing file
|
||||||
#
|
#
|
||||||
if [ ! -f ${PREFIX}/etc/shorewall/routestopped ]; then
|
if [ ! -f ${PREFIX}/etc/shorewall/routestopped ]; then
|
||||||
backup_file /etc/shorewall/routestopped
|
run_install $OWNERSHIP -m 0600 routestopped ${PREFIX}/etc/shorewall/routestopped
|
||||||
echo
|
echo
|
||||||
echo "Stopped Routing file installed as ${PREFIX}/etc/shorewall/routestopped"
|
echo "Stopped Routing file installed as ${PREFIX}/etc/shorewall/routestopped"
|
||||||
fi
|
fi
|
||||||
@ -433,13 +439,13 @@ fi
|
|||||||
#
|
#
|
||||||
# Install the rfc1918 file
|
# Install the rfc1918 file
|
||||||
#
|
#
|
||||||
run_install rfc1918 ${PREFIX}/usr/share/shorewall/rfc1918 0600
|
install_file rfc1918 ${PREFIX}/usr/share/shorewall/rfc1918 0600
|
||||||
echo
|
echo
|
||||||
echo "RFC 1918 file installed as ${PREFIX}/usr/share/shorewall/rfc1918"
|
echo "RFC 1918 file installed as ${PREFIX}/usr/share/shorewall/rfc1918"
|
||||||
#
|
#
|
||||||
# Install the default config path file
|
# Install the default config path file
|
||||||
#
|
#
|
||||||
run_install configpath ${PREFIX}/usr/share/shorewall/configpath 0600
|
install_file configpath ${PREFIX}/usr/share/shorewall/configpath 0600
|
||||||
echo
|
echo
|
||||||
echo " Default config path file installed as ${PREFIX}/usr/share/shorewall/configpath"
|
echo " Default config path file installed as ${PREFIX}/usr/share/shorewall/configpath"
|
||||||
#
|
#
|
||||||
@ -517,7 +523,7 @@ fi
|
|||||||
#
|
#
|
||||||
# Install the Standard Actions file
|
# Install the Standard Actions file
|
||||||
#
|
#
|
||||||
run_install actions.std ${PREFIX}/usr/share/shorewall/actions.std 0600
|
install_file actions.std ${PREFIX}/usr/share/shorewall/actions.std 0600
|
||||||
echo
|
echo
|
||||||
echo "Standard actions file installed as ${PREFIX}/etc/shorewall/actions.std"
|
echo "Standard actions file installed as ${PREFIX}/etc/shorewall/actions.std"
|
||||||
|
|
||||||
@ -539,7 +545,7 @@ fi
|
|||||||
# Install the Action files
|
# Install the Action files
|
||||||
#
|
#
|
||||||
for f in action.* ; do
|
for f in action.* ; do
|
||||||
run_install $f ${PREFIX}/usr/share/shorewall/$f 0600
|
install_file $f ${PREFIX}/usr/share/shorewall/$f 0600
|
||||||
echo
|
echo
|
||||||
echo "Action ${f#*.} file installed as ${PREFIX}/usr/share/shorewall/$f"
|
echo "Action ${f#*.} file installed as ${PREFIX}/usr/share/shorewall/$f"
|
||||||
done
|
done
|
||||||
@ -547,7 +553,7 @@ done
|
|||||||
# Install the Macro files
|
# Install the Macro files
|
||||||
#
|
#
|
||||||
for f in macro.* ; do
|
for f in macro.* ; do
|
||||||
run_install $f ${PREFIX}/usr/share/shorewall/$f 0600
|
install_file $f ${PREFIX}/usr/share/shorewall/$f 0600
|
||||||
echo
|
echo
|
||||||
echo "Macro ${f#*.} file installed as ${PREFIX}/usr/share/shorewall/$f"
|
echo "Macro ${f#*.} file installed as ${PREFIX}/usr/share/shorewall/$f"
|
||||||
done
|
done
|
||||||
@ -569,7 +575,7 @@ fi
|
|||||||
#
|
#
|
||||||
# Install the firewall script
|
# Install the firewall script
|
||||||
#
|
#
|
||||||
run_install firewall ${PREFIX}/usr/share/shorewall/firewall 0544
|
install_file firewall ${PREFIX}/usr/share/shorewall/firewall 0544
|
||||||
|
|
||||||
if [ -z "$PREFIX" -a -n "$first_install" ]; then
|
if [ -z "$PREFIX" -a -n "$first_install" ]; then
|
||||||
if [ -n "$DEBIAN" ]; then
|
if [ -n "$DEBIAN" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user