Allow Shorewall and Shorewall-lite to coexist on a system

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@4035 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2006-06-09 16:59:14 +00:00
parent 7c64464b66
commit 8d075adc66
6 changed files with 116 additions and 109 deletions

View File

@ -78,26 +78,26 @@ restore_file() # $1 = file to restore, $2 = (Optional) Directory to restore from
fi
}
if [ ! -f /usr/share/shorewall-${VERSION}.bkout/version ]; then
if [ ! -f /usr/share/shorewall-lite-${VERSION}.bkout/version ]; then
echo "Shorewall Version $VERSION is not installed"
exit 1
fi
echo "Backing Out Installation of Shorewall $VERSION"
if [ -L /usr/share/shorewall/init ]; then
FIREWALL=$(ls -l /usr/share/shorewall/init | sed 's/^.*> //')
restore_file $FIREWALL /usr/share/shorewall-${VERSION}.bkout
if [ -L /usr/share/shorewall-lite/init ]; then
FIREWALL=$(ls -l /usr/share/shorewall-lite/init | sed 's/^.*> //')
restore_file $FIREWALL /usr/share/shorewall-lite-${VERSION}.bkout
else
restore_file /etc/init.d/shorewall /usr/share/shorewall-${VERSION}.bkout
restore_file /etc/init.d/shorewall /usr/share/shorewall-lite-${VERSION}.bkout
fi
restore_file /sbin/shorewall /var/lib/shorewall-${VERSION}.bkout
restore_file /sbin/shorewall /var/lib/shorewall-lite-${VERSION}.bkout
restore_directory /etc/shorewall
restore_directory /usr/share/shorewall
restore_directory /var/lib/shorewall
restore_directory /etc/shorewall-lite
restore_directory /usr/share/shorewall-lite
restore_directory /var/lib/shorewall-lite
echo "Shorewall Lite Restored to Version $(cat /usr/share/shorewall/version)"
echo "Shorewall Lite Restored to Version $(cat /usr/share/shorewall-lite/version)"

View File

