From 6e325417de342cd291942cb3448b28db0f55b85e Mon Sep 17 00:00:00 2001 From: Clayton Craft Date: Wed, 9 Jun 2021 16:32:56 -0700 Subject: [PATCH] postmarketos-base-ui: new aport (MR 2243) This provides UI-specific config and dependencies for postmarketos-ui-* packages. fixes #1104 --- main/postmarketos-base-ui/APKBUILD | 105 ++++++++++++++++++ .../postmarketos-base-ui-elogind.post-install | 3 + .../postmarketos-base-ui-elogind.pre-upgrade | 5 + .../postmarketos-base-ui.post-install | 6 + .../postmarketos-base-ui.post-upgrade | 4 + .../rootfs-etc-chrony-chrony.conf | 14 +++ .../rootfs-etc-conf.d-tinydm | 8 ++ .../rootfs-etc-conf.d-wpa_supplicant | 1 + .../rootfs-etc-elogind-logind.conf | 39 +++++++ ...c-pulse-daemon.conf.d-90-postmarketos.conf | 1 + .../rootfs-etc-pulse-postmarketos.pa | 7 ++ .../rootfs-etc-sleep-inhibitor.conf | 43 +++++++ 12 files changed, 236 insertions(+) create mode 100644 main/postmarketos-base-ui/APKBUILD create mode 100644 main/postmarketos-base-ui/postmarketos-base-ui-elogind.post-install create mode 100644 main/postmarketos-base-ui/postmarketos-base-ui-elogind.pre-upgrade create mode 100644 main/postmarketos-base-ui/postmarketos-base-ui.post-install create mode 100644 main/postmarketos-base-ui/postmarketos-base-ui.post-upgrade create mode 100644 main/postmarketos-base-ui/rootfs-etc-chrony-chrony.conf create mode 100644 main/postmarketos-base-ui/rootfs-etc-conf.d-tinydm create mode 100644 main/postmarketos-base-ui/rootfs-etc-conf.d-wpa_supplicant create mode 100644 main/postmarketos-base-ui/rootfs-etc-elogind-logind.conf create mode 100644 main/postmarketos-base-ui/rootfs-etc-pulse-daemon.conf.d-90-postmarketos.conf create mode 100644 main/postmarketos-base-ui/rootfs-etc-pulse-postmarketos.pa create mode 100644 main/postmarketos-base-ui/rootfs-etc-sleep-inhibitor.conf diff --git a/main/postmarketos-base-ui/APKBUILD b/main/postmarketos-base-ui/APKBUILD new file mode 100644 index 000000000..e68d26978 --- /dev/null +++ b/main/postmarketos-base-ui/APKBUILD @@ -0,0 +1,105 @@ +# Maintainer: Clayton Craft +pkgname=postmarketos-base-ui +pkgver=1 +pkgrel=0 +pkgdesc="Meta package for minimal postmarketOS UI base" +url="https://postmarketos.org" +arch="noarch" +license="GPL-3.0-or-later" +depends=" + chrony + dbus + haveged + nftables + postmarketos-base + shadow + util-linux + wpa_supplicant + wireless-regdb + " +subpackages=" + $pkgname-elogind + $pkgname-tinydm + $pkgname-x11 + $pkgname-pulseaudio + " +install="$pkgname.post-install $pkgname.post-upgrade" +replaces=" + chrony + wpa_supplicant-openrc + postmarketos-base + " +replaces_priority=100 # leave plenty for alpine + +_source644=" + etc/chrony/chrony.conf + etc/conf.d/tinydm + etc/conf.d/wpa_supplicant + etc/elogind/logind.conf + etc/pulse/daemon.conf.d/90-postmarketos.conf + etc/pulse/postmarketos.pa + etc/sleep-inhibitor.conf + " + +# Avoid filename based checksum conflicts by including the whole path. +flatpath() { + local i + for i in $@; do + echo "rootfs-$i" | sed s./.-.g + done +} +source="$(flatpath $_source644)" + +package() { + local i + for i in $_source644; do + install -Dm644 "$srcdir/$(flatpath "$i")" "$pkgdir/$i" + done +} + +x11() { + install_if="$pkgname=$pkgver-r$pkgrel xorg-server" + depends=" + libinput + xf86-input-libinput + xf86-video-fbdev" + provides="postmarketos-base-x11=$pkgver-r$pkgrel" + mkdir "$subpkgdir" +} + +elogind() { + install_if="$pkgname=$pkgver-r$pkgrel elogind" + depends="sleep-inhibitor" + install="$subpkgname.pre-upgrade $subpkgname.post-install" + replaces=" + elogind + sleep-inhibitor + " + provides="postmarketos-base-elogind=$pkgver-r$pkgrel" + + amove etc/elogind/logind.conf + amove etc/sleep-inhibitor.conf +} + +tinydm() { + install_if="$pkgname=$pkgver-r$pkgrel tinydm-openrc" + replaces="tinydm-openrc" + provides="postmarketos-base-tinydm=$pkgver-r$pkgrel" + amove etc/conf.d/tinydm +} + +pulseaudio() { + install_if="$pkgname=$pkgver-r$pkgrel pulseaudio" + provides="postmarketos-base-pulseaudio=$pkgver-r$pkgrel" + amove etc/pulse/postmarketos.pa + amove etc/pulse/daemon.conf.d/90-postmarketos.conf +} +sha512sums=" +e5d049db1d82c510bab9246208b51b8ec2711d008d67792fc10d4c0b65ed4dece7b5ae3c3dd28a8539d177b6849c1f921cb9fef3d2c7bee0355451f7b4757ec6 rootfs-etc-chrony-chrony.conf +44e4283c6f77de83915977dd3bc2d8e2d96b3ed6cc68d3cc156304359ae649b5a8b0bac843e517ec6faa2066dd43ba85e313899b1eda04862f864fb9eb508aa0 rootfs-etc-conf.d-tinydm +fe0651904c1f40ffa67d83daca190af199f63247e53642a59a1e1147cd06776fcf20b7b2fcc5373783d50b8bd6ce8d1354c8e5f4d582d319727b9ceefd1e8e16 rootfs-etc-conf.d-wpa_supplicant +8d2c54fe3ca62c62f8337fb6be28479d0e02ea63f32abae81907f2768631e65c9e17485f8bc0854a013377f729b06dd1873e2b75f86f657ece866d00aecbbdb4 rootfs-etc-elogind-logind.conf +4afe8c5b70f4ca85f9348eb0df12e3152b76203a1a138daa5777f22b751ea431d3ee4113189d8606078f87a99c230b184bc73d53222e6e00581e46224bf5d39f rootfs-etc-pulse-daemon.conf.d-90-postmarketos.conf +315598b67889b1f25f82b8269ed36af4fcee018a4edf2926ba966ab08e0a42e36676896d0a5636001b1eb7f16211dcf518123230049556dec9d03006e003a584 rootfs-etc-pulse-postmarketos.pa +6b9c7bb73213187eb9ca8a94109b2b816f50c1158c90fec2e92b373864280d67741589e5bfbab8810945f031d2f4b535aad78a72e46e52ea50be5b85324da381 rootfs-etc-sleep-inhibitor.conf +" diff --git a/main/postmarketos-base-ui/postmarketos-base-ui-elogind.post-install b/main/postmarketos-base-ui/postmarketos-base-ui-elogind.post-install new file mode 100644 index 000000000..80923907e --- /dev/null +++ b/main/postmarketos-base-ui/postmarketos-base-ui-elogind.post-install @@ -0,0 +1,3 @@ +#!/bin/sh -e + +rc-update -q add sleep-inhibitor default diff --git a/main/postmarketos-base-ui/postmarketos-base-ui-elogind.pre-upgrade b/main/postmarketos-base-ui/postmarketos-base-ui-elogind.pre-upgrade new file mode 100644 index 000000000..2b677c515 --- /dev/null +++ b/main/postmarketos-base-ui/postmarketos-base-ui-elogind.pre-upgrade @@ -0,0 +1,5 @@ +#!/bin/sh + +postmarketos-mvcfg-pre-upgrade \ + postmarketos-base-elogind \ + /etc/elogind/logind.conf diff --git a/main/postmarketos-base-ui/postmarketos-base-ui.post-install b/main/postmarketos-base-ui/postmarketos-base-ui.post-install new file mode 100644 index 000000000..03d9fd657 --- /dev/null +++ b/main/postmarketos-base-ui/postmarketos-base-ui.post-install @@ -0,0 +1,6 @@ +#!/bin/sh -e + +for service in dbus haveged wpa_supplicant chronyd rfkill; do + rc-update -q add $service default +done +exit 0 diff --git a/main/postmarketos-base-ui/postmarketos-base-ui.post-upgrade b/main/postmarketos-base-ui/postmarketos-base-ui.post-upgrade new file mode 100644 index 000000000..ed792d830 --- /dev/null +++ b/main/postmarketos-base-ui/postmarketos-base-ui.post-upgrade @@ -0,0 +1,4 @@ +#!/bin/sh +# WARNING: do not symlink this file to postmarketos-base-ui.post-install! +# Needs further discussion, see: +# https://gitlab.com/postmarketOS/pmaports/-/merge_requests/2243#note_602226491 diff --git a/main/postmarketos-base-ui/rootfs-etc-chrony-chrony.conf b/main/postmarketos-base-ui/rootfs-etc-chrony-chrony.conf new file mode 100644 index 000000000..a6cefdeb0 --- /dev/null +++ b/main/postmarketos-base-ui/rootfs-etc-chrony-chrony.conf @@ -0,0 +1,14 @@ +# This file is provided by postmarketos-base + +pool pool.ntp.org iburst + +# Commented out to avoid delay during boot +# https://gitlab.com/postmarketOS/pmaports/-/issues/44#note_264516692 +# initstepslew 10 pool.ntp.org + +driftfile /var/lib/chrony/chrony.drift +rtcsync +cmdport 0 + +# Quickly correct system time whenever it differs from ntp time by more than 1s +makestep 1 -1 diff --git a/main/postmarketos-base-ui/rootfs-etc-conf.d-tinydm b/main/postmarketos-base-ui/rootfs-etc-conf.d-tinydm new file mode 100644 index 000000000..25e594b95 --- /dev/null +++ b/main/postmarketos-base-ui/rootfs-etc-conf.d-tinydm @@ -0,0 +1,8 @@ +# This file is provided by postmarketos-base. + +# this option is required for some DEs (e.g., Phosh) to be cleaned up fully so +# they aren't automatically restarted by a child process +rc_cgroup_cleanup="yes" + +# UID of user to autologin (pmOS default UID is 10000) +AUTOLOGIN_UID=10000 diff --git a/main/postmarketos-base-ui/rootfs-etc-conf.d-wpa_supplicant b/main/postmarketos-base-ui/rootfs-etc-conf.d-wpa_supplicant new file mode 100644 index 000000000..e614d9b5c --- /dev/null +++ b/main/postmarketos-base-ui/rootfs-etc-conf.d-wpa_supplicant @@ -0,0 +1 @@ +wpa_supplicant_args="-u -Dnl80211,wext" diff --git a/main/postmarketos-base-ui/rootfs-etc-elogind-logind.conf b/main/postmarketos-base-ui/rootfs-etc-elogind-logind.conf new file mode 100644 index 000000000..624a0089b --- /dev/null +++ b/main/postmarketos-base-ui/rootfs-etc-elogind-logind.conf @@ -0,0 +1,39 @@ +# This file is provided by postmarketos-base. See logind.conf(5) for details. + +[Login] +#KillUserProcesses=no +#KillOnlyUsers= +#KillExcludeUsers=root +#InhibitDelayMaxSec=5 +HandlePowerKey=ignore +#HandleSuspendKey=suspend +#HandleHibernateKey=hibernate +#HandleLidSwitch=suspend +#HandleLidSwitchExternalPower=suspend +#HandleLidSwitchDocked=ignore +#PowerKeyIgnoreInhibited=no +#SuspendKeyIgnoreInhibited=no +#HibernateKeyIgnoreInhibited=no +#LidSwitchIgnoreInhibited=yes +#HoldoffTimeoutSec=30s +#IdleAction=ignore +#IdleActionSec=30min +#RuntimeDirectorySize=10% +#RemoveIPC=yes +#InhibitorsMax=8192 +#SessionsMax=8192 + +[Sleep] +#AllowSuspend=yes +#AllowHibernation=yes +#AllowSuspendThenHibernate=yes +#AllowHybridSleep=yes +#AllowPowerOffInterrupts=no +AllowSuspendInterrupts=yes +#SuspendState=mem standby freeze +#SuspendMode= +#HibernateState=disk +#HibernateMode=platform shutdown +#HybridSleepState=disk +#HybridSleepMode=suspend platform shutdown +#HibernateDelaySec=10800 diff --git a/main/postmarketos-base-ui/rootfs-etc-pulse-daemon.conf.d-90-postmarketos.conf b/main/postmarketos-base-ui/rootfs-etc-pulse-daemon.conf.d-90-postmarketos.conf new file mode 100644 index 000000000..8bb718193 --- /dev/null +++ b/main/postmarketos-base-ui/rootfs-etc-pulse-daemon.conf.d-90-postmarketos.conf @@ -0,0 +1 @@ +default-script-file = /etc/pulse/postmarketos.pa diff --git a/main/postmarketos-base-ui/rootfs-etc-pulse-postmarketos.pa b/main/postmarketos-base-ui/rootfs-etc-pulse-postmarketos.pa new file mode 100644 index 000000000..d51743d80 --- /dev/null +++ b/main/postmarketos-base-ui/rootfs-etc-pulse-postmarketos.pa @@ -0,0 +1,7 @@ +.include /etc/pulse/default.pa + +# duck volume of audio streams when notification or accessibility sounds are played +load-module module-role-ducking trigger_roles=event,a11y ducking_roles=no_role,music,video,game global=true + +# automatically switch default source/sink to a new device (Bluetooth, USB) +load-module module-switch-on-connect diff --git a/main/postmarketos-base-ui/rootfs-etc-sleep-inhibitor.conf b/main/postmarketos-base-ui/rootfs-etc-sleep-inhibitor.conf new file mode 100644 index 000000000..66373dd67 --- /dev/null +++ b/main/postmarketos-base-ui/rootfs-etc-sleep-inhibitor.conf @@ -0,0 +1,43 @@ +# Configuration file for sleep-inhibitor program. Copy this to +# /etc/sleep-inhibitor.conf and edit as you want. +# +# Normally the plugin dir (for provided plugins) is automatically +# determined at either /usr/share/sleep-inhibitor/plugins or +# /usr/local/share/sleep-inhibitor/plugins but you can define it +# explicitly here if you want, e.g. for custom config file for testing. +# plugin_dir: +# +# Plugins are defined following. You can define as many plugins as you +# require. Custom plugins are specified with an absolute path to your +# own executable file. Standard plugins (i.e. those included in the +# distribution plugins/ dir) are specified with no path. +# +# Arguments are specified as below: +# path: Must be specified. Can be an absolute path for custom +# plugins, or relative to the program distribution plugins/ +# directory for standard plugins. +# args: Optional. Provides arguments to the above script if required. +# period: Optional. Specifies period in minutes. Defaults to 5. +# name: Optional. Descriptive name for logging. Defaults to basename of +# path. +# what: Optional. Takes a colon-seperated list of one or more +# operations to inhibit. See the description of the --what +# option in the man page for systemd-inhibit. Defaults to the +# default value of that systemd-inhibit option. + +plugins: + + - path: ssh-session-open + name: SSH session open + period: .1 + what: sleep + + - path: apk-running + name: apk running + period: .1 + what: sleep + + - path: is-alsa-playing + name: alsa playing + period: .5 + what: sleep