mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-22 06:10:42 +01:00
Finish removal of backup creation during install
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@9503 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
50793dfea4
commit
33bfeecd4c
@ -76,41 +76,6 @@ cant_autostart()
|
||||
echo "WARNING: Unable to configure shorewall to start automatically at boot" >&2
|
||||
}
|
||||
|
||||
backup_directory() # $1 = directory to backup
|
||||
{
|
||||
if [ -d $1 ]; then
|
||||
if cp -a $1 ${1}-${VERSION}.bkout ; then
|
||||
echo
|
||||
echo "$1 saved to ${1}-${VERSION}.bkout"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
backup_file() # $1 = file to backup, $2 = (optional) Directory in which to create the backup
|
||||
{
|
||||
if [ -z "${PREFIX}${NOBACKUP}" ]; then
|
||||
if [ -f $1 -a ! -f ${1}-${VERSION}.bkout ]; then
|
||||
if [ -n "$2" ]; then
|
||||
if [ -d $2 ]; then
|
||||
if cp -f $1 $2 ; then
|
||||
echo
|
||||
echo "$1 saved to $2/$(basename $1)"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
elif cp $1 ${1}-${VERSION}.bkout; then
|
||||
echo
|
||||
echo "$1 saved to ${1}-${VERSION}.bkout"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
delete_file() # $1 = file to delete
|
||||
{
|
||||
rm -f $1
|
||||
@ -121,12 +86,6 @@ 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 $4 = (optional) backup directory
|
||||
{
|
||||
backup_file $2 $4
|
||||
run_install $OWNERSHIP -m $3 $1 ${2}
|
||||
}
|
||||
|
||||
#
|
||||
# Parse the run line
|
||||
#
|
||||
@ -157,8 +116,6 @@ if [ -z "$GROUP" ] ; then
|
||||
GROUP=root
|
||||
fi
|
||||
|
||||
NOBACKUP=
|
||||
|
||||
while [ $# -gt 0 ] ; do
|
||||
case "$1" in
|
||||
-h|help|?)
|
||||
@ -168,9 +125,6 @@ while [ $# -gt 0 ] ; do
|
||||
echo "Shorewall Lite Firewall Installer Version $VERSION"
|
||||
exit 0
|
||||
;;
|
||||
-n)
|
||||
NOBACKUP=Yes
|
||||
;;
|
||||
*)
|
||||
usage 1
|
||||
;;
|
||||
@ -214,20 +168,11 @@ cd "$(dirname $0)"
|
||||
|
||||
echo "Installing Shorewall Lite Version $VERSION"
|
||||
|
||||
#
|
||||
# First do Backups
|
||||
#
|
||||
|
||||
#
|
||||
# Check for /etc/shorewall-lite
|
||||
#
|
||||
if [ -z "$PREFIX" -a -d /etc/shorewall-lite ]; then
|
||||
first_install=""
|
||||
if [ -z "$NOBACKUP" ]; then
|
||||
backup_directory /etc/shorewall-lite
|
||||
backup_directory /usr/share/shorewall-lite
|
||||
backup_directory /var/lib/shorewall-lite
|
||||
fi
|
||||
[ -f /etc/shorewall-lite/shorewall.conf ] && \
|
||||
mv -f /etc/shorewall-lite/shorewall.conf /etc/shorewall-lite/shorewall-lite.conf
|
||||
else
|
||||
@ -239,7 +184,7 @@ fi
|
||||
|
||||
delete_file ${PREFIX}/usr/share/shorewall-lite/xmodules
|
||||
|
||||
install_file_with_backup shorewall-lite ${PREFIX}/sbin/shorewall-lite 0544 ${PREFIX}/var/lib/shorewall-lite-${VERSION}.bkout
|
||||
install_file shorewall-lite ${PREFIX}/sbin/shorewall-lite 0544 ${PREFIX}/var/lib/shorewall-lite-${VERSION}.bkout
|
||||
|
||||
echo "Shorewall Lite control program installed in ${PREFIX}/sbin/shorewall-lite"
|
||||
|
||||
@ -247,12 +192,12 @@ echo "Shorewall Lite control program installed in ${PREFIX}/sbin/shorewall-lite"
|
||||
# Install the Firewall Script
|
||||
#
|
||||
if [ -n "$DEBIAN" ]; then
|
||||
install_file_with_backup init.debian.sh /etc/init.d/shorewall-lite 0544 ${PREFIX}/usr/share/shorewall-lite-${VERSION}.bkout
|
||||
install_file 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-lite-${VERSION}.bkout
|
||||
install_file 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-lite-${VERSION}.bkout
|
||||
install_file init.sh ${PREFIX}${DEST}/$INIT 0544 ${PREFIX}/usr/share/shorewall-lite-${VERSION}.bkout
|
||||
fi
|
||||
|
||||
echo "Shorewall Lite script installed in ${PREFIX}${DEST}/$INIT"
|
||||
|
@ -34,7 +34,7 @@ administrators to centralize the configuration of Shorewall-based firewalls.
|
||||
export PREFIX=$RPM_BUILD_ROOT ; \
|
||||
export OWNER=`id -n -u` ; \
|
||||
export GROUP=`id -n -g` ;\
|
||||
./install.sh -n
|
||||
./install.sh
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
@ -76,41 +76,6 @@ cant_autostart()
|
||||
echo "WARNING: Unable to configure shorewall6-lite to start automatically at boot" >&2
|
||||
}
|
||||
|
||||
backup_directory() # $1 = directory to backup
|
||||
{
|
||||
if [ -d $1 ]; then
|
||||
if cp -a $1 ${1}-${VERSION}.bkout ; then
|
||||
echo
|
||||
echo "$1 saved to ${1}-${VERSION}.bkout"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
backup_file() # $1 = file to backup, $2 = (optional) Directory in which to create the backup
|
||||
{
|
||||
if [ -z "${PREFIX}${NOBACKUP}" ]; then
|
||||
if [ -f $1 -a ! -f ${1}-${VERSION}.bkout ]; then
|
||||
if [ -n "$2" ]; then
|
||||
if [ -d $2 ]; then
|
||||
if cp -f $1 $2 ; then
|
||||
echo
|
||||
echo "$1 saved to $2/$(basename $1)"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
elif cp $1 ${1}-${VERSION}.bkout; then
|
||||
echo
|
||||
echo "$1 saved to ${1}-${VERSION}.bkout"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
delete_file() # $1 = file to delete
|
||||
{
|
||||
rm -f $1
|
||||
@ -121,12 +86,6 @@ 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 $4 = (optional) backup directory
|
||||
{
|
||||
backup_file $2 $4
|
||||
run_install $OWNERSHIP -m $3 $1 ${2}
|
||||
}
|
||||
|
||||
#
|
||||
# Parse the run line
|
||||
#
|
||||
@ -157,8 +116,6 @@ if [ -z "$GROUP" ] ; then
|
||||
GROUP=root
|
||||
fi
|
||||
|
||||
NOBACKUP=
|
||||
|
||||
while [ $# -gt 0 ] ; do
|
||||
case "$1" in
|
||||
-h|help|?)
|
||||
@ -168,9 +125,6 @@ while [ $# -gt 0 ] ; do
|
||||
echo "Shorewall6 Lite Firewall Installer Version $VERSION"
|
||||
exit 0
|
||||
;;
|
||||
-n)
|
||||
NOBACKUP=Yes
|
||||
;;
|
||||
*)
|
||||
usage 1
|
||||
;;
|
||||
@ -214,20 +168,11 @@ cd "$(dirname $0)"
|
||||
|
||||
echo "Installing Shorewall6 Lite Version $VERSION"
|
||||
|
||||
#
|
||||
# First do Backups
|
||||
#
|
||||
|
||||
#
|
||||
# Check for /etc/shorewall6-lite
|
||||
#
|
||||
if [ -z "$PREFIX" -a -d /etc/shorewall6-lite ]; then
|
||||
first_install=""
|
||||
if [ -z "$NOBACKUP" ]; then
|
||||
backup_directory /etc/shorewall6-lite
|
||||
backup_directory /usr/share/shorewall6-lite
|
||||
backup_directory /var/lib/shorewall6-lite
|
||||
fi
|
||||
[ -f /etc/shorewall6-lite/shorewall.conf ] && \
|
||||
mv -f /etc/shorewall6-lite/shorewall.conf /etc/shorewall6-lite/shorewall6-lite.conf
|
||||
else
|
||||
@ -239,7 +184,7 @@ fi
|
||||
|
||||
delete_file ${PREFIX}/usr/share/shorewall6-lite/xmodules
|
||||
|
||||
install_file_with_backup shorewall6-lite ${PREFIX}/sbin/shorewall6-lite 0544 ${PREFIX}/var/lib/shorewall6-lite-${VERSION}.bkout
|
||||
install_file shorewall6-lite ${PREFIX}/sbin/shorewall6-lite 0544 ${PREFIX}/var/lib/shorewall6-lite-${VERSION}.bkout
|
||||
|
||||
echo "Shorewall6 Lite control program installed in ${PREFIX}/sbin/shorewall6-lite"
|
||||
|
||||
@ -247,12 +192,12 @@ echo "Shorewall6 Lite control program installed in ${PREFIX}/sbin/shorewall6-lit
|
||||
# Install the Firewall Script
|
||||
#
|
||||
if [ -n "$DEBIAN" ]; then
|
||||
install_file_with_backup init.debian.sh /etc/init.d/shorewall6-lite 0544 ${PREFIX}/usr/share/shorewall6-lite-${VERSION}.bkout
|
||||
install_file init.debian.sh /etc/init.d/shorewall6-lite 0544 ${PREFIX}/usr/share/shorewall6-lite-${VERSION}.bkout
|
||||
elif [ -n "$ARCHLINUX" ]; then
|
||||
install_file_with_backup init.archlinux.sh ${PREFIX}${DEST}/$INIT 0544 ${PREFIX}/usr/share/shorewall6-lite-${VERSION}.bkout
|
||||
install_file init.archlinux.sh ${PREFIX}${DEST}/$INIT 0544 ${PREFIX}/usr/share/shorewall6-lite-${VERSION}.bkout
|
||||
|
||||
else
|
||||
install_file_with_backup init.sh ${PREFIX}${DEST}/$INIT 0544 ${PREFIX}/usr/share/shorewall6-lite-${VERSION}.bkout
|
||||
install_file init.sh ${PREFIX}${DEST}/$INIT 0544 ${PREFIX}/usr/share/shorewall6-lite-${VERSION}.bkout
|
||||
fi
|
||||
|
||||
echo "Shorewall6 Lite script installed in ${PREFIX}${DEST}/$INIT"
|
||||
|
@ -34,7 +34,7 @@ administrators to centralize the configuration of Shorewall6-based firewalls.
|
||||
export PREFIX=$RPM_BUILD_ROOT ; \
|
||||
export OWNER=`id -n -u` ; \
|
||||
export GROUP=`id -n -g` ;\
|
||||
./install.sh -n
|
||||
./install.sh
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
@ -76,41 +76,6 @@ cant_autostart()
|
||||
echo "WARNING: Unable to configure shorewall6 to start automatically at boot" >&2
|
||||
}
|
||||
|
||||
backup_directory() # $1 = directory to backup
|
||||
{
|
||||
if [ -d $1 ]; then
|
||||
if cp -a $1 ${1}-${VERSION}.bkout ; then
|
||||
echo
|
||||
echo "$1 saved to ${1}-${VERSION}.bkout"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
backup_file() # $1 = file to backup, $2 = (optional) Directory in which to create the backup
|
||||
{
|
||||
if [ -z "${PREFIX}{NOBACKUP}" ]; then
|
||||
if [ -f $1 -a ! -f ${1}-${VERSION}.bkout ]; then
|
||||
if [ -n "$2" ]; then
|
||||
if [ -d $2 ]; then
|
||||
if cp -f $1 $2 ; then
|
||||
echo
|
||||
echo "$1 saved to $2/$(basename $1)"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
elif cp $1 ${1}-${VERSION}.bkout; then
|
||||
echo
|
||||
echo "$1 saved to ${1}-${VERSION}.bkout"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
delete_file() # $1 = file to delete
|
||||
{
|
||||
rm -f $1
|
||||
@ -121,12 +86,6 @@ 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 $4 = (optional) backup directory
|
||||
{
|
||||
backup_file $2 $4
|
||||
run_install $OWNERSHIP -m $3 $1 ${2}
|
||||
}
|
||||
|
||||
#
|
||||
# Parse the run line
|
||||
#
|
||||
@ -169,8 +128,6 @@ esac
|
||||
|
||||
OWNERSHIP="-o $OWNER -g $GROUP"
|
||||
|
||||
NOBACKUP=
|
||||
|
||||
while [ $# -gt 0 ] ; do
|
||||
case "$1" in
|
||||
-h|help|?)
|
||||
@ -180,9 +137,6 @@ while [ $# -gt 0 ] ; do
|
||||
echo "Shorewall6 Firewall Installer Version $VERSION"
|
||||
exit 0
|
||||
;;
|
||||
-n)
|
||||
NOBACKUP=Yes
|
||||
;;
|
||||
*)
|
||||
usage 1
|
||||
;;
|
||||
@ -237,20 +191,15 @@ echo "Installing Shorewall6 Version $VERSION"
|
||||
#
|
||||
if [ -d ${PREFIX}/etc/shorewall6 ]; then
|
||||
first_install=""
|
||||
if [ -z "$NOBACKUP" ]; then
|
||||
backup_directory ${PREFIX}/etc/shorewall6
|
||||
backup_directory ${PREFIX}/usr/share/shorewall6
|
||||
backup_directory ${PREFIX}/var/lib/shorewall6
|
||||
fi
|
||||
else
|
||||
first_install="Yes"
|
||||
fi
|
||||
|
||||
if [ -z "$CYGWIN" ]; then
|
||||
install_file_with_backup shorewall6 ${PREFIX}/sbin/shorewall6 0755 ${PREFIX}/var/lib/shorewall6-${VERSION}.bkout
|
||||
install_file shorewall6 ${PREFIX}/sbin/shorewall6 0755 ${PREFIX}/var/lib/shorewall6-${VERSION}.bkout
|
||||
echo "shorewall6 control program installed in ${PREFIX}/sbin/shorewall6"
|
||||
else
|
||||
install_file_with_backup shorewall6 ${PREFIX}/bin/shorewall6 0755 ${PREFIX}/var/lib/shorewall6-${VERSION}.bkout
|
||||
install_file shorewall6 ${PREFIX}/bin/shorewall6 0755 ${PREFIX}/var/lib/shorewall6-${VERSION}.bkout
|
||||
echo "shorewall6 control program installed in ${PREFIX}/bin/shorewall6"
|
||||
fi
|
||||
|
||||
@ -259,13 +208,13 @@ fi
|
||||
# Install the Firewall Script
|
||||
#
|
||||
if [ -n "$DEBIAN" ]; then
|
||||
install_file_with_backup init.debian.sh /etc/init.d/shorewall6 0544 ${PREFIX}/usr/share/shorewall6-${VERSION}.bkout
|
||||
install_file init.debian.sh /etc/init.d/shorewall6 0544 ${PREFIX}/usr/share/shorewall6-${VERSION}.bkout
|
||||
elif [ -n "$SLACKWARE" ]; then
|
||||
install_file_with_backup init.slackware.shorewall6.sh ${PREFIX}${DEST}/rc.shorewall6 0544 ${PREFIX}/usr/share/shorewall6-${VERSION}.bkout
|
||||
install_file init.slackware.shorewall6.sh ${PREFIX}${DEST}/rc.shorewall6 0544 ${PREFIX}/usr/share/shorewall6-${VERSION}.bkout
|
||||
elif [ -n "$ARCHLINUX" ]; then
|
||||
install_file_with_backup init.archlinux.sh ${PREFIX}${DEST}/$INIT 0544 ${PREFIX}/usr/share/shorewall6-${VERSION}.bkout
|
||||
install_file init.archlinux.sh ${PREFIX}${DEST}/$INIT 0544 ${PREFIX}/usr/share/shorewall6-${VERSION}.bkout
|
||||
elif [ -n "$INIT" ]; then
|
||||
install_file_with_backup init.sh ${PREFIX}${DEST}/$INIT 0544 ${PREFIX}/usr/share/shorewall6-${VERSION}.bkout
|
||||
install_file init.sh ${PREFIX}${DEST}/$INIT 0544 ${PREFIX}/usr/share/shorewall6-${VERSION}.bkout
|
||||
fi
|
||||
|
||||
[ -n "$CYGWIN" ] || echo "Shorewall6 script installed in ${PREFIX}${DEST}/$INIT"
|
||||
|
@ -31,7 +31,7 @@ a multi-function gateway/ router/server or on a standalone GNU/Linux system.
|
||||
export PREFIX=$RPM_BUILD_ROOT ; \
|
||||
export OWNER=`id -n -u` ; \
|
||||
export GROUP=`id -n -g` ;\
|
||||
./install.sh -n
|
||||
./install.sh
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
Loading…
Reference in New Issue
Block a user