@ -140,7 +140,7 @@ if [ -z "$DEST" ] ; then
fi
if [ -z "$INIT" ] ; then
INIT="shorewall"
INIT="shorewall-lite
fi
if [ -z "$RUNLEVELS" ] ; then
@ -161,7 +161,7 @@ while [ $# -gt 0 ] ; do
usage 0
;;
-v)
echo "Shorewall Firewall Installer Version $VERSION"
echo "Shorewall Lite Firewall Installer Version $VERSION"
exit 0
;;
*)
@ -196,7 +196,7 @@ elif [ -f /etc/slackware-version ] ; then
INIT="rc.firewall"
elif [ -f /etc/arch-release ] ; then
DEST="/etc/rc.d"
INIT="shorewall"
INIT="shorewall-lite
ARCHLINUX=yes
fi
@ -212,151 +212,152 @@ echo "Installing Shorewall Lite Version $VERSION"
#
#
# Check for /etc/shorewall
# Check for /etc/shorewall-lite
#
if [ -z "$PREFIX" && -d /etc/shorewall ]; then
if [ -z "$PREFIX" && -d /etc/shorewall-lite ]; then
first_install=""
backup_directory /etc/shorewall
backup_directory /usr/share/shorewall
backup_directory /var/lib/shorewall
backup_directory /etc/shorewall-lite
backup_directory /usr/share/shorewall-lite
backup_directory /var/lib/shorewall-lite
else
first_install="Yes"
rm -rf ${PREFIX}/etc/shorewall
rm -rf ${PREFIX}/usr/share/shorewall
rm -rf ${PREFIX}/var/lib/shorewall
rm -rf ${PREFIX}/etc/shorewall-lite
rm -rf ${PREFIX}/usr/share/shorewall-lite
rm -rf ${PREFIX}/var/lib/shorewall-lite
fi
install_file_with_backup shorewall ${PREFIX}/sbin/shorewall 0544 ${PREFIX}/var/lib/shorewall-${VERSION}.bkout
echo "shorewall control program installed in ${PREFIX}/sbin/shorewall"
#
# Install the Firewall Script
#
if [ -n "$DEBIAN" ]; then
install_file_with_backup init.debian.sh /etc/init.d/shorewall 0544 ${PREFIX}/usr/share/shorewall-${VERSION}.bkout
install_file_with_backup init.debian.sh /etc/init.d/shorewall-lite 0544 ${PREFIX}/usr/share/shorewall-lite-${VERSION}.bkout
elif [ -n "$ARCHLINUX" ]; then
install_file_with_backup init.archlinux.sh ${PREFIX}${DEST}/$INIT 0544 ${PREFIX}/usr/share/shorewall-${VERSION}.bkout
install_file_with_backup init.archlinux.sh ${PREFIX}${DEST}/$INIT 0544 ${PREFIX}/usr/share/shorewall-lite-${VERSION}.bkout
else
install_file_with_backup init.sh ${PREFIX}${DEST}/$INIT 0544 ${PREFIX}/usr/share/shorewall-${VERSION}.bkout
install_file_with_backup init.sh ${PREFIX}${DEST}/$INIT 0544 ${PREFIX}/usr/share/shorewall-lite-${VERSION}.bkout
fi
echo "Shorewall script installed in ${PREFIX}${DEST}/$INIT"
echo "Shorewall Lite script installed in ${PREFIX}${DEST}/$INIT"
#
# Create /etc/shorewall, /usr/share/shorewall and /var/shorewall if needed
# Create /etc/shorewall-lite, /usr/share/shorewall-lite and /var/lib/shorewall-lite if needed
#
mkdir -p ${PREFIX}/etc/shorewall
mkdir -p ${PREFIX}/usr/share/shorewall
mkdir -p ${PREFIX}/var/lib/shorewall
mkdir -p ${PREFIX}/etc/shorewall-lite
mkdir -p ${PREFIX}/usr/share/shorewall-lite
mkdir -p ${PREFIX}/var/lib/shorewall-lite
chmod 755 ${PREFIX}/etc/shorewall
chmod 755 ${PREFIX}/usr/share/shorewall
chmod 755 ${PREFIX}/etc/shorewall-lite
chmod 755 ${PREFIX}/usr/share/shorewall-lite
#
# Install the config file
#
if [ ! -f ${PREFIX}/etc/shorewall/shorewall.conf ]; then
run_install $OWNERSHIP -m 0744 shorewall.conf ${PREFIX}/etc/shorewall/shorewall.conf
echo "Config file installed as ${PREFIX}/etc/shorewall/shorewall.conf"
if [ ! -f ${PREFIX}/etc/shorewall-lite/shorewall.conf ]; then
run_install $OWNERSHIP -m 0744 shorewall.conf ${PREFIX}/etc/shorewall-lite/shorewall.conf
echo "Config file installed as ${PREFIX}/etc/shorewall-lite/shorewall.conf"
fi
if [ -n "$ARCHLINUX" ] ; then
sed -e 's!LOGFILE=/var/log/messages!LOGFILE=/var/log/messages.log!' -i ${PREFIX}/etc/shorewall/shorewall.conf
sed -e 's!LOGFILE=/var/log/messages!LOGFILE=/var/log/messages.log!' -i ${PREFIX}/etc/shorewall-lite/shorewall.conf
fi
#
# Install the Makefile
#
run_install $OWNERSHIP -m 0600 Makefile ${PREFIX}/etc/shorewall/Makefile
echo "Makefile installed as ${PREFIX}/etc/shorewall/Makefile"
run_install $OWNERSHIP -m 0600 Makefile ${PREFIX}/etc/shorewall-lite/Makefile
echo "Makefile installed as ${PREFIX}/etc/shorewall-lite/Makefile"
if [ -z "$PREFIX" ]; then
install_file_with_backup shorewall /sbin/shorewall 0544 /var/lib/shorewall-lite-${VERSION}.bkout
echo "shorewall control program installed in /sbin/shorewall"
else
install_file shorewall ${PREFIX}/usr/share/shorewall-lite/shorewall 0544
echo "shorewall control program installed in /usr/share/shorewall-lite/shorewall"
fi
#
# Install the default config path file
#
install_file configpath ${PREFIX}/usr/share/shorewall/configpath 0644
echo "Default config path file installed as ${PREFIX}/usr/share/shorewall/configpath"
install_file configpath ${PREFIX}/usr/share/shorewall-lite/configpath 0644
echo "Default config path file installed as ${PREFIX}/usr/share/shorewall-lite/configpath"
#
# Install the functions file
#
install_file functions ${PREFIX}/usr/share/shorewall/functions 0444
install_file functions ${PREFIX}/usr/share/shorewall-lite/functions 0444
echo "Common functions installed in ${PREFIX}/usr/share/shorewall/functions"
echo "Common functions installed in ${PREFIX}/usr/share/shorewall-lite/functions"
#
# Install Shorecap
#
install_file shorecap ${PREFIX}/usr/share/shorewall/shorecap 0555
install_file shorecap ${PREFIX}/usr/share/shorewall-lite/shorecap 0555
echo
echo "Capability file builder installed in ${PREFIX}/usr/share/shorewall/shorecap"
echo "Capability file builder installed in ${PREFIX}/usr/share/shorewall-lite/shorecap"
# Install the Help file
#
install_file help ${PREFIX}/usr/share/shorewall/help 0544
install_file help ${PREFIX}/usr/share/shorewall-lite/help 0544
echo "Help command executor installed in ${PREFIX}/usr/share/shorewall/help"
echo "Help command executor installed in ${PREFIX}/usr/share/shorewall-lite/help"
#
# Install the Modules files
#
if [ ! -f ${PREFIX}/usr/share/shorewall/modules ]; then
run_install $OWNERSHIP -m 0600 modules ${PREFIX}/usr/share/shorewall/modules
echo "Modules file installed as ${PREFIX}/usr/share/shorewall/modules"
if [ ! -f ${PREFIX}/usr/share/shorewall-lite/modules ]; then
run_install $OWNERSHIP -m 0600 modules ${PREFIX}/usr/share/shorewall-lite/modules
echo "Modules file installed as ${PREFIX}/usr/share/shorewall-lite/modules"
fi
if [ ! -f ${PREFIX}/usr/share/shorewall/xmodules ]; then
run_install $OWNERSHIP -m 0600 modules ${PREFIX}/usr/share/shorewall/xmodules
echo "Xmodules file installed as ${PREFIX}/usr/share/shorewall/xmodules"
if [ ! -f ${PREFIX}/usr/share/shorewall-lite/xmodules ]; then
run_install $OWNERSHIP -m 0600 modules ${PREFIX}/usr/share/shorewall-lite/xmodules
echo "Xmodules file installed as ${PREFIX}/usr/share/shorewall-lite/xmodules"
fi
#
# Create the version file
#
echo "$VERSION" > ${PREFIX}/usr/share/shorewall/version
chmod 644 ${PREFIX}/usr/share/shorewall/version
echo "$VERSION" > ${PREFIX}/usr/share/shorewall-lite/version
chmod 644 ${PREFIX}/usr/share/shorewall-lite/version
#
# Remove and create the symbolic link to the init script
#
if [ -z "$PREFIX" ]; then
rm -f /usr/share/shorewall/init
ln -s ${DEST}/${INIT} /usr/share/shorewall/init
rm -f /usr/share/shorewall-lite/init
ln -s ${DEST}/${INIT} /usr/share/shorewall-lite/init
fi
if [ -z "$PREFIX" -a -n "$first_install" ]; then
if [ -n "$DEBIAN" ]; then
run_install $OWNERSHIP -m 0644 default.debian /etc/default/shorewall
ln -s ../init.d/shorewall /etc/rcS.d/S40shorewall
echo "shorewall will start automatically at boot"
echo "Set startup=1 in /etc/default/shorewall to enable"
run_install $OWNERSHIP -m 0644 default.debian /etc/default/shorewall-lite
ln -s ../init.d/shorewall-lite /etc/rcS.d/S40shorewall-lite
echo "Shorewall Lite will start automatically at boot"
touch /var/log/shorewall-init.log
qt mywhich perl && perl -p -w -i -e 's/^STARTUP_ENABLED=No/STARTUP_ENABLED=Yes/;s/^IP_FORWARDING=On/IP_FORWARDING=Keep/' /etc/shorewall/shorewall.conf
else
if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
if insserv /etc/init.d/shorewall ; then
echo "shorewall will start automatically at boot"
echo "Set STARTUP_ENABLED=Yes in /etc/shorewall/shorewall.conf to enable"
if insserv /etc/init.d/shorewall-lite ; then
echo "Shorewall Lite will start automatically at boot"
else
cant_autostart
fi
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
if chkconfig --add shorewall ; then
echo "shorewall will start automatically in run levels as follows:"
echo "Set STARTUP_ENABLED=Yes in /etc/shorewall/shorewall.conf to enable"
chkconfig --list shorewall
if chkconfig --add shorewall-lite ; then
echo "Shorewall Lite will start automatically in run levels as follows:"
chkconfig --list shorewall-lite
else
cant_autostart
fi
elif [ -x /sbin/rc-update ]; then
if rc-update add shorewall default; then
echo "shorewall will start automatically at boot"
echo "Set STARTUP_ENABLED=Yes in /etc/shorewall/shorewall.conf to enable"
if rc-update add shorewall-lite default; then
echo "Shorewall Lite will start automatically at boot"
else
cant_autostart
fi
@ -369,4 +370,4 @@ fi
#
# Report Success
#
echo "shorewall Version $VERSION Installed"
echo "shorewall Lite Version $VERSION Installed"

