forked from balena-io-experimental/balena-wpe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wpe-init
executable file
·35 lines (26 loc) · 1.12 KB
/
wpe-init
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
#!/bin/sh
udevd &
udevadm trigger
fbcp &
# Set the backlight brightness of a Raspberry touchscreen
# The environment variable RPI_BACKLIGHT can be set to a value 0-255.
export RPI_BACKLIGHT=${RPI_BACKLIGHT:-255}
if [ -f /sys/class/backlight/rpi_backlight/brightness ]; then
echo $RPI_BACKLIGHT > /sys/class/backlight/rpi_backlight/brightness
fi
# Writable directories. See documentation here:
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
export HOME=/tmp/balena
mkdir -p /tmp/balena/xdg_runtime
chmod 0700 /tmp/balena/xdg_runtime
export XDG_RUNTIME_DIR=/tmp/balena/xdg_runtime
# Enable touch screen
export WPE_BCMRPI_TOUCH=1
# Set user-agent string via the WPE_USER_AGENT environment var
DEFAULT_WPE_USER_AGENT="Mozilla/5.0 (X11;Linux; armV7l) AppleWebKit/601.1i.15 (KHTML, like Gecko) Version/11.0 Safari/605.1.15"
export WPE_USER_AGENT="${WPE_USER_AGENT:-${DEFAULT_WPE_USER_AGENT}}"
# Start browser with a custom user-agent string
# (For more settings run run cog --help or cog --help-websettings)
run-cog $WPE_URL &
# Start Tohora to control the browser
./tohora 8080 run-cog