Inverse userdel(1) calls in scripts/web-add.sh

When a user has the same name as his primary group, userdel(1) tries
to remove it as well, but stops and prints an error message if that
group is being used by any other users as their primary group. By
deleting the www user first, the group is properly deleted. This
means we can get rid of the subsequent call to groupdel(1).

Tested by adding / removing a vhost on my testing vm.
This commit is contained in:
Patrick Marchand 2018-11-14 15:43:45 -05:00 committed by Gitea
parent 547235ea7e
commit 5fe9762c53

View file

@ -592,14 +592,13 @@ op_del() {
read -r
set -x
userdel "$login"
if [ "$WEB_SERVER" == "apache" ]; then
userdel www-"$login"
fi
groupdel "$login"
userdel "$login"
for php_version in "${PHP_VERSIONS[@]}"; do
lxc-attach -n php"${php_version}" -- userdel -f "$login"
lxc-attach -n php"${php_version}" -- userdel -f www-"$login"
lxc-attach -n php"${php_version}" -- userdel -f "$login"
done
sed -i.bak "/^$login:/d" /etc/aliases
if [ "$WEB_SERVER" == "apache" ]; then