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 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" echo "Shorewall Version $VERSION is not installed"
exit 1 exit 1
fi 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-lite/init ]; then
FIREWALL=$(ls -l /usr/share/shorewall/init | sed 's/^.*> //') FIREWALL=$(ls -l /usr/share/shorewall-lite/init | sed 's/^.*> //')
restore_file $FIREWALL /usr/share/shorewall-${VERSION}.bkout restore_file $FIREWALL /usr/share/shorewall-lite-${VERSION}.bkout
else 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 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 /etc/shorewall-lite
restore_directory /usr/share/shorewall restore_directory /usr/share/shorewall-lite
restore_directory /var/lib/shorewall 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 fi
if [ -z "$INIT" ] ; then if [ -z "$INIT" ] ; then
INIT="shorewall" INIT="shorewall-lite
fi fi
if [ -z "$RUNLEVELS" ] ; then if [ -z "$RUNLEVELS" ] ; then
@ -161,7 +161,7 @@ while [ $# -gt 0 ] ; do
usage 0 usage 0
;; ;;
-v) -v)
echo "Shorewall Firewall Installer Version $VERSION" echo "Shorewall Lite Firewall Installer Version $VERSION"
exit 0 exit 0
;; ;;
*) *)
@ -196,7 +196,7 @@ elif [ -f /etc/slackware-version ] ; then
INIT="rc.firewall" INIT="rc.firewall"
elif [ -f /etc/arch-release ] ; then elif [ -f /etc/arch-release ] ; then
DEST="/etc/rc.d" DEST="/etc/rc.d"
INIT="shorewall" INIT="shorewall-lite
ARCHLINUX=yes ARCHLINUX=yes
fi 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="" first_install=""
backup_directory /etc/shorewall backup_directory /etc/shorewall-lite
backup_directory /usr/share/shorewall backup_directory /usr/share/shorewall-lite
backup_directory /var/lib/shorewall backup_directory /var/lib/shorewall-lite
else else
first_install="Yes" first_install="Yes"
rm -rf ${PREFIX}/etc/shorewall rm -rf ${PREFIX}/etc/shorewall-lite
rm -rf ${PREFIX}/usr/share/shorewall rm -rf ${PREFIX}/usr/share/shorewall-lite
rm -rf ${PREFIX}/var/lib/shorewall rm -rf ${PREFIX}/var/lib/shorewall-lite
fi 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 # Install the Firewall Script
# #
if [ -n "$DEBIAN" ]; then 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 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 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 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}/etc/shorewall-lite
mkdir -p ${PREFIX}/usr/share/shorewall mkdir -p ${PREFIX}/usr/share/shorewall-lite
mkdir -p ${PREFIX}/var/lib/shorewall mkdir -p ${PREFIX}/var/lib/shorewall-lite
chmod 755 ${PREFIX}/etc/shorewall chmod 755 ${PREFIX}/etc/shorewall-lite
chmod 755 ${PREFIX}/usr/share/shorewall chmod 755 ${PREFIX}/usr/share/shorewall-lite
# #
# Install the config file # Install the config file
# #
if [ ! -f ${PREFIX}/etc/shorewall/shorewall.conf ]; then if [ ! -f ${PREFIX}/etc/shorewall-lite/shorewall.conf ]; then
run_install $OWNERSHIP -m 0744 shorewall.conf ${PREFIX}/etc/shorewall/shorewall.conf run_install $OWNERSHIP -m 0744 shorewall.conf ${PREFIX}/etc/shorewall-lite/shorewall.conf
echo "Config file installed as ${PREFIX}/etc/shorewall/shorewall.conf" echo "Config file installed as ${PREFIX}/etc/shorewall-lite/shorewall.conf"
fi fi
if [ -n "$ARCHLINUX" ] ; then 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 fi
# #
# Install the Makefile # Install the Makefile
# #
run_install $OWNERSHIP -m 0600 Makefile ${PREFIX}/etc/shorewall/Makefile run_install $OWNERSHIP -m 0600 Makefile ${PREFIX}/etc/shorewall-lite/Makefile
echo "Makefile installed as ${PREFIX}/etc/shorewall/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 the default config path file
# #
install_file configpath ${PREFIX}/usr/share/shorewall/configpath 0644 install_file configpath ${PREFIX}/usr/share/shorewall-lite/configpath 0644
echo "Default config path file installed as ${PREFIX}/usr/share/shorewall/configpath" echo "Default config path file installed as ${PREFIX}/usr/share/shorewall-lite/configpath"
# #
# Install the functions file # 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 Shorecap
# #
install_file shorecap ${PREFIX}/usr/share/shorewall/shorecap 0555 install_file shorecap ${PREFIX}/usr/share/shorewall-lite/shorecap 0555
echo 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 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 # Install the Modules files
# #
if [ ! -f ${PREFIX}/usr/share/shorewall/modules ]; then if [ ! -f ${PREFIX}/usr/share/shorewall-lite/modules ]; then
run_install $OWNERSHIP -m 0600 modules ${PREFIX}/usr/share/shorewall/modules run_install $OWNERSHIP -m 0600 modules ${PREFIX}/usr/share/shorewall-lite/modules
echo "Modules file installed as ${PREFIX}/usr/share/shorewall/modules" echo "Modules file installed as ${PREFIX}/usr/share/shorewall-lite/modules"
fi fi
if [ ! -f ${PREFIX}/usr/share/shorewall/xmodules ]; then if [ ! -f ${PREFIX}/usr/share/shorewall-lite/xmodules ]; then
run_install $OWNERSHIP -m 0600 modules ${PREFIX}/usr/share/shorewall/xmodules run_install $OWNERSHIP -m 0600 modules ${PREFIX}/usr/share/shorewall-lite/xmodules
echo "Xmodules file installed as ${PREFIX}/usr/share/shorewall/xmodules" echo "Xmodules file installed as ${PREFIX}/usr/share/shorewall-lite/xmodules"
fi fi
# #
# Create the version file # Create the version file
# #
echo "$VERSION" > ${PREFIX}/usr/share/shorewall/version echo "$VERSION" > ${PREFIX}/usr/share/shorewall-lite/version
chmod 644 ${PREFIX}/usr/share/shorewall/version chmod 644 ${PREFIX}/usr/share/shorewall-lite/version
# #
# Remove and create the symbolic link to the init script # Remove and create the symbolic link to the init script
# #
if [ -z "$PREFIX" ]; then if [ -z "$PREFIX" ]; then
rm -f /usr/share/shorewall/init rm -f /usr/share/shorewall-lite/init
ln -s ${DEST}/${INIT} /usr/share/shorewall/init ln -s ${DEST}/${INIT} /usr/share/shorewall-lite/init
fi fi
if [ -z "$PREFIX" -a -n "$first_install" ]; then if [ -z "$PREFIX" -a -n "$first_install" ]; then
if [ -n "$DEBIAN" ]; then if [ -n "$DEBIAN" ]; then
run_install $OWNERSHIP -m 0644 default.debian /etc/default/shorewall run_install $OWNERSHIP -m 0644 default.debian /etc/default/shorewall-lite
ln -s ../init.d/shorewall /etc/rcS.d/S40shorewall ln -s ../init.d/shorewall-lite /etc/rcS.d/S40shorewall-lite
echo "shorewall will start automatically at boot" echo "Shorewall Lite will start automatically at boot"
echo "Set startup=1 in /etc/default/shorewall to enable"
touch /var/log/shorewall-init.log 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 else
if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
if insserv /etc/init.d/shorewall ; then if insserv /etc/init.d/shorewall-lite ; then
echo "shorewall will start automatically at boot" echo "Shorewall Lite will start automatically at boot"
echo "Set STARTUP_ENABLED=Yes in /etc/shorewall/shorewall.conf to enable"
else else
cant_autostart cant_autostart
fi fi
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
if chkconfig --add shorewall ; then if chkconfig --add shorewall-lite ; then
echo "shorewall will start automatically in run levels as follows:" echo "Shorewall Lite will start automatically in run levels as follows:"
echo "Set STARTUP_ENABLED=Yes in /etc/shorewall/shorewall.conf to enable" chkconfig --list shorewall-lite
chkconfig --list shorewall
else else
cant_autostart cant_autostart
fi fi
elif [ -x /sbin/rc-update ]; then elif [ -x /sbin/rc-update ]; then
if rc-update add shorewall default; then if rc-update add shorewall-lite default; then
echo "shorewall will start automatically at boot" echo "Shorewall Lite will start automatically at boot"
echo "Set STARTUP_ENABLED=Yes in /etc/shorewall/shorewall.conf to enable"
else else
cant_autostart cant_autostart
fi fi
@ -369,4 +370,4 @@ fi
# #
# Report Success # 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 [ $1 -eq 1 ]; then
if [ -x /sbin/insserv ]; then if [ -x /sbin/insserv ]; then
/sbin/insserv /etc/rc.d/shorewall /sbin/insserv /etc/rc.d/shorewall-lite
elif [ -x /sbin/chkconfig ]; then elif [ -x /sbin/chkconfig ]; then
/sbin/chkconfig --add shorewall; /sbin/chkconfig --add shorewall-lite;
fi fi
fi fi
[ -L /sbin/shorewall ] || ln -s /usr/share/shorewall-lite/shorewall /sbin/shorewall
%preun %preun
if [ $1 = 0 ]; then if [ $1 = 0 ]; then
if [ -x /sbin/insserv ]; 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 elif [ -x /sbin/chkconfig ]; then
/sbin/chkconfig --del shorewall /sbin/chkconfig --del shorewall-lite
fi fi
fi fi
%files %files
%defattr(0644,root,root,0755) %defattr(0644,root,root,0755)
%attr(0755,root,root) %dir /etc/shorewall %attr(0755,root,root) %dir /etc/shorewall-lite
%attr(0644,root,root) %config(noreplace) /etc/shorewall/shorewall.conf %attr(0644,root,root) %config(noreplace) /etc/shorewall-lite/shorewall.conf
%attr(0644,root,root) /etc/shorewall/Makefile %attr(0644,root,root) /etc/shorewall-lite/Makefile
%attr(0544,root,root) /etc/init.d/shorewall %attr(0544,root,root) /etc/init.d/shorewall-lite
%attr(0755,root,root) %dir /usr/share/shorewall %attr(0755,root,root) %dir /usr/share/shorewall-lite
%attr(0700,root,root) %dir /var/lib/shorewall %attr(0700,root,root) %dir /var/lib/shorewall/lite
%attr(0555,root,root) /sbin/shorewall %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/version %attr(0644,root,root) /usr/share/shorewall-lite/configpath
%attr(0644,root,root) /usr/share/shorewall/configpath %attr(0444,root,root) /usr/share/shorewall-lite/functions
%attr(0444,root,root) /usr/share/shorewall/functions %attr(0444,root,root) /usr/share/shorewall-lite/modules
%attr(0444,root,root) /usr/share/shorewall/modules %attr(0444,root,root) /usr/share/shorewall-lite/xmodules
%attr(0444,root,root) /usr/share/shorewall/xmodules %attr(0544,root,root) /usr/share/shorewall-lite/shorecap
%attr(0544,root,root) /usr/share/shorewall/shorecap %attr(0544,root,root) /usr/share/shorewall-lite/help
%attr(0544,root,root) /usr/share/shorewall/help
%doc COPYING INSTALL changelog.txt releasenotes.txt %doc COPYING INSTALL changelog.txt releasenotes.txt
%changelog %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 * Wed Jun 07 2006 Tom Eastep tom@shorewall.net
- Version 3.2.0-RC2 - Version 3.2.0-RC2
* Tue Apr 18 2006 Tom Eastep tom@shorewall.net * Tue Apr 18 2006 Tom Eastep tom@shorewall.net

View File

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

View File

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

View File

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