diff options
author | Maxim Devaev <[email protected]> | 2024-02-05 16:45:51 +0200 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2024-02-05 16:45:51 +0200 |
commit | c45d19c98eed1d649b0d68332457cf97bf5c5bf2 (patch) | |
tree | e20bf6b62dffe20f1736c96e60ed7903854b4138 | |
parent | af9c2f1f59f24ea38f989627def586b90cca7524 (diff) |
kvmd.install: Don't apply config patches again
-rw-r--r-- | kvmd.install | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/kvmd.install b/kvmd.install index d30571ab..38158715 100644 --- a/kvmd.install +++ b/kvmd.install @@ -1,9 +1,12 @@ # shellcheck disable=SC2148 +# arg 1: the new package version post_install() { - post_upgrade + post_upgrade "$1" "" } +# arg 1: the new package version +# arg 2: the old package version post_upgrade() { echo "==> Ensuring KVMD users and groups ..." systemd-sysusers /usr/lib/sysusers.d/kvmd.conf @@ -52,15 +55,18 @@ post_upgrade() { done echo "==> Patching configs ..." - [ ! -f /etc/fstab ] || (sed -i -e "s|,data=journal||g" /etc/fstab && touch -t 200701011000 /etc/fstab) - [ ! -f /etc/fstab ] || (sed -i -e "/tmpfs \/run\s/d" /etc/fstab && touch -t 200701011000 /etc/fstab) - [ ! -f /etc/pacman.conf ] || sed -i -e "s|^Server = https://pikvm.org/repos/|Server = https://files.pikvm.org/repos/arch/|g" /etc/pacman.conf - [ ! -f /boot/config.txt ] || sed -i -e 's/^dtoverlay=pi3-disable-bt$/dtoverlay=disable-bt/g' /boot/config.txt - [ ! -f /boot/config.txt ] || sed -i -e 's/^dtoverlay=dwc2$/dtoverlay=dwc2,dr_mode=peripheral/g' /boot/config.txt - [ ! -f /etc/conf.d/rngd ] || (echo 'RNGD_OPTS="-o /dev/random -r /dev/hwrng -x jitter -x pkcs11 -x rtlsdr"' > /etc/conf.d/rngd) - [ ! -f /etc/pam.d/system-login ] || sed -i -e '/\<pam_systemd\.so\>/ s/^#*/#/' /etc/pam.d/system-login - [ ! -f /etc/pam.d/system-auth ] || sed -i -e '/\<pam_systemd_home\.so\>/ s/^#*/#/' /etc/pam.d/system-auth - [ -e /etc/systemd/network/99-default.link ] || ln -s /dev/null /etc/systemd/network/99-default.link + + if [[ "$(vercmp "$1" 3.301)" -lt 0 ]]; then + [ ! -f /etc/fstab ] || (sed -i -e "s|,data=journal||g" /etc/fstab && touch -t 200701011000 /etc/fstab) + [ ! -f /etc/fstab ] || (sed -i -e "/tmpfs \/run\s/d" /etc/fstab && touch -t 200701011000 /etc/fstab) + [ ! -f /etc/pacman.conf ] || sed -i -e "s|^Server = https://pikvm.org/repos/|Server = https://files.pikvm.org/repos/arch/|g" /etc/pacman.conf + [ ! -f /boot/config.txt ] || sed -i -e 's/^dtoverlay=pi3-disable-bt$/dtoverlay=disable-bt/g' /boot/config.txt + [ ! -f /boot/config.txt ] || sed -i -e 's/^dtoverlay=dwc2$/dtoverlay=dwc2,dr_mode=peripheral/g' /boot/config.txt + [ ! -f /etc/conf.d/rngd ] || (echo 'RNGD_OPTS="-o /dev/random -r /dev/hwrng -x jitter -x pkcs11 -x rtlsdr"' > /etc/conf.d/rngd) + [ ! -f /etc/pam.d/system-login ] || sed -i -e '/\<pam_systemd\.so\>/ s/^#*/#/' /etc/pam.d/system-login + [ ! -f /etc/pam.d/system-auth ] || sed -i -e '/\<pam_systemd_home\.so\>/ s/^#*/#/' /etc/pam.d/system-auth + [ -e /etc/systemd/network/99-default.link ] || ln -s /dev/null /etc/systemd/network/99-default.link + fi # Some update deletes /etc/motd, WTF # shellcheck disable=SC2015,SC2166 |