-
Notifications
You must be signed in to change notification settings - Fork 10
/
install.sh
executable file
·50 lines (33 loc) · 1.33 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
#!/bin/bash -e
[[ $USER != root ]] || (echo "Must not be root"; exit 1)
cd $(dirname $0)
HERE=$(pwd)
. ./config.env
echo "=> Installing debian packages"
sudo apt-get update
sudo apt-get install python3-pip nginx redis-server mplayer
echo "=> Installing pip packages"
pip3 install --user --upgrade cherrypy youtube-dl redis pyserial mplayer.py
echo "=> Creating systemd services"
mkdir -p $HOME/.config/systemd/user
for x in webserver.service downloader.service player.service button.service nopeserver.service wipe.service wipe.timer
do
cat $HERE/$x | sed "s|DIR|$HERE|g" >$HOME/.config/systemd/user/$x
done
echo "=> Setting up nginx web server"
cat $HERE/nginx-site | sed "s|DIR|$MZ_LOCATION|" | sudo tee /etc/nginx/sites-available/musicazoo > /dev/null
sudo ln -sf /etc/nginx/sites-available/musicazoo /etc/nginx/sites-enabled/musicazoo
echo "=> Disabling unwanted programs"
killall -q xscreensaver || true
sed -i '/xscreensaver/d' $HOME/.config/lxsession/LXDE/autostart
echo "=> Starting systemd services"
sudo systemctl restart redis-server nginx
sudo loginctl enable-linger $USER
systemctl daemon-reload --user
systemctl enable --user webserver downloader player wipe.timer
systemctl restart --user webserver downloader player wipe.timer
if [ "$MZ_BUTTON" == "true" ]
then
systemctl enable --user button
systemctl restart --user button
fi