-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-stage3
executable file
·53 lines (47 loc) · 1.15 KB
/
install-stage3
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
#!/usr/bin/bash
SERVICES="mbusbed mbustbd mbuswebd displayd"
USER=debian
perror() {
printf "ERROR: %s\n" "$*" >&2
}
if [ $EUID -ne 0 ]
then
perror "ERROR: You need root credentials to run this script"
exit
fi
if ! test -f /etc/mbus/mbus.yaml
then
mkdir /etc/mbus
chown debian:debian /etc/mbus
cp mbus.yaml /etc/mbus
chown debian:debian /etc/mbus/mbus.yaml
fi
echo "Installing python3 venv (virtual environment)"
if ! apt -y install python3-venv
then
perror "python3 venv installation failed"
exit 1
fi
for SERVICE in $SERVICES
do
echo "Installing $SERVICE - running make"
cd $SERVICE
if ! sudo -H -u $USER make
then
perror "make failed on service $SERVICE"
exit 1
fi
echo "Installing $SERVICE - running make install"
if ! make install
then
perror "make install failed on service $SERVICE"
exit 1
fi
cd ..
done
echo "***************************************************"
echo " All services installed"
echo " ***"
echo " Remeber to configure /etc/mbus/mbus.yaml - and"
echo " restart services: sudo systemctl restart $SERVICES"
echo "***************************************************"