Skip to content

postmarketos-base: stop modifying configs in post-install

Oliver Smith requested to merge pmos-base-mvcfg into master

Initial MR to start properly overriding configs in postmarketOS. Read Packaging: Override Configuration Files for an explanation of how we should override configs in the future and what the migration path will look like. Roll-out beyond this MR is described in #865 (closed).

I recommend to read each patch on its own, it's much easier than reading the whole diff.

In this MR:

  • CI related commits from !1759 (merged) (review them there, the commits related to CI here are slightly outdated)
  • main/postmarketos-mvcfg: new package (for the migration)
    • read these first (they are at the bottom of the diff in gitlab).
  • main/postmarketos-base: put full path in filenames
  • main/postmarketos-base: fix install_if for subpkgs
  • main/postmarketos-base: remove post-install config overrides

Details and reasoning in each commit message.

How to test the migration & example output:

#!/bin/sh -ex
pmbootstrap -q -y zap -p
pmbootstrap -q chroot -- apk add postmarketos-base
pmbootstrap -q build postmarketos-base
pmbootstrap -q chroot -- apk add -u postmarketos-base
pmbootstrap -q chroot --add=tree -- tree /etc/postmarketos-mvcfg
pmbootstrap -q chroot -- cat /etc/postmarketos-mvcfg/backup/postmarketos-base/etc-fstab
pmbootstrap -q chroot -- cat /etc/fstab
+ pmbootstrap -q -y zap -p
+ pmbootstrap -q chroot -- apk add postmarketos-base
...
(138/138) Installing postmarketos-base (3-r39)
Executing postmarketos-base-3-r39.post-install
- Modifying: /etc/fstab
- Modifying: /etc/issue
- Modifying: /etc/motd
- Modifying: /etc/conf.d/syslog
- Modifying: /etc/conf.d/wpa_supplicant
- Modifying: /etc/sudoers
- Modifying: /etc/chrony/chrony.conf (adding makestep)
- Modifying: /etc/chrony/chrony.conf (removing initstepslew)
Executing busybox-1.32.0-r3.trigger
...
OK: 105 MiB in 159 packages
+ pmbootstrap -q build postmarketos-base
+ pmbootstrap -q chroot -- apk add -u postmarketos-base
(1/1) Upgrading postmarketos-base (3-r39 -> 4-r2)
Executing postmarketos-base-4-r2.pre-upgrade
  *
  * These configs were created with legacy packaging methods:
  *   /etc/chrony/chrony.conf
  *   /etc/conf.d/syslog
  *   /etc/conf.d/wpa_supplicant
  *   /etc/fstab
  *   /etc/motd
  *   /etc/sudoers
  *   /etc/wpa_supplicant/wpa_supplicant.conf
  *
  * In order to replace them with properly packaged configs,
  * the old versions (which you might have adjusted manually)
  * were moved to:
  *   /etc/postmarketos-mvcfg/backup/postmarketos-base
  *
  * If you did not manually adjust these configs, you can ignore
  * this message.
  *
  * More information: https://postmarketos.org/mvcfg
  *
Executing busybox-1.32.0-r3.trigger
Executing postmarketos-base-4-r2.trigger
OK: 306 MiB in 191 packages
+ pmbootstrap -q chroot --add=tree -- tree /etc/postmarketos-mvcfg
/etc/postmarketos-mvcfg
├── backup
│   └── postmarketos-base
│       ├── etc-chrony-chrony.conf
│       ├── etc-conf.d-syslog
│       ├── etc-conf.d-wpa_supplicant
│       ├── etc-fstab
│       ├── etc-motd
│       ├── etc-sudoers
│       └── etc-wpa_supplicant-wpa_supplicant.conf
└── done
    └── postmarketos-base

3 directories, 8 files
+ pmbootstrap -q chroot -- cat /etc/postmarketos-mvcfg/backup/postmarketos-base/etc-fstab
/dev/cdrom	/media/cdrom	iso9660	noauto,ro 0 0
/dev/usbdisk	/media/usb	vfat	noauto,ro 0 0

# This file is *not* used to mount / or /boot.
# More information: https://postmarketos.org/fstab
+ pmbootstrap -q chroot -- cat /etc/fstab
# This file is *not* used to mount / or /boot.
# More information: https://postmarketos.org/fstab

TODO:

  • get CI changes merged (!1759 (merged))
  • Test on devices that each replaced config file works just like before. Does Wi-Fi still work with wpa_supplicant + NetworkManager?
Edited by Oliver Smith

Merge request reports