De-couple weston from postmarketos-base (#233)

Thanks, craftyguy!

- UI is selectable with `pmbootstrap init`. Currently only 'weston' and 'none' are options. It'll automatically pick up any new `postmarketos-ui-*` packages added at later dates.
- splits off weston packages install from postmarketos-base and puts
them into postmarketos-ui-weston. Also note that NO weston packages are
installed by "pmbootstrap install" by default unless the user selects a ui in the `init`
- configuration of weston is now in postmarketos-ui-weston.
- the demos have been spun off to `postmarketos-demos`, and `postmarketos-ui-weston` lists this package as a dependency.
This commit is contained in:
clayton craft 2017-07-24 13:55:55 -07:00 committed by Oliver Smith
parent fcf593531c
commit 924546135c
10 changed files with 110 additions and 54 deletions

View file

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

View file

@ -48,42 +48,3 @@ if ! apk audit /etc | grep -q etc/motd; then
echo '' echo ''
} >/etc/motd } >/etc/motd
fi 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

@ -1,11 +1,11 @@
pkgname=postmarketos-demos pkgname=postmarketos-demos
pkgver=4 pkgver=4
pkgrel=2 pkgrel=3
pkgdesc="Simple touch menu for a few demo programs" pkgdesc="Simple touch menu for a few demo programs"
url="https://github.com/postmarketOS" url="https://github.com/postmarketOS"
arch="all" arch="all"
license="GPL3+" license="GPL3+"
depends="weston-clients" depends="weston-xwayland"
makedepends="gtk+3.0-dev" makedepends="gtk+3.0-dev"
subpackages="" subpackages=""
source="main.c Makefile" source="main.c Makefile"

View file

@ -0,0 +1,21 @@
pkgname=postmarketos-ui-weston
pkgver=1
pkgrel=1
pkgdesc="Meta package for weston"
url="https://github.com/postmarketOS"
arch="noarch"
license="GPL3+"
depends="weston-clients weston weston-shell-desktop weston-backend-fbdev
weston-backend-drm weston-backend-x11 weston-terminal
weston-xwayland xorg-server-xwayland postmarketos-demos"
makedepends=""
install="$pkgname.post-install"
subpackages=""
source="start_weston.sh"
options="!check"
package() {
install -D -m644 "$srcdir"/start_weston.sh \
"$pkgdir"/etc/profile.d/start_weston.sh || return 1
}
sha512sums="c58547a8e3f184f97aabb746b6b2d4e84292809d00c2fbd16e4051f142246798cdf26a7a5861d632afaf2c103d47045aa3ba7b740157c2f0f9c2a404716252b0 start_weston.sh"

View file

@ -0,0 +1,39 @@
#!/bin/sh
. /etc/deviceinfo
# This section generates weston.ini with options from /etc/deviceinfo (if present)
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

@ -52,6 +52,7 @@ defaults = {
"mirror_postmarketos": "", "mirror_postmarketos": "",
"work": os.path.expanduser("~") + "/.local/var/pmbootstrap", "work": os.path.expanduser("~") + "/.local/var/pmbootstrap",
"port_distccd": "33632", "port_distccd": "33632",
"ui": "weston",
# aes-xts-plain64 would be better, but this is not supported on LineageOS # aes-xts-plain64 would be better, but this is not supported on LineageOS
# kernel configs # kernel configs
@ -206,12 +207,7 @@ install_native_packages = ["cryptsetup", "util-linux", "e2fsprogs", "parted"]
install_device_packages = [ install_device_packages = [
# postmarketos # postmarketos
"postmarketos-base", "postmarketos-demos", "postmarketos-base",
# weston
"weston", "weston-shell-desktop", "weston-backend-fbdev", "weston-backend-drm",
"weston-backend-x11", "weston-clients", "weston-terminal",
"weston-xwayland", "xorg-server-xwayland",
# other # other
"ttf-droid" "ttf-droid"

View file

@ -23,6 +23,7 @@ import multiprocessing
import pmb.config import pmb.config
import pmb.helpers.cli import pmb.helpers.cli
import pmb.helpers.devices import pmb.helpers.devices
import pmb.helpers.ui
def init(args): def init(args):
@ -37,6 +38,12 @@ def init(args):
cfg["pmbootstrap"]["device"] = pmb.helpers.cli.ask(args, "Device", cfg["pmbootstrap"]["device"] = pmb.helpers.cli.ask(args, "Device",
None, args.device) None, args.device)
# UI selection
ui_list = pmb.helpers.ui.list(args)
logging.info("Available user interfaces (" + str(len(ui_list) - 1) + "): " + ", ".join(ui_list))
cfg["pmbootstrap"]["ui"] = pmb.helpers.cli.ask(args, "User Interface:",
None, args.ui, True)
# Work folder # Work folder
logging.info("Location of the 'work' path. Multiple chroots (native," logging.info("Location of the 'work' path. Multiple chroots (native,"
" device arch, device rootfs) will be created in there.") " device arch, device rootfs) will be created in there.")

33
pmb/helpers/ui.py Normal file
View file

@ -0,0 +1,33 @@
"""
Copyright 2017 Clayton Craft
This file is part of pmbootstrap.
pmbootstrap is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
pmbootstrap is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import glob
def list(args):
"""
Get all UIs, for which aports are available
:returns: ["none", "postmarketos-ui-one", "psotmarketos-ui-two", ...]
"""
ret = []
for path in glob.glob(args.aports + "/postmarketos-ui-*"):
ui = os.path.basename(path).split("-", 2)[2]
ret.append(ui)
ret.append('none')
return ret

View file

@ -90,6 +90,8 @@ def install(args):
logging.info("*** (2/5) CREATE DEVICE ROOTFS (" + args.device + ") ***") logging.info("*** (2/5) CREATE DEVICE ROOTFS (" + args.device + ") ***")
install_packages = (pmb.config.install_device_packages + install_packages = (pmb.config.install_device_packages +
["device-" + args.device]) ["device-" + args.device])
if args.ui.lower() != "none":
install_packages += ["postmarketos-ui-" + args.ui]
suffix = "rootfs_" + args.device suffix = "rootfs_" + args.device
pmb.chroot.apk.upgrade(args, suffix) pmb.chroot.apk.upgrade(args, suffix)