-
Notifications
You must be signed in to change notification settings - Fork 10
/
install.sh
52 lines (46 loc) · 1.05 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
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
apt-get update && apt-get install fbi imagemagick
cd pictures
pwd > homedir.txt
echo "30" > delay.txt
chmod +x *.sh
mkdir images
chmod 777 images
cat <<EOT >> /etc/init.d/slideshow
#! /bin/sh
### BEGIN INIT INFO
# Provides: slideshow
# Required-Start: \$remote_fs \$syslog
# Required-Stop: \$remote_fs \$syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
case "\$1" in
start)
echo "Starting slideshow"
cd `pwd`
./slideshow.sh &
;;
stop)
echo -n "Shutting down slideshow"
for i in \`ps aux | grep './slideshow.sh' | grep -v grep | awk '{print \$2}'\`
do
kill -9 \$i
done
killall -9 fbi
;;
*)
echo "Usage: \$0 {start|stop}"
exit 1
esac
exit 0
EOT
chmod +x /etc/init.d/slideshow
update-rc.d slideshow defaults 91
echo -e "\n -Done-\n"