generated from ojullien/bash-sys
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
89 lines (80 loc) · 2.93 KB
/
install.sh
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
89
#!/bin/bash
## -----------------------------------------------------------------------------
## Linux Scripts.
## Install the bash-manageservices project into the /opt/oju/bash directory.
##
## @package ojullien\bash\scripts
## @license MIT <https://github.com/ojullien/bash-manageservices/blob/master/LICENSE>
## -----------------------------------------------------------------------------
#set -o errexit
set -o nounset
set -o pipefail
## -----------------------------------------------------------------------------
## Current project directory, eg: /opt/Shell/scripts/
## -----------------------------------------------------------------------------
readonly m_DIR_REALPATH="$(realpath "$(dirname "$0")")"
# shellcheck source=/dev/null
. "${m_DIR_REALPATH}/config.sh"
# shellcheck source=/dev/null
. "${m_DIR_REALPATH}/includes.sh"
## -----------------------------------------------------------------------------
## Includes sources & configuration
## -----------------------------------------------------------------------------
# shellcheck source=/dev/null
. "${m_DIR_SYS}/runasroot.sh"
# shellcheck source=/dev/null
. "${m_DIR_SYS}/string.sh"
# shellcheck source=/dev/null
. "${m_DIR_SYS}/filesystem.sh"
# shellcheck source=/dev/null
. "${m_DIR_SYS}/option.sh"
# shellcheck source=/dev/null
. "${m_DIR_SYS}/config.sh"
## -----------------------------------------------------------------------------
## Help
## -----------------------------------------------------------------------------
((m_OPTION_SHOWHELP)) && Option::showHelp && exit 0
## -----------------------------------------------------------------------------
## bash-sys must exists
## -----------------------------------------------------------------------------
if [[ ! -d "${m_DIR_SYS}" ]]; then
String::error "bash-sys is not installed on ${m_DIR_SYS}"
exit 1
fi
## -----------------------------------------------------------------------------
## Start
## -----------------------------------------------------------------------------
String::separateLine
String::notice "Today is: $(date -R)"
String::notice "The PID for $(basename "$0") process is: $$"
Console::waitUser
## -----------------------------------------------------------------------------
## Parse the app options and arguments
## -----------------------------------------------------------------------------
declare -i iReturn=1
while (( "$#" )); do
case "$1" in
-t|--trace)
shift
String::separateLine
Install::trace
;;
-r|--remove)
shift
m_INSTALL_OPTION_REMOVE=1
;;
*) # unknown option
shift
String::separateLine
Option::showHelp
exit 0
;;
esac
done
Install::run ${m_INSTALL_OPTION_REMOVE}
Console::waitUser
## -----------------------------------------------------------------------------
## END
## -----------------------------------------------------------------------------
String::notice "Now is: $(date -R)"
exit ${iReturn}