View File

@ -42,45 +42,48 @@ rm -rf $RPM_BUILD_ROOT
if [ $1 -eq 1 ]; then
if [ -x /sbin/insserv ]; then
/sbin/insserv /etc/rc.d/shorewall
/sbin/insserv /etc/rc.d/shorewall-lite
elif [ -x /sbin/chkconfig ]; then
/sbin/chkconfig --add shorewall;
/sbin/chkconfig --add shorewall-lite;
fi
fi
[ -L /sbin/shorewall ] || ln -s /usr/share/shorewall-lite/shorewall /sbin/shorewall
%preun
if [ $1 = 0 ]; then
if [ -x /sbin/insserv ]; then
/sbin/insserv -r /etc/init.d/shorewall
/sbin/insserv -r /etc/init.d/shorewall-lite
elif [ -x /sbin/chkconfig ]; then
/sbin/chkconfig --del shorewall
/sbin/chkconfig --del shorewall-lite
fi
fi
%files
%defattr(0644,root,root,0755)
%attr(0755,root,root) %dir /etc/shorewall
%attr(0644,root,root) %config(noreplace) /etc/shorewall/shorewall.conf
%attr(0644,root,root) /etc/shorewall/Makefile
%attr(0544,root,root) /etc/init.d/shorewall
%attr(0755,root,root) %dir /usr/share/shorewall
%attr(0700,root,root) %dir /var/lib/shorewall
%attr(0755,root,root) %dir /etc/shorewall-lite
%attr(0644,root,root) %config(noreplace) /etc/shorewall-lite/shorewall.conf
%attr(0644,root,root) /etc/shorewall-lite/Makefile
%attr(0544,root,root) /etc/init.d/shorewall-lite
%attr(0755,root,root) %dir /usr/share/shorewall-lite
%attr(0700,root,root) %dir /var/lib/shorewall/lite
%attr(0555,root,root) /sbin/shorewall
%attr(0644,root,root) /usr/share/shorewall/version
%attr(0644,root,root) /usr/share/shorewall/configpath
%attr(0444,root,root) /usr/share/shorewall/functions
%attr(0444,root,root) /usr/share/shorewall/modules
%attr(0444,root,root) /usr/share/shorewall/xmodules
%attr(0544,root,root) /usr/share/shorewall/shorecap
%attr(0544,root,root) /usr/share/shorewall/help
%attr(0555,root,root) /usr/share/shorewall-lite/shorewall
%attr(0644,root,root) /usr/share/shorewall-lite/version
%attr(0644,root,root) /usr/share/shorewall-lite/configpath
%attr(0444,root,root) /usr/share/shorewall-lite/functions
%attr(0444,root,root) /usr/share/shorewall-lite/modules
%attr(0444,root,root) /usr/share/shorewall-lite/xmodules
%attr(0544,root,root) /usr/share/shorewall-lite/shorecap
%attr(0544,root,root) /usr/share/shorewall-lite/help
%doc COPYING INSTALL changelog.txt releasenotes.txt
%changelog
* Fri Jun 09 2006 Tom Eastep tom@shorewall.net
- Install Shorewall-lite in its own directories
* Wed Jun 07 2006 Tom Eastep tom@shorewall.net
- Version 3.2.0-RC2
* Tue Apr 18 2006 Tom Eastep tom@shorewall.net

