diff --git a/main/postmarketos-base/APKBUILD b/main/postmarketos-base/APKBUILD index 18b95d7a2..b1024e91d 100644 --- a/main/postmarketos-base/APKBUILD +++ b/main/postmarketos-base/APKBUILD @@ -1,6 +1,6 @@ pkgname=postmarketos-base pkgver=5 -pkgrel=1 +pkgrel=2 pkgdesc="Meta package for minimal postmarketOS base" url="https://postmarketos.org" arch="noarch" @@ -15,19 +15,39 @@ depends=" networkmanager openssh postmarketos-mkinitfs + postmarketos-mvcfg shadow sudo util-linux wpa_supplicant " -install="$pkgname.post-install" +install="$pkgname.post-install $pkgname.pre-upgrade" triggers="$pkgname.trigger=/etc" subpackages="$pkgname-x11 $pkgname-elogind" options="!check" +replaces=" + alpine-base + alpine-baselayout + busybox-initscripts + chrony + sudo + wpa_supplicant-openrc + " +replaces_priority=100 # leave plenty for alpine +_source044=" + etc/sudoers + " _source644=" etc/NetworkManager/conf.d/00-postmarketos.conf + etc/chrony/chrony.conf etc/conf.d/swapfile + etc/conf.d/syslog + etc/conf.d/wpa_supplicant + etc/elogind/logind.conf + etc/fstab + etc/issue + etc/motd etc/udev/rules.d/50-firmware.rules " _source755=" @@ -49,16 +69,28 @@ flatpath() { done } -source="$(flatpath $_source644) $(flatpath $_source755)" +source="$(flatpath $_source044 $_source644 $_source755)" + +prepare() { + default_prepare + + # setterm -powersave on -blank 5 + echo -ne "\033[9;5]" >> rootfs-etc-issue +} package() { local i + for i in $_source044; do + install -Dm044 "$srcdir/$(flatpath "$i")" "$pkgdir/$i" + done for i in $_source644; do install -Dm644 "$srcdir/$(flatpath "$i")" "$pkgdir/$i" done for i in $_source755; do install -Dm755 "$srcdir/$(flatpath "$i")" "$pkgdir/$i" done + + postmarketos-mvcfg-package "$pkgdir" "$pkgname" } x11() { @@ -72,14 +104,25 @@ x11() { elogind() { install_if="$pkgname=$pkgver-r$pkgrel elogind" - install="$subpkgname.post-install" - mkdir "$subpkgdir" + install="$subpkgname.pre-upgrade" + replaces="elogind" + amove etc/elogind/logind.conf amove usr/libexec/elogind/system-sleep/suspend-disable-conditions.hook + + postmarketos-mvcfg-package "$subpkgdir" "$subpkgname" } -sha512sums="67a031f309a3232ac1e8abc3fedeaee912c035f9c81b4f709248895905a27ab5844ec92c65e55b79af3894450ba3883549d4004f11efebb47114d41f730e4a5f rootfs-etc-NetworkManager-conf.d-00-postmarketos.conf +sha512sums="e529f5cef1f31481b577f99b8917704f2cfefb963d98bf40a14b017938e55a00134d2033f81d2cb0b8489c5e9b4a92fdc0a788013f1adb4cd46d9580c9988186 rootfs-etc-sudoers +67a031f309a3232ac1e8abc3fedeaee912c035f9c81b4f709248895905a27ab5844ec92c65e55b79af3894450ba3883549d4004f11efebb47114d41f730e4a5f rootfs-etc-NetworkManager-conf.d-00-postmarketos.conf +e5d049db1d82c510bab9246208b51b8ec2711d008d67792fc10d4c0b65ed4dece7b5ae3c3dd28a8539d177b6849c1f921cb9fef3d2c7bee0355451f7b4757ec6 rootfs-etc-chrony-chrony.conf e0d2d48b82a03239a4c0a00acaf83e00d397c23a8d7c71053d4e2a383357c22dcedef9e81b0e12a1d7514e1fdbe0bb3eb82613d18b29034a7ce5447f13c84a53 rootfs-etc-conf.d-swapfile +e4576c58c35f80bedddb1e89e186f37d31a186d3e9eb046581b8c5d7b7d435e18924539e851d3e67dc0ede80f9d44d16bd9ef52e73350d3f13224edc31d73a34 rootfs-etc-conf.d-syslog +fe0651904c1f40ffa67d83daca190af199f63247e53642a59a1e1147cd06776fcf20b7b2fcc5373783d50b8bd6ce8d1354c8e5f4d582d319727b9ceefd1e8e16 rootfs-etc-conf.d-wpa_supplicant +8d2c54fe3ca62c62f8337fb6be28479d0e02ea63f32abae81907f2768631e65c9e17485f8bc0854a013377f729b06dd1873e2b75f86f657ece866d00aecbbdb4 rootfs-etc-elogind-logind.conf +9b8d0493bb64457fe176fea801e0771d3c5279302c61559824bf81b3d2b66d2c1e076f4aaac65f55389005acb18c27e44bed858c2bdbad37d74199f07c86c354 rootfs-etc-fstab +45bd0742a64a9d3c4a88e152b97edcf3fa1edca28884f9ea69e7c4c365f1e41ef9056dbe204545de7d4b2ba92e1e5872b2a929c2dcc1dd468e627cc3f090b8e6 rootfs-etc-issue +2989a2701d96c496bcdb536ce93984c75604e7b248d427f7b7106ea1946760549d4c29590257a598c9ad8d3fa88735d9b168dbda28c2294816065acdbab2e93f rootfs-etc-motd 0b098828080055d3646ea54891cb0e1b578cbc30f5e16f7284f2814c08192f18079a38fb686d192715ae6a3d2cd6625d9e3cf99f234a6f0d94088bb0cb2ce43d rootfs-etc-udev-rules.d-50-firmware.rules 5fd6dd7f9941e975a6ce559924eb252606943276dc09455bbeb05ff718ecd28f20a08eee8e04ca580e5af71d4c944c256ec04f07b07286394f5dfedfa59273e7 rootfs-etc-init.d-deferred-initcalls dadd251229eb5759e3cba77c39a4afc6f28bcbe0f272cd3ab41b7ff4fe6a3d2b9ee765e1a0b8f9241274e757ed3b2ce035ee5abe91843e55fb4188a3c401ca78 rootfs-etc-init.d-devmappings diff --git a/main/postmarketos-base/postmarketos-base-elogind.post-install b/main/postmarketos-base/postmarketos-base-elogind.post-install deleted file mode 100644 index c8de2a1da..000000000 --- a/main/postmarketos-base/postmarketos-base-elogind.post-install +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -# Stop the power key from powering down the device -echo "- Modifying: /etc/elogind/logind.conf" -sed -i 's/#HandlePowerKey=poweroff/HandlePowerKey=ignore/' /etc/elogind/logind.conf -# needed for any hooks that inhibit suspend -sed -i 's/#AllowSuspendInterrupts=no/AllowSuspendInterrupts=yes/' /etc/elogind/logind.conf - -exit 0 diff --git a/main/postmarketos-base/postmarketos-base-elogind.pre-upgrade b/main/postmarketos-base/postmarketos-base-elogind.pre-upgrade new file mode 100644 index 000000000..2b677c515 --- /dev/null +++ b/main/postmarketos-base/postmarketos-base-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/postmarketos-base.post-install b/main/postmarketos-base/postmarketos-base.post-install index f74b7a64e..efa151dbf 100644 --- a/main/postmarketos-base/postmarketos-base.post-install +++ b/main/postmarketos-base/postmarketos-base.post-install @@ -22,68 +22,5 @@ done mkdir -p /run/openrc touch /run/openrc/shutdowntime -# Install /etc/fstab -if ! grep -q "postmarketos\.org/fstab" /etc/fstab; then - echo "- Modifying: /etc/fstab" - { - echo - echo "# This file is *not* used to mount / or /boot." - echo "# More information: https://postmarketos.org/fstab" - } >> /etc/fstab -fi - -# Set /etc/issue -echo "- Modifying: /etc/issue" -{ - echo 'Welcome to postmarketOS' - echo 'Kernel \r on an \m (\l)' - # setterm -powersave on -blank 5 - echo -ne "\033[9;5]" -} >/etc/issue - -# Set /etc/motd -echo "- Modifying: /etc/motd" -{ - echo 'Welcome to postmarketOS!' - echo '' - echo 'This distribution is based on Alpine Linux.' - echo 'Read both our wikis to find a large amount of how-to guides and' - echo 'general information about administrating and development.' - echo 'See and .' - echo '' - echo 'You may change this message by editing /etc/motd.' - echo '' -} >/etc/motd - -# Enable syslog to SHM. Note: size is 4048KiB, which *should* be More Than Enough(TM) for all but the most chattiest of devices. -echo "- Modifying: /etc/conf.d/syslog" -sed s/=\"/=\""-C4048 "/ -i /etc/conf.d/syslog - -# Enable nl80211,wext & dbus control for wpa_supplicant -if ! grep -q Dnl80211,wext /etc/conf.d/wpa_supplicant; then - echo "- Modifying: /etc/conf.d/wpa_supplicant" - sed -i 's/wpa_supplicant_args=\"/wpa_supplicant_args=\" -u -Dnl80211,wext/' \ - /etc/conf.d/wpa_supplicant -fi -touch /etc/wpa_supplicant/wpa_supplicant.conf - -# Enable the 'wheel' group -echo "- Modifying: /etc/sudoers" -sed -i 's/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /etc/sudoers - -# Set chrony to quickly correct system time whenever it differs from -# ntp time by more than 1s. -if ! grep -q "makestep" /etc/chrony/chrony.conf; then - echo "- Modifying: /etc/chrony/chrony.conf (adding makestep)" - echo "makestep 1 -1" >> /etc/chrony/chrony.conf -fi - -# Comment out initstepslew in the chrony configuration to avoid a delay -# during boot. -if grep -q "^initstepslew" /etc/chrony/chrony.conf; then - echo "- Modifying: /etc/chrony/chrony.conf (removing initstepslew)" - sed -i 's/^initstepslew/#initstepslew/' /etc/chrony/chrony.conf -fi - exit 0 diff --git a/main/postmarketos-base/postmarketos-base.pre-upgrade b/main/postmarketos-base/postmarketos-base.pre-upgrade new file mode 100644 index 000000000..056392ba9 --- /dev/null +++ b/main/postmarketos-base/postmarketos-base.pre-upgrade @@ -0,0 +1,12 @@ +#!/bin/sh + +postmarketos-mvcfg-pre-upgrade \ + postmarketos-base \ + /etc/chrony/chrony.conf \ + /etc/conf.d/syslog \ + /etc/conf.d/wpa_supplicant \ + /etc/fstab \ + /etc/issue \ + /etc/motd \ + /etc/sudoers \ + /etc/wpa_supplicant/wpa_supplicant.conf diff --git a/main/postmarketos-base/rootfs-etc-chrony-chrony.conf b/main/postmarketos-base/rootfs-etc-chrony-chrony.conf new file mode 100644 index 000000000..a6cefdeb0 --- /dev/null +++ b/main/postmarketos-base/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/rootfs-etc-conf.d-syslog b/main/postmarketos-base/rootfs-etc-conf.d-syslog new file mode 100644 index 000000000..fc6e150b1 --- /dev/null +++ b/main/postmarketos-base/rootfs-etc-conf.d-syslog @@ -0,0 +1,2 @@ +# -C4048: enable syslog to SHM, 4048 KiB should be enough +SYSLOGD_OPTS="-C4048 -t" diff --git a/main/postmarketos-base/rootfs-etc-conf.d-wpa_supplicant b/main/postmarketos-base/rootfs-etc-conf.d-wpa_supplicant new file mode 100644 index 000000000..e614d9b5c --- /dev/null +++ b/main/postmarketos-base/rootfs-etc-conf.d-wpa_supplicant @@ -0,0 +1 @@ +wpa_supplicant_args="-u -Dnl80211,wext" diff --git a/main/postmarketos-base/rootfs-etc-elogind-logind.conf b/main/postmarketos-base/rootfs-etc-elogind-logind.conf new file mode 100644 index 000000000..624a0089b --- /dev/null +++ b/main/postmarketos-base/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/rootfs-etc-fstab b/main/postmarketos-base/rootfs-etc-fstab new file mode 100644 index 000000000..a42d49489 --- /dev/null +++ b/main/postmarketos-base/rootfs-etc-fstab @@ -0,0 +1,2 @@ +# This file is *not* used to mount / or /boot. +# More information: https://postmarketos.org/fstab diff --git a/main/postmarketos-base/rootfs-etc-issue b/main/postmarketos-base/rootfs-etc-issue new file mode 100644 index 000000000..1392c2c82 --- /dev/null +++ b/main/postmarketos-base/rootfs-etc-issue @@ -0,0 +1,2 @@ +Welcome to postmarketOS +Kernel \r on an \m (\l) diff --git a/main/postmarketos-base/rootfs-etc-motd b/main/postmarketos-base/rootfs-etc-motd new file mode 100644 index 000000000..f97092219 --- /dev/null +++ b/main/postmarketos-base/rootfs-etc-motd @@ -0,0 +1,11 @@ +Welcome to postmarketOS! + +This distribution is based on Alpine Linux. Read both our wikis to find a +large amount of how-to guides and general information about administrating +and development. Join the chat for live discussions. + +* https://wiki.postmarketos.org +* https://wiki.alpinelinux.org +* https://postmarketos.org/chat + +You may change this message by editing /etc/motd. diff --git a/main/postmarketos-base/rootfs-etc-sudoers b/main/postmarketos-base/rootfs-etc-sudoers new file mode 100644 index 000000000..f05905fa3 --- /dev/null +++ b/main/postmarketos-base/rootfs-etc-sudoers @@ -0,0 +1,16 @@ +## sudoers file. +## +## This file MUST be edited with the 'visudo' command as root. +## Failure to use 'visudo' may result in syntax or file permission errors +## that prevent sudo from running. +## +## See the sudoers man page for the details on how to write a sudoers file. +## + +root ALL=(ALL) ALL + +## Allow members of group wheel to execute any command +%wheel ALL=(ALL) ALL + +## Read drop-in files from /etc/sudoers.d +@includedir /etc/sudoers.d