-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.sh
executable file
·68 lines (53 loc) · 1.39 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
#!/bin/bash
set -e
(
cd cmd/peroxide
go build
)
(
cd cmd/peroxide-cfg
go build
)
sudo cp cmd/peroxide/peroxide /usr/sbin
sudo cp cmd/peroxide-cfg/peroxide-cfg /usr/sbin
set +e
getent group peroxide >/dev/null 2>&1
if [ $? != 0 ]; then
sudo groupadd -r peroxide
fi
GRP=""
getent group www-data >/dev/null 2>&1
if [ $? == 0 ]; then
GRP="-G www-data"
fi
getent passwd peroxide >/dev/null 2>&1
if [ "$?" != "0" ]; then
sudo useradd --system --no-create-home -g peroxide $GRP peroxide
fi
set -e
if [ ! -d /var/cache/peroxide ]; then
sudo mkdir /var/cache/peroxide
sudo chown peroxide:peroxide /var/cache/peroxide
sudo chmod 700 /var/cache/peroxide
fi
if [ ! -f /etc/peroxide.conf ]; then
sudo cp config.example.yaml /etc/peroxide.conf
fi
if [ ! -d /etc/peroxide ]; then
sudo mkdir /etc/peroxide
sudo chown peroxide:peroxide /etc/peroxide
sudo chmod 700 /etc/peroxide
fi
if [ ! -f /etc/systemd/system/peroxide.service ]; then
sudo cp peroxide.service /etc/systemd/system/peroxide.service
sudo systemctl daemon-reload
fi
if [ ! -d /var/log/peroxide ]; then
sudo mkdir /var/log/peroxide
sudo chown peroxide:peroxide /var/log/peroxide
sudo chmod 750 /var/log/peroxide
fi
if [ -d /etc/logrotate.d ] && [ ! -f /etc/logrotate.d/peroxide ]; then
sudo cp peroxide.logrotate /etc/logrotate.d/peroxide
sudo systemctl restart logrotate
fi