View File

@ -60,8 +60,8 @@ remove_file() # $1 = file to restore
fi
}
if [ -f /usr/share/shorewall/version ]; then
INSTALLED_VERSION="$(cat /usr/share/shorewall/version)"
if [ -f /usr/share/shorewall-lite/version ]; then
INSTALLED_VERSION="$(cat /usr/share/shorewall-lite/version)"
if [ "$INSTALLED_VERSION" != "$VERSION" ]; then
echo "WARNING: Shorewall Version $INSTALLED_VERSION is installed"
echo " and this is the $VERSION uninstaller."
@ -78,8 +78,8 @@ if qt iptables -L shorewall -n; then
/sbin/shorewall clear
fi
if [ -L /usr/share/shorewall/init ]; then
FIREWALL=$(ls -l /usr/share/shorewall/init | sed 's/^.*> //')
if [ -L /usr/share/shorewall-lite/init ]; then
FIREWALL=$(ls -l /usr/share/shorewall-lite/init | sed 's/^.*> //')
else
FIREWALL=/etc/init.d/shorewall
fi
@ -100,12 +100,12 @@ fi
rm -f /sbin/shorewall
rm -f /sbin/shorewall-*.bkout
rm -rf /etc/shorewall
rm -rf /etc/shorewall-*.bkout
rm -rf /var/lib/shorewall
rm -rf /var/lib/shorewall-*.bkout
rm -rf /usr/share/shorewall
rm -rf /usr/share/shorewall-*.bkout
rm -rf /etc/shorewall-lite
rm -rf /etc/shorewall-lite-*.bkout
rm -rf /var/lib/shorewall-lite
rm -rf /var/lib/shorewall-lite-*.bkout
rm -rf /usr/share/shorewall-lite
rm -rf /usr/share/shorewall-lite-*.bkout
echo "Shorewall Uninstalled"

