This repository has been archived by the owner on Jul 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
59 lines (52 loc) · 1.97 KB
/
install
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
#!/bin/bash
# Installation of Raspin
# Folders scrutcture:
# ..
# |-conf - configuration directory
# | |- base_path - file to define where all videos linked to pins are persisted
# | |- reset - file, specifies a pin wich resets current video
# |- logs - directory with log files, automatically created
# |-scheme - default directory with pins / video mapping
# | |-default - default background video
# | |-17 - pin #17 will be monitored
# | |-1.mts - exact this video ill be played back on pin 17 trigger
# |-raspin.sh - bash-wrapper to run script
# |-pi-test.py - main python executable
# |-install - installation script to install as system service
SERVICE_=/etc/systemd/system/raspin.service
EXEC_=$(pwd -P)
sudo mkdir -p ./scheme
sudo mkdir -p ./scheme/default
sudo mkdir -p ./conf
sudo rm -f ./conf/base_path > /dev/null
sudo rm -f ./conf/reset > /dev/null
sudo touch ./conf/base_path
sudo touch ./conf/reset
sudo echo "$EXEC_/scheme" > ./conf/base_path
sudo echo "5" > ./conf/reset
sudo rm -f ./raspin.sh > /dev/null
sudo touch ./raspin.sh
sudo echo "#!/bin/bash" >> ./raspin.sh
sudo echo "cd $EXEC_" >> ./raspin.sh
sudo echo "python $EXEC_/pi-test.py" >> raspin.sh
sudo touch $SERVICE_
sudo echo "[Unit]" >> $SERVICE_
sudo echo "Description=Raspin service" >> $SERVICE_
sudo echo "After=x11-common.service" >> $SERVICE_
sudo echo "StartLimitIntervalSec=0" >> $SERVICE_
sudo echo -n "" >> $SERVICE_
sudo echo "[Service]" >> $SERVICE_
sudo echo "Type=simple" >> $SERVICE_
sudo echo "Restart=always" >> $SERVICE_
sudo echo "RestartSec=1" >> $SERVICE_
sudo echo "User=pi" >> $SERVICE_
sudo chmod a+x ./raspin.sh
sudo echo "ExecStart=$EXEC_/raspin.sh" >> $SERVICE_
sudo echo -n"" >> $SERVICE_
sudo echo "[Install]" >> $SERVICE_
sudo echo "WantedBy=default.target" >> $SERVICE_
sudo chown pi:pi $EXEC_/*
sudo chown pi:pi $EXEC_/conf/*
sudo chown pi:pi $EXEC_/scheme/*
sudo systemctl start raspin
sudo systemctl enable raspin