This repository has been archived by the owner on May 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
INSTALL
executable file
·46 lines (40 loc) · 1.4 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
#!/bin/bash
# (cd ~; [ -d dashing ] && rm -fr dashing ; git clone https://github.com/websages/dashboards-bnagh dashing; sudo dashing/INSTALL)
apt-get update
apt-get install -y ruby1.9.3 ruby1.9.1-dev rubygems nodejs npm chromium x11-xserver-utils
gem install dashing bundler execjs --no-rdoc --no-ri
su -l pi (cd dashing; bundle install)
cat<<EOF | sudo tee /etc/xdg/lxsession/LXDE/autostart
@lxpanel --profile LXDE
@pcmanfm --desktop --profile LXDE
@xset s off
@xset s noblank
@xset -dpms
@xhost +
@/home/pi/bin/dashing-keepalive
EOF
if [ ! -d /home/pi/bin ];then
mkdir /home/pi/bin
chown pi:users /home/pi/bin
chmod 755 /home/pi/bin
fi
cat<<EOF > /home/pi/bin/dashing-keepalive
#!/bin/bash
export DISPLAY=:0
file=\$(/usr/bin/xwininfo -root | /bin/grep -- -geometry | /usr/bin/awk '{print \$NF}')
while [ 1 ]; do
/bin/netstat -an | grep "LISTEN " | grep 0.0.0.0:3030
EXIT=\$?
if [ \${EXIT} -eq 0 ]; then
/usr/bin/chromium --incognito --kiosk "http://127.0.0.1:3030/\$file"
fi
/bin/sleep 5
done
EOF
chown pi:users /home/pi/bin/dashing-keepalive
chmod 755 /home/pi/bin/dashing-keepalive
[ ! -f /etc/rc.local.dist ] && cp /etc/rc.local /etc/rc.local.dist
grep "dashing start" /etc/rc.local || \
awk '{ if($0 == "exit 0"){print "/bin/su -l pi -c \"(cd dashing; . ~/.app-env; dashing start)\""; }; print $0;}' /etc/rc.local.dist > /etc/rc.local
chmod 755 /etc/rc.local
# copy ~/dashing/.app-env from another node