File: lib.installer

package info (click to toggle)
shorewall-init 5.2.3.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 336 kB
  • sloc: sh: 1,665; perl: 168; makefile: 16
file content (88 lines) | stat: -rw-r--r-- 1,931 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#
# Shorewall 5.2 -- /usr/share/shorewall/lib.installer
#
#     (c) 2017 - Tom Eastep (teastep@shorewall.net)
#     (c) 2017 - Matt Darfeuille (matdarf@gmail.com)
#
#	Complete documentation is available at http://shorewall.net
#
#       This program is part of Shorewall.
#
#	This program is free software; you can redistribute it and/or modify
#	it under the terms of the GNU General Public License as published by the
#       Free Software Foundation, either version 2 of the license or, at your
#       option, any later version.
#
#	This program is distributed in the hope that it will be useful,
#	but WITHOUT ANY WARRANTY; without even the implied warranty of
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#	GNU General Public License for more details.
#
#	You should have received a copy of the GNU General Public License
#	along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# The purpose of this library is to hold those functions used by the products installer.
#
#########################################################################################

fatal_error()
{
    echo "   ERROR: $@" >&2
    exit 1
}

split() {
    local ifs
    ifs=$IFS
    IFS=:
    set -- $1
    echo $*
    IFS=$ifs
}

qt()
{
    "$@" >/dev/null 2>&1
}

mywhich() {
    local dir

    for dir in $(split $PATH); do
	if [ -x $dir/$1 ]; then
	    return 0
	fi
    done

    return 2
}

delete_file() # $1 = file to delete
{
    rm -f $1
}

require()
{
    eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
}

make_directory() # $1 = directory , $2 = mode
{
    mkdir $1
    chmod $2 $1
    [ -n "$OWNERSHIP" ] && chown $OWNERSHIP $1
}

make_parent_directory() # $1 = directory , $2 = mode
{
    mkdir -p $1
    chmod $2 $1
    [ -n "$OWNERSHIP" ] && chown $OWNER:$GROUP $1
}

cant_autostart()
{
    echo
    echo  "WARNING: Unable to configure $Product to start automatically at boot" >&2
}