Ensure hook is not restored in software updates

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-02-04 01:57:50 +01:00
parent c061e8954f
commit 57c1869f99
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D
2 changed files with 14 additions and 0 deletions

View file

@ -7,6 +7,7 @@ etc/pacman.d/gnupg/private-keys-v1.d/*
etc/pacman.d/gnupg/pubring.gpg~
etc/pacman.d/gnupg/S.*
root/*
run/*
tmp/*
var/cache/pacman/pkg/*
var/lib/pacman/sync/*

View file

@ -42,5 +42,18 @@ arch-chroot ${tmpdir} pacman-key --populate archlinux
# Temporarily break the tmpfiles hook which causes every pacman operation to hang forever
sed -i 's!^Exec.*!Exec = /usr/bin/true!' ${tmpdir}/usr/share/libalpm/hooks/30-systemd-tmpfiles.hook
cat >${tmpdir}/usr/share/libalpm/hooks/01-remove-tmpfiles.hook <<-'EOF'
[Trigger]
Type = Path
Operation = Install
Operation = Upgrade
Target = usr/share/libalpm/hooks/*.hook
[Action]
Description = Removing tmpfiles hook...
When = PostTransaction
Exec = /usr/bin/bash -exc "/usr/bin/sed -i 's!^Exec = .*/systemd-hook tmpfiles!Exec = /usr/bin/true!' /usr/share/libalpm/hooks/*.hook"
EOF
# Pack rootfs
tar --numeric-owner --xattrs --acls --exclude-from=exclude -C ${tmpdir} -c . -f archlinux.tar