forked from Screenly/Anthias
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart_viewer.sh
executable file
·49 lines (40 loc) · 1.17 KB
/
start_viewer.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
#!/bin/bash
# Fixes permission on /dev/vchiq
chgrp -f video /dev/vchiq
chmod -f g+rwX /dev/vchiq
# Set permission for sha file
chown -f viewer /dev/snd/*
chown -f viewer /data/.screenly/latest_screenly_sha
# Fixes caching in QTWebEngine
mkdir -p /data/.local/share/ScreenlyWebview/QtWebEngine \
/data/.cache/ScreenlyWebview \
/data/.pki
chown -Rf viewer /data/.local/share/ScreenlyWebview
chown -Rf viewer /data/.cache/ScreenlyWebview/
chown -Rf viewer /data/.pki
# Temporary workaround for watchdog
touch /tmp/screenly.watchdog
chown viewer /tmp/screenly.watchdog
# For whatever reason Raspbian messes up the sudo permissions
chown -f root:root /usr/bin/sudo
chown -Rf root:root /etc/sudoers.d
chown -Rf root:root /etc/sudo.conf
chown -Rf root:root /usr/lib/sudo
chown -f root:root /etc/sudoers
chmod -f 4755 /usr/bin/sudo
# SUGUSR1 from the viewer is also sent to the container
# Prevent it so that the container does not fail
trap '' 16
sudo -E -u viewer dbus-run-session python viewer.py &
# Waiting for the viewer
while true; do
PID=$(pidof python)
if [ "$?" == '0' ]; then
break
fi
sleep 0.5
done
# Exit when the viewer falls
while kill -0 "$PID"; do
sleep 1
done