pmaports/postmarketos-base/profile.sh
clayton craft 3bdeaf0793 Handle generating weston.ini in post-install script (#201)
This PR automatically creates the weston.ini in the
postmarketos-base post-install script based on options set in the
deviceinfo file for a particular device. This replaces #191.
If weston.ini exists, then no modifications are made.

(Optional) options supported in this PR for deviceinfo are:
deviceinfo_weston_core_modules - defaults to NONE if none specified
deviceinfo_weston_core_backend - defaults to 'fbdev-backend.so' if none specified
deviceinfo_weston_keymap_rules - keymap rule, found under /usr/share/X11/xkb/rules/
deviceinfo_weston_keymap_model - keymap model
2017-07-21 19:46:40 +00:00

30 lines
764 B
Bash

export DISPLAY=:0
. /etc/deviceinfo
if test -z "${XDG_RUNTIME_DIR}"; then
# https://wayland.freedesktop.org/building.html
export XDG_RUNTIME_DIR=/tmp/$(id -u)-runtime-dir
if ! test -d "${XDG_RUNTIME_DIR}"; then
mkdir "${XDG_RUNTIME_DIR}"
chmod 0700 "${XDG_RUNTIME_DIR}"
fi
# Weston autostart on tty1 (Autologin on tty1 is enabled in
# /etc/inittab by postmarketos-base post-install.hook)
if [ $(tty) = "/dev/tty1" ]; then
if test -n "${deviceinfo_weston_pixman_type}"; then
WESTON_OPTS=" --pixman-type=${deviceinfo_weston_pixman_type}"
fi
udevadm trigger
udevadm settle
(sleep 2; postmarketos-demos) &
weston ${WESTON_OPTS} >/tmp/weston.log 2>&1
# In case of failure, restart after 1s
sleep 1
exit
fi
fi