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
This commit is contained in:
clayton craft 2017-07-21 12:46:40 -07:00 committed by Oliver Smith
parent a08c7af492
commit 3bdeaf0793
10 changed files with 51 additions and 37 deletions

View file

@ -1,6 +1,6 @@
pkgname=device-lg-hammerhead
pkgver=1
pkgrel=6
pkgrel=7
pkgdesc="Google Nexus 5"
url="https://github.com/postmarketOS"
arch="noarch"
@ -38,5 +38,5 @@ package() {
sha512sums="c0e96c01c9b34d6234e851ef89fab86a8ea46547f8ff1eb17ccecaa784dd5bab9803c721f01e94cfeca03859aa0038a8d9815d729cf3064cb387bc6609853899 deviceinfo
8590967fa10388a890fdfafdb1070b9ab22dc89e06a3a8834806c772191e3b67de7b914b0d68e5ddf581cee715cb90f3f24abcb8762c415ff328c6da23e55d52 initfs-hook.sh
ee25f3d0377f027d108593eb7953b8db49d7f05a5c36a0c8ca7e7849d15e3c217bc1ac97d77a66e28d2db4b81c0f50b905639911276da40321d2b6cca7f797df 90-android-touch-dev.rules
c3d0182161c33047e0af4fd7cc557037e10380896a771446f055a13813e50e4e6c9d5992de7b275a8373a053cca02cb96bcb50c732709a2e9909f903b5fba249 profile.sh
2f7cdf558a6bff56fd343d29a1ca6c27e75715bedfad661700dfcfb01acd1bdfcfecdfccf619f1e56c1e6331be146f8882a14d3a2cd33830e9d00bb6118971a3 profile.sh
32652ef366694f34dec31f316a38aca96700e3a5a3eac1f8d192e3c5de7b91e480b1c0fcd8e7c80a51692dc3737020ebbb2e5d3779436e82fb18822089c63055 bcmdhd.cal"

View file

@ -1,12 +1,5 @@
#!/bin/sh
# Dirty hacks, necessary to get a working demo...
if [ -e /etc/xdg/weston/weston.ini ]; then
rm /etc/xdg/weston/weston.ini
echo "WARNING: xwayland does not work yet on lg-mako (probably"
echo "because of bad framebuffer drivers)"
echo "=> Deleted /etc/xdg/weston/weston.ini as workaround"
fi
if [ -e /lib/udev/v4l_id ]; then
mv /lib/udev/v4l_id /lib/udev/v4l_id_
echo "WARNING: v4l_id hangs with the current kernel."

View file

@ -1,6 +1,6 @@
pkgname=device-lg-mako
pkgver=2
pkgrel=6
pkgrel=7
pkgdesc="Google Nexus 4"
url="https://github.com/postmarketOS"
arch="noarch"
@ -30,4 +30,4 @@ package() {
sha512sums="57b5db19e831a43884b2572359fda302420d9c61009aff8d3480c1ac70ed79bf7986c0428076f4883873c29e9e47cb0db1d254e3300de5747387134a679d2c26 deviceinfo
8590967fa10388a890fdfafdb1070b9ab22dc89e06a3a8834806c772191e3b67de7b914b0d68e5ddf581cee715cb90f3f24abcb8762c415ff328c6da23e55d52 initfs-hook.sh
ee25f3d0377f027d108593eb7953b8db49d7f05a5c36a0c8ca7e7849d15e3c217bc1ac97d77a66e28d2db4b81c0f50b905639911276da40321d2b6cca7f797df 90-android-touch-dev.rules
c3d0182161c33047e0af4fd7cc557037e10380896a771446f055a13813e50e4e6c9d5992de7b275a8373a053cca02cb96bcb50c732709a2e9909f903b5fba249 profile.sh"
2f7cdf558a6bff56fd343d29a1ca6c27e75715bedfad661700dfcfb01acd1bdfcfecdfccf619f1e56c1e6331be146f8882a14d3a2cd33830e9d00bb6118971a3 profile.sh"

View file

@ -1,12 +1,5 @@
#!/bin/sh
# Dirty hacks, necessary to get a working demo...
if [ -e /etc/xdg/weston/weston.ini ]; then
rm /etc/xdg/weston/weston.ini
echo "WARNING: xwayland does not work yet on lg-mako (probably"
echo "because of bad framebuffer drivers)"
echo "=> Deleted /etc/xdg/weston/weston.ini as workaround"
fi
if [ -e /lib/udev/v4l_id ]; then
mv /lib/udev/v4l_id /lib/udev/v4l_id_
echo "WARNING: v4l_id hangs with the current kernel."

View file

@ -1,6 +1,6 @@
pkgname=device-motorola-titan
pkgver=1
pkgrel=7
pkgrel=8
pkgdesc="Motorola Moto G 2014"
url="https://github.com/postmarketOS"
arch="noarch"
@ -30,4 +30,4 @@ package() {
sha512sums="308a1aeca905a338bc20d46977a9cb9ab512dbb2fa5394bcdad598cfd6d9f02d6701a60c45ac61ef197635478893f40342ba153fb24fd7e4120a1d301eb98af7 deviceinfo
f37e6324abf0b0fc8a3d360d6d11bb0648090a438a55ca7f04a9d494719e687ce445ae107ace642edf293afb6ca82615bcb5d0ddb6c46c1a7f8ee3c213b7c5c4 90-android-touch-dev.rules
8590967fa10388a890fdfafdb1070b9ab22dc89e06a3a8834806c772191e3b67de7b914b0d68e5ddf581cee715cb90f3f24abcb8762c415ff328c6da23e55d52 initfs-hook.sh
4fd7fceda05b9a7e5a7d32f737126c335de883d9caed799345c1016164e04d05819436a0dfd9e624499bbc1a9d0d56ba6e738f4458bc92ef1fe135845ae1aa85 profile.sh"
2f7cdf558a6bff56fd343d29a1ca6c27e75715bedfad661700dfcfb01acd1bdfcfecdfccf619f1e56c1e6331be146f8882a14d3a2cd33830e9d00bb6118971a3 profile.sh"

View file

@ -1,12 +1,5 @@
#!/bin/sh
# Dirty hacks, necessary to get a working demo...
if [ -e /etc/xdg/weston/weston.ini ]; then
rm /etc/xdg/weston/weston.ini
echo "WARNING: xwayland does not work yet on motorola-titan (probably)"
echo "because of bad framebuffer drivers)"
echo "=> Deleted /etc/xdg/weston/weston.ini as workaround"
fi
if [ -e /lib/udev/v4l_id ]; then
mv /lib/udev/v4l_id /lib/udev/v4l_id_
echo "WARNING: v4l_id hangs with the current kernel."

View file

@ -1,6 +1,6 @@
pkgname=postmarketos-base
pkgver=1
pkgrel=9
pkgrel=10
pkgdesc="Meta package for minimal postmarketos base"
url="https://github.com/postmarketOS"
arch="noarch"
@ -10,17 +10,14 @@ tmux htop nano postmarketos-mkinitfs eudev sudo"
makedepends=""
install="$pkgname.post-install"
subpackages=""
source="profile.sh weston.ini sudoers"
source="profile.sh sudoers"
options="!check"
package() {
install -D -m644 "$srcdir"/profile.sh \
"$pkgdir"/etc/profile.d/postmarketos.sh || return 1
install -D -m644 "$srcdir"/weston.ini \
"$pkgdir"/etc/xdg/weston/weston.ini
install -D -m644 "$srcdir"/sudoers \
"$pkgdir"/etc/sudoers.d/postmarketos
}
sha512sums="149a3b87c6698814998e13afad6719df49dbf6b0556ad82cc040ee63da92a17ee4279408550b3ba7793dcf13cf212fbf9690b727d338414be45a3585c3265769 profile.sh
0f4dcb493503081e0045b768bc81bb41096fdb5a340c4b5f23e7954f2bac7fd723ee00470bef400786725ab143bcc53e51607f28370c0c2533cbba623a5d9b13 weston.ini
sha512sums="c58547a8e3f184f97aabb746b6b2d4e84292809d00c2fbd16e4051f142246798cdf26a7a5861d632afaf2c103d47045aa3ba7b740157c2f0f9c2a404716252b0 profile.sh
c6de3b44bc45b9f9c641a7e34c69a481ee39b99ac0251cd28f2b3aae49c1a8d1ca448f4936b7942b1a8b8f7c18a5415c938098765ed8cf08456543800160e64b sudoers"

View file

@ -1,5 +1,7 @@
#!/bin/sh
. /etc/deviceinfo
# Enable OpenRC services
for service in devfs dmesg; do
rc-update -q add $service sysinit
@ -46,3 +48,42 @@ if ! apk audit /etc | grep -q etc/motd; then
echo ''
} >/etc/motd
fi
# This section generates weston.ini with options from /etc/deviceinfo (if present)
# This functionality is a strong candidate for belonging in another package (e.g. weston), but
# since postmarketos-base owns weston.ini, this will have to do for now.
weston_config="/etc/xdg/weston/weston.ini"
mkdir -p /etc/xdg/weston
# If weston.ini exists, no modifications to it will be made
if [ ! -f $weston_config ]; then
### [Core]
echo "[core]" >> $weston_config
# modules
# Note: Default to loading NO modules if none specified
if [ -n "$deviceinfo_weston_core_modules" ]; then
echo "modules=$deviceinfo_weston_core_modules" >> $weston_config
fi
# backend
if [ -n "$deviceinfo_weston_core_backend" ]; then
echo "backend=$deviceinfo_weston_core_backend" >> $weston_config
else
# Default backend for PMOS, if none specified
echo "backend=fbdev-backend.so" >> $weston_config
fi
### [Keyboard]
echo "[keyboard]" >> $weston_config
# keymap_rules
if [ -n "$deviceinfo_weston_keymap_rules" ]; then
echo "keymap_rules=$deviceinfo_weston_keymap_rules" >> $weston_config
fi
# keymap_model
if [ -n "$deviceinfo_weston_keymap_model" ]; then
echo "keymap_model=$deviceinfo_weston_keymap_model" >> $weston_config
fi
fi

View file

@ -13,9 +13,8 @@ if test -z "${XDG_RUNTIME_DIR}"; then
# Weston autostart on tty1 (Autologin on tty1 is enabled in
# /etc/inittab by postmarketos-base post-install.hook)
if [ $(tty) = "/dev/tty1" ]; then
WESTON_OPTS="--backend=fbdev-backend.so"
if test -n "${deviceinfo_weston_pixman_type}"; then
WESTON_OPTS="${WESTON_OPTS} --pixman-type=${deviceinfo_weston_pixman_type}"
WESTON_OPTS=" --pixman-type=${deviceinfo_weston_pixman_type}"
fi
udevadm trigger

View file

@ -1,2 +0,0 @@
[core]
modules=xwayland.so