Refactor: add hook for configuration dispatch
All checks were successful
Build package / build-package (push) Successful in 10s

This commit is contained in:
2025-07-28 10:19:48 +08:00
parent ead9846716
commit 61774edc02
3 changed files with 55 additions and 10 deletions

14
61-hl-ldap-env.hook Normal file
View File

@@ -0,0 +1,14 @@
[Trigger]
Type = Path
Operation = Install
Operation = Upgrade
Target = etc/openldap/ldap.conf
Target = etc/pam.d/su
Target = etc/pam.d/su-l
Target = etc/pam.d/sudo
Target = etc/pam.d/system-auth
[Action]
Description = Override configuration files...
When = PostTransaction
Exec = /usr/lib/hl-ldap-env/install.sh

View File

@@ -15,30 +15,42 @@ depends=(
) )
install="$pkgname.install" install="$pkgname.install"
source=( source=(
'install.sh'
'ldap.conf' 'ldap.conf'
'net-home.mount'
'pam-su' 'pam-su'
'pam-su-l' 'pam-su-l'
'pam-sudo' 'pam-sudo'
'pam-system-auth' 'pam-system-auth'
'net-home.mount'
'60-sssd.conf' '60-sssd.conf'
"61-$pkgname.hook"
) )
package() { package() {
cd "$srcdir" cd "$srcdir"
install -Dm644 ldap.conf "$pkgdir/etc/openldap/ldap.conf" files_override=(
'install.sh'
'ldap.conf'
'pam-su'
'pam-su-l'
'pam-sudo'
'pam-system-auth'
)
for file in ${files_override[@]}; do
install -Dm644 "$file" "$pkgdir/usr/lib/hl-ldap-env/$file"
done
install -Dm644 net-home.mount "$pkgdir/etc/systemd/system/net-home.mount" install -Dm644 net-home.mount "$pkgdir/etc/systemd/system/net-home.mount"
install -Dm644 pam-su "$pkgdir/etc/pam.d/su" install -Dm644 60-sssd.conf "$pkgdir/etc/sssd/conf.d/60-sssd.conf"
install -Dm644 pam-su-l "$pkgdir/etc/pam.d/su-l" install -Dm644 "61-$pkgname.hook" "$pkgdir/etc/pacman.d/hooks/61-$pkgname.hook"
install -Dm644 pam-sudo "$pkgdir/etc/pam.d/sudo"
install -Dm644 pam-system-auth "$pkgdir/etc/pam.d/system-auth"
install -Dm644 60-sssd.conf "$pkgdir/etc/sssd/60-sssd.conf"
} }
sha256sums=('62c71fb39d4163e813b1fbbb7594d388d8de20476e69d0822ffd7c3d537b22a5' sha256sums=('fc5b311c7440bfef9065c2325100b2e142777c5d92d9783aa30ff7da70a77ef6'
'1c4a92b809339137fd478c628e4753b849f26059761b1e20377e24c2fb06a555' '62c71fb39d4163e813b1fbbb7594d388d8de20476e69d0822ffd7c3d537b22a5'
'c54ddb4dda93149811ccd8c29446ed9e3d75bb01a0e5ca3532b4b6bd1a6099fe' 'c54ddb4dda93149811ccd8c29446ed9e3d75bb01a0e5ca3532b4b6bd1a6099fe'
'4dc73ef7fd1640345f0b84191c18bf161f2a79b11c7309ac2f73952b22ddf737' '4dc73ef7fd1640345f0b84191c18bf161f2a79b11c7309ac2f73952b22ddf737'
'f664afd3c165da6ce355329021a81ceac562a02a853465188ba9fab919315b71' 'f664afd3c165da6ce355329021a81ceac562a02a853465188ba9fab919315b71'
'6fba778754a1e73eb038481e1e436bbdaa81d7cf4ed26d6763c1f9d2a3122f3a' '6fba778754a1e73eb038481e1e436bbdaa81d7cf4ed26d6763c1f9d2a3122f3a'
'f239447e5107f6be09b709b5a33ad23b680bcaafe60162cea11a72e4fe20516d') '1c4a92b809339137fd478c628e4753b849f26059761b1e20377e24c2fb06a555'
'f239447e5107f6be09b709b5a33ad23b680bcaafe60162cea11a72e4fe20516d'
'39505df4c52e4e1b55f54740978aa104588442957b0c4477cef3c97f32adf60e')

19
install.sh Normal file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/env -S bash
pkglib="/usr/lib/hl-ldap-env"
install_override() {
src="$1"
dest="$2"
if [[ -e "$dest" ]]; then
mv "$dest" "$dest.pacsave"
fi
install -D "$src" "$dest"
}
install_override "$pkglib/ldap.conf" '/etc/openldap/ldap.conf'
install_override "$pkglib/pam-su" '/etc/pam.d/su'
install_override "$pkglib/pam-su-l" '/etc/pam.d/su-l'
install_override "$pkglib/pam-sudo" '/etc/pam.d/sudo'
install_override "$pkglib/pam-system-auth" '/etc/pam.d/system-auth'