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 remove_file() # $1 = file to remove
{ {
if [ -f $1 -o -L $1 ] ; then if [ -n "$1" ] ; then
rm -f $1 if [ -f $1 -o -L $1 ] ; then
echo "$1 Removed" 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 fi
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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