xbps-triggers: system-accounts: accept acct:uid.

This commit is contained in:
Juan RP 2014-07-30 11:06:39 +02:00
parent 469e290c28
commit ee8504eeae
2 changed files with 11 additions and 5 deletions

View file

@ -83,6 +83,10 @@ run)
# System user/group required by a package. # System user/group required by a package.
for acct in ${system_accounts}; do for acct in ${system_accounts}; do
_uname="${acct%:*}"
_uid="${acct#*:}"
[ "${_uid}" != "${_uname}" ] && use_id="-r ${_uid}"
if [ ! -x "$USERADD" ]; then if [ ! -x "$USERADD" ]; then
echo "WARNING: cannot create ${acct} system user/group (missing useradd)" echo "WARNING: cannot create ${acct} system user/group (missing useradd)"
continue continue
@ -99,9 +103,9 @@ run)
group_add $acct group_add $acct
if ! $GETENT passwd ${acct} >/dev/null; then if ! $GETENT passwd ${acct} >/dev/null; then
$USERADD -c "$descr" -d "$homedir" \ $USERADD -c "$descr" -d "$homedir" ${use_id} \
-s "$shell" -g ${acct} $user_groups \ -s "$shell" -g ${_uname} $user_groups \
-r ${acct} && \ -r ${_uname} && \
$PASSWD -l ${acct} >/dev/null 2>&1 $PASSWD -l ${acct} >/dev/null 2>&1
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Created ${acct} system user." echo "Created ${acct} system user."
@ -118,11 +122,13 @@ run)
# #
if [ "$UPDATE" = "no" ]; then if [ "$UPDATE" = "no" ]; then
for acct in ${system_accounts}; do for acct in ${system_accounts}; do
_uname="${acct%:*}"
_uid="${acct#*:}"
if [ ! -x "$USERDEL" ]; then if [ ! -x "$USERDEL" ]; then
echo "WARNING: cannot remove ${acct} system user/group (missing userdel)" echo "WARNING: cannot remove ${acct} system user/group (missing userdel)"
continue continue
fi fi
$USERDEL ${acct} >/dev/null 2>&1 $USERDEL ${_uname} >/dev/null 2>&1
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Removed ${acct} system user/group." echo "Removed ${acct} system user/group."
fi fi

View file

@ -1,6 +1,6 @@
# Template file for 'xbps-triggers' # Template file for 'xbps-triggers'
pkgname=xbps-triggers pkgname=xbps-triggers
version=0.80 version=0.81
revision=1 revision=1
noarch=yes noarch=yes
bootstrap=yes bootstrap=yes