main/postmarketos-base: remove post-install config overrides (MR 1713)
Do not change config files in post-install scripts anymore (with sed
commands or by other means). Instead, ship the files inside the packages
and use "replaces", so apk allows the package to overwrite files from
other packages:
https://wiki.alpinelinux.org/wiki/APKBUILD_Reference#replaces
Notes on specific files:
* /etc/elogind/logind.conf: original file only consists of commented out
compile defaults. Copy them over for now. In the future we should be
able to install our own config into a .d directory, without all the
comments: 8358fc5950
* /etc/fstab: original file only has /dev/cdrom and /dev/usbdisk
entries, which are not useful for postmarketOS:
https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/alpine-baselayout/APKBUILD
* /etc/motd: reformat the text, add link to the chat
* /etc/conf.d/syslog: original file only contained 'SYSLOGD_OPTS="-t"',
make the override file as if the sed statement from post-install was
executed
* /etc/wpa_supplicant/wpa_supplicant.conf: post-install script touches
this file. We probably added it back in 2017 in relation to enabling
D-Bus (though the PR does not mention it explicity), but at least with
the current init.d script of NetworkManager, we can simply have '-u' in
wpa_supplicant_args:
https://github.com/postmarketOS/pmbootstrap/pull/578
https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/wpa_supplicant/wpa_supplicant.initd
* /etc/sudoers: base on original /etc/sudoers, but remove all the
commented out stuff except for the visudo note at the top. We could
also put a file in /etc/sudoers.d, but since the wheel line is present
in the original /etc/sudoers and only commented out, it would be kind
of unexpected to enable it in a file in /etc/sudoers.d. I prefer this
stripped down version of the file, that is easy to read.
This commit is contained in:
parent
c8a79d6fa6
commit
8b7adeddf3
13 changed files with 153 additions and 78 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
postmarketos-mvcfg-pre-upgrade \
|
||||
postmarketos-base-elogind \
|
||||
/etc/elogind/logind.conf
|
|
@ -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 <https://wiki.postmarketos.org> and <https://wiki.alpinelinux.org>.'
|
||||
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
|
||||
|
||||
|
|
12
main/postmarketos-base/postmarketos-base.pre-upgrade
Normal file
12
main/postmarketos-base/postmarketos-base.pre-upgrade
Normal file
|
@ -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
|
14
main/postmarketos-base/rootfs-etc-chrony-chrony.conf
Normal file
14
main/postmarketos-base/rootfs-etc-chrony-chrony.conf
Normal file
|
@ -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
|
2
main/postmarketos-base/rootfs-etc-conf.d-syslog
Normal file
2
main/postmarketos-base/rootfs-etc-conf.d-syslog
Normal file
|
@ -0,0 +1,2 @@
|
|||
# -C4048: enable syslog to SHM, 4048 KiB should be enough
|
||||
SYSLOGD_OPTS="-C4048 -t"
|
1
main/postmarketos-base/rootfs-etc-conf.d-wpa_supplicant
Normal file
1
main/postmarketos-base/rootfs-etc-conf.d-wpa_supplicant
Normal file
|
@ -0,0 +1 @@
|
|||
wpa_supplicant_args="-u -Dnl80211,wext"
|
39
main/postmarketos-base/rootfs-etc-elogind-logind.conf
Normal file
39
main/postmarketos-base/rootfs-etc-elogind-logind.conf
Normal file
|
@ -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
|
2
main/postmarketos-base/rootfs-etc-fstab
Normal file
2
main/postmarketos-base/rootfs-etc-fstab
Normal file
|
@ -0,0 +1,2 @@
|
|||
# This file is *not* used to mount / or /boot.
|
||||
# More information: https://postmarketos.org/fstab
|
2
main/postmarketos-base/rootfs-etc-issue
Normal file
2
main/postmarketos-base/rootfs-etc-issue
Normal file
|
@ -0,0 +1,2 @@
|
|||
Welcome to postmarketOS
|
||||
Kernel \r on an \m (\l)
|
11
main/postmarketos-base/rootfs-etc-motd
Normal file
11
main/postmarketos-base/rootfs-etc-motd
Normal file
|
@ -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.
|
16
main/postmarketos-base/rootfs-etc-sudoers
Normal file
16
main/postmarketos-base/rootfs-etc-sudoers
Normal file
|
@ -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
|
Loading…
Reference in a new issue