-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstall.sh
executable file
·38 lines (26 loc) · 923 Bytes
/
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
#!/bin/sh
if [ "$(id -u)" -ne 0 ]
then echo "You need to run this script as root."
exit
fi
echo "Creating dynhost user..."
useradd --system --shell "$SHELL" --create-home dynhost
echo "Installing Python dependencies for user 'dynhost'..."
su -c "python3 -m pip install --user -r requirements.txt" dynhost
echo "Installing DynHost Updater..."
cp dynhost.py /usr/bin/dynhost
chmod 755 /usr/bin/dynhost
mkdir -p /etc/dynhost/scripts
cp -n examples/dynhost.json.example /etc/dynhost/dynhost.json
cp -rn scripts/* /etc/dynhost/scripts/
chown -R dynhost:dynhost /etc/dynhost/
chmod 640 /etc/dynhost/dynhost.json
chmod 555 /etc/dynhost/scripts/*
mkdir -p /var/log/dynhost/
chown dynhost:dynhost /var/log/dynhost/
echo "Creating service..."
mkdir -p /etc/systemd/system/
cp dynhost.service /etc/systemd/system/dynhost.service
systemctl daemon-reload
systemctl enable dynhost.service
echo "Finished installing!"