xbps-triggers: set homedir of disabled accounts to /var/empty

This commit is contained in:
Cameron Nemo 2018-11-23 22:20:41 -08:00 committed by maxice8
parent 4979ea9237
commit 5abdf75173
3 changed files with 11 additions and 9 deletions

View File

@ -1719,8 +1719,9 @@ anything unless it is defined.
The system-accounts trigger is responsible for creating and disabling system accounts The system-accounts trigger is responsible for creating and disabling system accounts
and groups. and groups.
During removal it will disable the account by setting the Shell to /bin/false and appending During removal it will disable the account by setting the Shell to /bin/false,
' - for uninstalled package $pkgname' to the Description. Home to /var/empty, and appending ' - for uninstalled package $pkgname' to the
Description.
Example: `transmission unprivileged user - for uninstalled package transmission` Example: `transmission unprivileged user - for uninstalled package transmission`
This trigger can only be used by using the `system_accounts` variable. This trigger can only be used by using the `system_accounts` variable.

View File

@ -122,11 +122,12 @@ run)
echo "WARNING: cannot update ${acct} system user/group (missing usermod)" echo "WARNING: cannot update ${acct} system user/group (missing usermod)"
continue continue
fi fi
usermod -c "${descr}" -s "${shell}" ${_uname} >/dev/null 2>&1 usermod -c "${descr}" -d "${homedir}" -s "${shell}" ${user_groups} \
-g "${pgroup:-${_uname}}" ${_uname} >/dev/null 2>&1
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Updated shell and comment for ${_uname} (${_uid}) system user." echo "Updated ${_uname} (${_uid}) system user."
else else
echo "Failed to update shell and comment for ${acct} system user!" echo "Failed to update ${acct} system user!"
exit 1 exit 1
fi fi
fi fi
@ -142,7 +143,7 @@ run)
echo "WARNING: cannot disable ${acct} system user/group (missing usermod)" echo "WARNING: cannot disable ${acct} system user/group (missing usermod)"
continue continue
fi fi
usermod -L -s /bin/false -c "${comment}" ${_uname} >/dev/null 2>&1 usermod -L -d /var/empty -s /bin/false -c "${comment}" ${_uname} >/dev/null 2>&1
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Disabled ${_uname} (${_uid}) system user/group." echo "Disabled ${_uname} (${_uid}) system user/group."
fi fi

View File

@ -1,13 +1,13 @@
# Template file for 'xbps-triggers' # Template file for 'xbps-triggers'
pkgname=xbps-triggers pkgname=xbps-triggers
version=0.110 version=0.111
revision=1 revision=1
noarch=yes noarch=yes
bootstrap=yes bootstrap=yes
short_desc="The XBPS triggers for Void Linux" short_desc="The XBPS triggers for Void Linux"
maintainer="Juan RP <xtraeme@voidlinux.eu>" maintainer="Juan RP <xtraeme@voidlinux.eu>"
homepage="http://www.voidlinux.eu" homepage="https://voidlinux.org"
license="Simplified BSD" license="BSD-2-clause"
do_install() { do_install() {
_triggersdir=usr/libexec/${pkgname} _triggersdir=usr/libexec/${pkgname}