Be more verbose while uninstalling Shorewall

- Remove version file as a file and not as a directory.

Signed-off-by: Matt Darfeuille <matdarf@gmail.com>
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Matt Darfeuille 2017-02-20 18:52:05 +01:00 committed by Tom Eastep
parent 27a620347a
commit 783e438b4a
No known key found for this signature in database
GPG Key ID: 96E6B3F2423A4D10
7 changed files with 92 additions and 65 deletions

View File

@ -61,9 +61,36 @@ mywhich() {
remove_file() # $1 = file to remove
{
if [ -f $1 -o -L $1 ] ; then
rm -f $1
echo "$1 Removed"
if [ -n "$1" ] ; then
if [ -f $1 -o -L $1 ] ; then
rm -f $1
echo "$1 Removed"
fi
fi
}
remove_directory() # $1 = directory to remove
{
if [ -n "$1" ] ; then
if [ -d $1 ] ; then
rm -rf $1
echo "$1 Removed"
fi
fi
}
remove_file_with_wildcard() # $1 = file with wildcard to remove
{
if [ -n "$1" ] ; then
for f in $1; do
if [ -d $f ] ; then
rm -rf $f
echo "$f Removed"
elif [ -f $f -o -L $f ] ; then
rm -f $f
echo "$f Removed"
fi
done
fi
}

View File

@ -127,8 +127,8 @@ fi
echo "Uninstalling $Product $VERSION"
rm -rf ${SHAREDIR}/shorewall
rm -f ~/.shorewallrc
remove_directory ${SHAREDIR}/shorewall
remove_file ~/.shorewallrc
#
# Report Success

View File

@ -137,7 +137,7 @@ echo "Uninstalling $Product $VERSION"
[ -n "${LIBEXEC:=${SHAREDIR}}" ]
rm -f ${SBINDIR}/$PRODUCT
remove_file ${SBINDIR}/$PRODUCT
FIREWALL=${CONFDIR}/init.d/$PRODUCT
@ -163,7 +163,7 @@ fi
if [ -n "$SERVICEDIR" ]; then
[ $configure -eq 1 ] && systemctl disable ${PRODUCT}.service
rm -f $SERVICEDIR/${PRODUCT}.service
remove_file $SERVICEDIR/${PRODUCT}.service
fi
if [ $HOST = openwrt ]; then
@ -200,9 +200,9 @@ if [ -d ${CONFDIR}/ppp ]; then
done
fi
rm -rf ${SHAREDIR}/$PRODUCT
rm -rf ${LIBEXECDIR}/$PRODUCT
rm -f ${CONFDIR}/logrotate.d/$PRODUCT
remove_directory ${SHAREDIR}/$PRODUCT
remove_directory ${LIBEXECDIR}/$PRODUCT
remove_file ${CONFDIR}/logrotate.d/$PRODUCT
#
# Report Success

View File

@ -141,7 +141,7 @@ if [ $configure -eq 1 ]; then
fi
fi
rm -f ${SBINDIR}/$PRODUCT
remove_file ${SBINDIR}/$PRODUCT
if [ -L ${SHAREDIR}/$PRODUCT/init ]; then
if [ $HOST = openwrt ]; then
@ -175,22 +175,22 @@ fi
if [ -n "$SERVICEDIR" ]; then
[ $configure -eq 1 ] && systemctl disable ${PRODUCT}.service
rm -f $SERVICEDIR/${PRODUCT}.service
remove_file $SERVICEDIR/${PRODUCT}.service
fi
rm -rf ${CONFDIR}/$PRODUCT
rm -rf ${VARDIR}
rm -rf ${SHAREDIR}/$PRODUCT
rm -rf ${LIBEXECDIR}/$PRODUCT
rm -f ${CONFDIR}/logrotate.d/$PRODUCT
remove_directory ${CONFDIR}/$PRODUCT
remove_directory ${VARDIR}
remove_directory ${SHAREDIR}/$PRODUCT
remove_directory ${LIBEXECDIR}/$PRODUCT
remove_file ${CONFDIR}/logrotate.d/$PRODUCT
if [ -n "$SYSCONFDIR" ]; then
[ -n "$SYSCONFFILE" ] && rm -f ${SYSCONFDIR}/${PRODUCT}
[ -n "$SYSCONFFILE" ] && remove_file ${SYSCONFDIR}/${PRODUCT}
fi
if [ -n "${MANDIR}" ]; then
rm -f ${MANDIR}/man5/${PRODUCT}*
rm -f ${MANDIR}/man8/${PRODUCT}*
remove_file_with_wildcard ${MANDIR}/man5/${PRODUCT}\*
remove_file_with_wildcard ${MANDIR}/man8/${PRODUCT}\*
fi
#

View File

@ -141,7 +141,7 @@ if [ $configure -eq 1 ]; then
fi
fi
rm -f ${SBINDIR}/$PRODUCT
remove_file ${SBINDIR}/$PRODUCT
if [ -L ${SHAREDIR}/$PRODUCT/init ]; then
FIREWALL=$(readlink -m -q ${SHAREDIR}/$PRODUCT/init)
@ -167,45 +167,45 @@ fi
if [ -n "$SERVICEDIR" ]; then
[ $configure -eq 1 ] && systemctl disable ${PRODUCT}.service
rm -f $SERVICEDIR/${PRODUCT}.service
remove_file $SERVICEDIR/${PRODUCT}.service
fi
rm -rf ${SHAREDIR}/$PRODUCT/version
rm -rf ${CONFDIR}/$PRODUCT
remove_file ${SHAREDIR}/$PRODUCT/version
remove_directory ${CONFDIR}/$PRODUCT
if [ -n "$SYSCONFDIR" ]; then
[ -n "$SYSCONFFILE" ] && rm -f ${SYSCONFDIR}/${PRODUCT}
[ -n "$SYSCONFFILE" ] && remove_file ${SYSCONFDIR}/${PRODUCT}
fi
rm -rf ${VARDIR}
rm -rf ${PERLLIBDIR}/$Product/*
[ ${LIBEXECDIR} = ${SHAREDIR} ] || rm -rf ${LIBEXECDIR}/$PRODUCT
rm -rf ${SHAREDIR}/$PRODUCT/configfiles
rm -rf ${SHAREDIR}/$PRODUCT/Samples
rm -rf ${SHAREDIR}/$PRODUCT/$Product
rm -f ${SHAREDIR}/$PRODUCT/lib.cli-std
rm -f ${SHAREDIR}/$PRODUCT/lib.runtime
rm -f ${SHAREDIR}/$PRODUCT/compiler.pl
rm -f ${SHAREDIR}/$PRODUCT/prog.*
rm -f ${SHAREDIR}/$PRODUCT/module*
rm -f ${SHAREDIR}/$PRODUCT/helpers
rm -f ${SHAREDIR}/$PRODUCT/action*
rm -f ${SHAREDIR}/$PRODUCT/macro.*
rm -f ${SHAREDIR}/$PRODUCT/init
remove_directory ${VARDIR}
remove_file_with_wildcard ${PERLLIBDIR}/$Product/\*
[ ${LIBEXECDIR} = ${SHAREDIR} ] || remove_directory ${LIBEXECDIR}/$PRODUCT
remove_directory ${SHAREDIR}/$PRODUCT/configfiles
remove_directory ${SHAREDIR}/$PRODUCT/Samples
remove_directory ${SHAREDIR}/$PRODUCT/$Product
remove_file ${SHAREDIR}/$PRODUCT/lib.cli-std
remove_file ${SHAREDIR}/$PRODUCT/lib.runtime
remove_file ${SHAREDIR}/$PRODUCT/compiler.pl
remove_file_with_wildcard ${SHAREDIR}/$PRODUCT/prog.\*
remove_file_with_wildcard ${SHAREDIR}/$PRODUCT/module\*
remove_file ${SHAREDIR}/$PRODUCT/helpers
remove_file_with_wildcard ${SHAREDIR}/$PRODUCT/action\*
remove_file_with_wildcard ${SHAREDIR}/$PRODUCT/macro.\*
remove_file ${SHAREDIR}/$PRODUCT/init
for f in ${MANDIR}/man5/${PRODUCT}* ${MANDIR}/man8/${PRODUCT}*; do
case $f in
shorewall6*|shorewall-lite*)
;;
*)
rm -f $f
remove_file $f
;;
esac
done
rm -f ${CONFDIR}/logrotate.d/$PRODUCT
remove_file ${CONFDIR}/logrotate.d/$PRODUCT
[ -n "$SYSTEMD" ] && rm -f ${SYSTEMD}/${PRODUCT}.service
[ -n "$SYSTEMD" ] && remove_file ${SYSTEMD}/${PRODUCT}.service
#
# Report Success

View File

@ -141,7 +141,7 @@ if [ $configure -eq 1 ]; then
fi
fi
rm -f ${SBINDIR}/$PRODUCT
remove_file ${SBINDIR}/$PRODUCT
if [ -L ${SHAREDIR}/$PRODUCT/init ]; then
if [ $HOST = openwrt ]; then
@ -175,22 +175,22 @@ fi
if [ -n "$SERVICEDIR" ]; then
[ $configure -eq 1 ] && systemctl disable ${PRODUCT}.service
rm -f $SERVICEDIR/${PRODUCT}.service
remove_file $SERVICEDIR/${PRODUCT}.service
fi
rm -rf ${CONFDIR}/$PRODUCT
rm -rf ${VARDIR}
rm -rf ${SHAREDIR}/$PRODUCT
rm -rf ${LIBEXECDIR}/$PRODUCT
rm -f ${CONFDIR}/logrotate.d/$PRODUCT
remove_directory ${CONFDIR}/$PRODUCT
remove_directory ${VARDIR}
remove_directory ${SHAREDIR}/$PRODUCT
remove_directory ${LIBEXECDIR}/$PRODUCT
remove_file ${CONFDIR}/logrotate.d/$PRODUCT
if [ -n "$SYSCONFDIR" ]; then
[ -n "$SYSCONFFILE" ] && rm -f ${SYSCONFDIR}/${PRODUCT}
[ -n "$SYSCONFFILE" ] && remove_file ${SYSCONFDIR}/${PRODUCT}
fi
if [ -n "${MANDIR}" ]; then
rm -f ${MANDIR}/man5/${PRODUCT}*
rm -f ${MANDIR}/man8/${PRODUCT}*
remove_file_with_wildcard ${MANDIR}/man5/${PRODUCT}\*
remove_file_with_wildcard ${MANDIR}/man8/${PRODUCT}\*
fi
#

View File

@ -141,7 +141,7 @@ if [ $configure -eq 1 ]; then
fi
fi
rm -f ${SBINDIR}/$PRODUCT
remove_file ${SBINDIR}/$PRODUCT
if [ -L ${SHAREDIR}/$PRODUCT/init ]; then
FIREWALL=$(readlink -m -q ${SHAREDIR}/$PRODUCT/init)
@ -167,34 +167,34 @@ fi
if [ -n "$SERVICEDIR" ]; then
[ $configure -eq 1 ] && systemctl disable ${PRODUCT}.service
rm -f $SERVICEDIR/${PRODUCT}.service
remove_file $SERVICEDIR/${PRODUCT}.service
fi
rm -rf ${SHAREDIR}/$PRODUCT/version
rm -rf ${CONFDIR}/$PRODUCT
remove_file ${SHAREDIR}/$PRODUCT/version
remove_directory ${CONFDIR}/$PRODUCT
if [ -n "$SYSCONFDIR" ]; then
[ -n "$SYSCONFFILE" ] && rm -f ${SYSCONFDIR}/${PRODUCT}
[ -n "$SYSCONFFILE" ] && remove_file ${SYSCONFDIR}/${PRODUCT}
fi
rm -rf ${CONFDIR}/$PRODUCT
rm -rf ${VARDIR}
rm -rf ${LIBEXECDIR}/$PRODUCT
rm -rf ${SHAREDIR}/$PRODUCT
remove_directory ${CONFDIR}/$PRODUCT
remove_directory ${VARDIR}
remove_directory ${LIBEXECDIR}/$PRODUCT
remove_directory ${SHAREDIR}/$PRODUCT
for f in ${MANDIR}/man5/${PRODUCT}* ${MANDIR}/man8/${PRODUCT}*; do
case $f in
shorewall6-lite*)
;;
*)
rm -f $f
remove_file $f
;;
esac
done
rm -f ${CONFDIR}/logrotate.d/$PRODUCT
remove_file ${CONFDIR}/logrotate.d/$PRODUCT
[ -n "$SYSTEMD" ] && rm -f ${SYSTEMD}/${PRODUCT}.service
[ -n "$SYSTEMD" ] && remove_file ${SYSTEMD}/${PRODUCT}.service
#
# Report Success