forked from wmbusmeters/wmbusmeters
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·65 lines (50 loc) · 1.26 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
#!/bin/bash
if [ "$1" == "" ] || [ "$1" == "-h" ]
then
echo "Usage: install.sh [binary] [root] [OPTIONS]
Example: install.sh build/wmbusmeters /
Options:
--no-adduser Do not add wmbusmeters user
"
exit 0
fi
if [ ! "$(basename "$1")" = "wmbusmeters" ]
then
echo "Oups, please only try to install wmbusmeters using this script."
exit 1
fi
if [ ! -x "$1" ]
then
echo "This is not an executable."
exit 1
fi
if [ ! -d "$2" ]
then
echo "Oups, please supply a valid root directory."
exit 1
fi
SRC=$1
ROOT="${2%/}"
ADDUSER=true
while [ $# -ne 0 ]
do
ARG="$1"
shift
case "$ARG" in
--no-adduser)
ADDUSER=false
;;
esac
done
SRC=$SRC ROOT=$ROOT /bin/sh ./scripts/install_binaries.sh || exit $?
ROOT=$ROOT /bin/sh ./scripts/install_manpage.sh || exit $?
if [ "$ADDUSER" = "true" ]
then
ROOT=$ROOT /bin/sh ./scripts/add_wmbusmeters_user.sh || exit $?
fi
ROOT=$ROOT /bin/sh ./scripts/prepare_logfiles.sh || exit $?
ROOT=$ROOT /bin/sh ./scripts/install_default_configuration.sh || exit $?
ROOT=$ROOT /bin/sh ./scripts/install_systemd_service.sh || exit $?
ROOT=$ROOT /bin/sh ./scripts/add_myself_to_dialout.sh || exit $?
echo
echo "wmbusmeters sucessfully installed."