"Fossies" - the Fresh Open Source Software Archive

Member "shorewall-init-5.2.8/lib.uninstaller" (24 Sep 2020, 2314 Bytes) of package /linux/misc/shorewall/shorewall-init-5.2.8.tar.bz2:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "lib.uninstaller": 5.2.3.6_vs_5.2.6.

    1 #
    2 # Shorewall 5.2 -- /usr/share/shorewall/lib.installer
    3 #
    4 #     (c) 2017 - Tom Eastep (teastep@shorewall.net)
    5 #     (c) 2017 - Matt Darfeuille (matdarf@gmail.com)
    6 #
    7 #	Complete documentation is available at https://shorewall.org
    8 #
    9 #       This program is part of Shorewall.
   10 #
   11 #	This program is free software; you can redistribute it and/or modify
   12 #	it under the terms of the GNU General Public License as published by the
   13 #       Free Software Foundation, either version 2 of the license or, at your
   14 #       option, any later version.
   15 #
   16 #	This program is distributed in the hope that it will be useful,
   17 #	but WITHOUT ANY WARRANTY; without even the implied warranty of
   18 #	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   19 #	GNU General Public License for more details.
   20 #
   21 #	You should have received a copy of the GNU General Public License
   22 #	along with this program; if not, see <http://www.gnu.org/licenses/>.
   23 #
   24 # The purpose of this library is to hold those functions used by the products uninstaller.
   25 #
   26 #########################################################################################
   27 
   28 fatal_error()
   29 {
   30     echo "   ERROR: $@" >&2
   31     exit 1
   32 }
   33 
   34 split() {
   35     local ifs
   36     ifs=$IFS
   37     IFS=:
   38     set -- $1
   39     echo $*
   40     IFS=$ifs
   41 }
   42 
   43 qt()
   44 {
   45     "$@" >/dev/null 2>&1
   46 }
   47 
   48 mywhich() {
   49     local dir
   50 
   51     for dir in $(split $PATH); do
   52 	if [ -x $dir/$1 ]; then
   53 	    return 0
   54 	fi
   55     done
   56 
   57     return 2
   58 }
   59 
   60 remove_file() # $1 = file to remove
   61 {
   62     if [ -n "$1" ] ; then
   63         if [ -f $1 -o -h $1 ] ; then
   64             rm -f $1
   65             echo "$1 Removed"
   66         fi
   67     fi
   68 }
   69 
   70 remove_directory() # $1 = directory to remove
   71 {
   72     if [ -n "$1" ] ; then
   73         if [ -d $1 ] ; then
   74             rm -rf $1
   75             echo "$1 Removed"
   76         fi
   77     fi
   78 }
   79 
   80 remove_file_with_wildcard() # $1 = file with wildcard to remove
   81 {
   82     if [ -n "$1" ] ; then
   83         for f in $1; do
   84             if [ -d $f ] ; then
   85                 rm -rf $f
   86                 echo "$f Removed"
   87             elif [ -f $f -o -h $f ] ; then
   88                 rm -f $f
   89                 echo "$f Removed"
   90             fi
   91         done
   92     fi
   93 }
   94 
   95 restore_file() # $1 = file to restore
   96 {
   97     if [ -f ${1}-shorewall.bkout ]; then
   98 	if (mv -f ${1}-shorewall.bkout $1); then
   99 	    echo
  100 	    echo "$1 restored"
  101         else
  102 	    exit 1
  103         fi
  104     fi
  105 }