View File

@ -8087,9 +8087,9 @@ __EOF__
if [ -n "$EXPORT" ]; then
cat >&3 << __EOF__
SHAREDIR=/usr/share/shorewall
CONFDIR=/etc/shorewall
VARDIR=/var/lib/shorewall
SHAREDIR=/usr/share/shorewall-lite
CONFDIR=/etc/shorewall-lite
VARDIR=/var/lib/shorewall-lite
__EOF__
else
cat >&3 << __EOF__

View File

@ -48,6 +48,8 @@ if [ $1 -eq 1 ]; then
fi
fi
[ -L /sbin/shorewall ] || ln -s /usr/share/shorewall/shorewall /sbin/shorewall
%preun
if [ $1 = 0 ]; then
@ -101,8 +103,7 @@ fi
%attr(0600,root,root) %config(noreplace) /etc/shorewall/tcdevices
%attr(0600,root,root) /etc/shorewall/Makefile
%attr(0555,root,root) /sbin/shorewall
%attr(0555,root,root) /usr/share/shorewall/shorewall
%attr(0644,root,root) /usr/share/shorewall/version
%attr(0644,root,root) /usr/share/shorewall/actions.std
%attr(0644,root,root) /usr/share/shorewall/action.Drop
@ -208,6 +209,8 @@ fi
%doc COPYING INSTALL changelog.txt releasenotes.txt tunnel ipsecvpn Samples
%changelog
* Fri Jun 09 2006 Tom Eastep tom@shorewall.net
- Allow Shorewall and Shorewall-lite to coexist
* Wed Jun 07 2006 Tom Eastep tom@shorewall.net
- Updated to 3.2.0-0RC2
* Tue May 30 2006 Tom Eastep tom@shorewall.net