"Fossies" - the Fresh Open Source Software Archive

Member "aif-2.1.1/uninstall.sh" (16 Sep 2020, 4002 Bytes) of package /linux/privat/aif-2.1.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "uninstall.sh": 2.1.0_vs_2.1.1.

    1 #!/bin/bash
    2 
    3 MY_VERSION="1.0f"
    4 
    5 # ------------------------------------------------------------------------------------------
    6 #                         -= Arno's Iptables Firewall(AIF) =-
    7 #              Single- & multi-homed firewall script with DSL/ADSL support
    8 #
    9 #                           ~ In memory of my dear father ~
   10 #
   11 # (C) Copyright 2001-2020 by Arno van Amersfoort
   12 # Homepage              : https://rocky.eld.leidenuniv.nl/
   13 # Email                 : a r n o v a AT r o c k y DOT e l d DOT l e i d e n u n i v DOT n l
   14 #                         (note: you must remove all spaces and substitute the @ and the .
   15 #                         at the proper locations!)
   16 # ------------------------------------------------------------------------------------------
   17 # This program is free software; you can redistribute it and/or
   18 # modify it under the terms of the GNU General Public License
   19 # version 2 as published by the Free Software Foundation.
   20 
   21 # This program is distributed in the hope that it will be useful,
   22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
   23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   24 # GNU General Public License for more details.
   25 
   26 # You should have received a copy of the GNU General Public License
   27 # along with this program; if not, write to the Free Software
   28 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
   29 # ------------------------------------------------------------------------------------------
   30 
   31 check_command()
   32 {
   33   local path IFS
   34 
   35   IFS=' '
   36   for cmd in $*; do
   37     if [ -n "$(which "$cmd" 2>/dev/null)" ]; then
   38       return 0
   39     fi
   40   done
   41 
   42   return 1
   43 }
   44 
   45 
   46 sanity_check()
   47 {
   48   # root check
   49   if [ "$(id -u)" != "0" ]; then
   50     printf "\033[40m\033[1;31mERROR: Root check FAILED (you MUST be root to use this script)! Quitting...\033[0m\n" >&2
   51     exit 1
   52   fi
   53 }
   54 
   55 
   56 get_user_yn()
   57 {
   58   if [ "$2" = "y" ]; then
   59     printf "$1 (Y/n)? "
   60   else
   61     printf "$1 (y/N)? "
   62   fi
   63 
   64   read answer_with_case
   65 
   66   ANSWER=`echo "$answer_with_case" |tr A-Z a-z`
   67 
   68   if [ "$ANSWER" = "y" -o "$ANSWER" = "yes" ]; then
   69     return 0
   70   fi
   71 
   72   if [ "$ANSWER" = "n" -o "$ANSWER" = "no" ]; then
   73     return 1
   74   fi
   75 
   76   # Fallback to default
   77   if [ "$2" = "y" ]; then
   78     return 0
   79   else
   80     return 1
   81   fi
   82 }
   83 
   84 
   85 # main line:
   86 AIF_VERSION="$(grep "MY_VERSION=" ./bin/arno-iptables-firewall |sed -e "s/^MY_VERSION=\"//" -e "s/\"$//")"
   87 
   88 printf "\033[40m\033[1;32mArno's Iptables Firewall(AIF) v$AIF_VERSION\033[0m\n"
   89 printf "Uninstall Script v$MY_VERSION\n"
   90 echo "-------------------------------------------------------------------------------"
   91 
   92 sanity_check
   93 
   94 if ! get_user_yn "Continue uninstall" "n"; then
   95   echo "*Uninstall aborted!"
   96   exit 1
   97 fi
   98 
   99 rm -fv /usr/local/sbin/arno-iptables-firewall
  100 rm -fv /usr/local/sbin/arno-fwfilter
  101 rm -fv /usr/local/sbin/traffic-accounting-show
  102 
  103 rm -fv /usr/local/bin/arno-fwfilter
  104 
  105 rm -rfv /usr/local/share/arno-iptables-firewall
  106 
  107 rm -fv /usr/local/share/man/man8/arno-iptables-firewall.8.gz
  108 rm -fv /usr/local/share/man/man8/arno-fwfilter.1.gz
  109 
  110 rm -fv /usr/local/share/doc/arno-iptables-firewall/README
  111 
  112 rm -fv /etc/logrotate.d/arno-iptables-firewall
  113 
  114 # Disable systemd
  115 if check_command systemctl; then
  116   systemctl disable arno-iptables-firewall
  117 fi
  118 
  119 # Disable via update-rc.d/chkconfig
  120 if check_command update-rc.d; then
  121   update-rc.d -f arno-iptables-firewall remove
  122 elif check_command chkconfig; then
  123   chkconfig --del arno-iptables-firewall
  124 fi
  125 
  126 # Remove init.d script
  127 rm -fv /etc/init.d/arno-iptables-firewall
  128 rm -fv /etc/rc.d/rc*.d/*arno-iptables-firewall
  129 rm -fv /etc/rc*.d/*arno-iptables-firewall
  130 
  131 # Remove systemd files
  132 rm -fv /usr/lib/systemd/system/arno-iptables-firewall.service
  133 rm -fv /lib/systemd/system/arno-iptables-firewall.service
  134 rm -fv /etc/systemd/arno-iptables-firewall.service
  135 
  136 if get_user_yn "Also remove ALL configuration files from /etc/arno-iptables-firewall/" "n"; then
  137   rm -rfv /etc/arno-iptables-firewall
  138 else
  139   echo "* Skipped"
  140 fi
  141 
  142 echo ""
  143 echo "** Uninstall done **"
  144 echo ""
  145 
  146 exit 0