osi-tools/test/mod-pacman-hook.sh

23 lines
452 B
Bash

#!/hint/bash -euE
# Copyright (C) 2026 Luke Shumaker
# SPDX-License-Identifier: AGPL-3.0-or-later
pre_install+=(20:add-pacman-hook)
add-pacman-hook() {
local arg_mountpoint=$1
install -Dm644 /dev/stdin "$arg_mountpoint/etc/pacman.d/hooks/zz-test.hook" <<'EOF'
[Trigger]
Operation = Install
Operation = Upgrade
Operation = Remove
Type = Path
Target = etc/*
[Action]
Description = test hook
When = PostTransaction
Exec = /bin/touch /hook-ran
EOF
}