mirror of
https://github.com/void-linux/void-packages.git
synced 2025-10-08 03:25:11 +02:00
The system-accounts XBPS trigger originally used getent(1) to check for existing users or groups before attempting to create those entities defined by package templates. When invoked on an alternate root (for example, with `xbps-install -r /path/to/root`), this is incorrect because getent always looks for entries in host databases. There is no need to check for existing accounts before attempting to invoke useradd(8) or groupadd(8) because these programs will fail with a specific error code when the creation conflicts with an existing entity. The modified hook just attempts to create users and groups from the start, detecting the "already exists" return code and doing the right thing in that case (nothing further for groups, but modifying existing user entities). When the trigger acts on the system root, the useradd/groupadd/usermod invocations are aware of remote NIS or LDAP directories and should behave in these environments. In particular, the tools will not attempt to create entities defined in remote directories. In an alternate root, it isn't really appropriate to consider remote directories, because there is no guarantee that the alternate root will be using those directories. When the trigger acts on an alternate root, it uses the `--prefix|-P` argument to useradd/groupadd/usermod, which disregards NIS and LDAP and acts only on local files in the given prefix. Most importantly, this ensures that the hook will not attempt to create users or groups on the host when acting on an alternate root. Closes: #24812
22 lines
561 B
Bash
22 lines
561 B
Bash
# Template file for 'xbps-triggers'
|
|
pkgname=xbps-triggers
|
|
version=0.117
|
|
revision=1
|
|
bootstrap=yes
|
|
short_desc="XBPS triggers for Void Linux"
|
|
maintainer="Enno Boland <gottox@voidlinux.org>"
|
|
license="Public Domain"
|
|
homepage="https://voidlinux.org"
|
|
|
|
do_install() {
|
|
_triggersdir=usr/libexec/${pkgname}
|
|
|
|
for f in ${FILESDIR}/*; do
|
|
_trigger=$(basename $f)
|
|
vinstall ${FILESDIR}/${_trigger} 754 ${_triggersdir}
|
|
echo "# end" >> ${DESTDIR}/${_triggersdir}/${_trigger}
|
|
done
|
|
vmkdir var/db/xbps
|
|
cd ${DESTDIR}/var/db/xbps
|
|
ln -sf ../../../${_triggersdir} triggers
|
|
}
|