Add a trigger to (un)register system user/groups.

The following vars can be used for this:

- system_accounts="foo blah"
- foo_homedir, foo_shell, foo_descr, foo_groups.

--HG--
extra : convert_revision : bc7d002e00abc5c84f83a3716a8ecf97f9c9ff24
This commit is contained in:
Juan RP 2009-12-11 12:03:21 +01:00
parent af1b82c40a
commit 4c2cc8b588
8 changed files with 120 additions and 8 deletions

View file

@ -38,7 +38,7 @@ xbps_write_metadata_scripts_pkg()
local action="$1"
local tmpf=$(mktemp -t xbps-install.XXXXXXXXXX) || exit 1
local fpattern="s|${DESTDIR}||g;s|^\./$||g;/^$/d"
local targets f info_files
local targets f info_files home shell descr groups
case "$action" in
install) ;;
@ -97,10 +97,39 @@ _EOF
fi
fi
#
# Handle system accounts.
#
if [ -n "${system_accounts}" ]; then
_add_trigger system-accounts
echo "export system_accounts=\"${system_accounts}\"" >> $tmpf
for f in ${system_accounts}; do
eval homedir="\$${f}_homedir"
eval shell="\$${f}_shell"
eval descr="\$${f}_descr"
eval groups="\$${f}_groups"
if [ -n "$homedir" ]; then
echo "export ${f}_homedir=\"$homedir\"" >> $tmpf
fi
if [ -n "$shell" ]; then
echo "export ${f}_shell=\"$shell\"" >> $tmpf
fi
if [ -n "$descr" ]; then
echo "export ${f}_descr=\"$descr\"" >> $tmpf
fi
if [ -n "$groups" ]; then
echo "export ${f}_groups=\"${groups}\"" >> $tmpf
fi
unset homedir shell descr groups
done
echo >> $tmpf
fi
#
# Handle OpenRC services.
#
if [ -n "${openrc_services}" ]; then
_add_trigger openrc-service
echo "export openrc_services=\"${openrc_services}\"" >> $tmpf
echo >> $tmpf
fi