mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-11-24 20:05:41 +01:00
fix #1617 (useradd: user 'audiobookshelf' already exists)
This change fixes the problem of failing upgrades on dpkg-based systems by reworking the check for whether the `audiobookshelf` user/group already exists.
This commit is contained in:
parent
2592467d09
commit
797dba2448
@ -22,7 +22,7 @@ add_user() {
|
|||||||
declare -r descr="${4:-No description}"
|
declare -r descr="${4:-No description}"
|
||||||
declare -r shell="${5:-/bin/false}"
|
declare -r shell="${5:-/bin/false}"
|
||||||
|
|
||||||
if ! getent passwd | grep -q "^$user:"; then
|
if ! getent passwd "$user" 2>&1 >/dev/null; then
|
||||||
echo "Creating system user: $user in $group with $descr and shell $shell"
|
echo "Creating system user: $user in $group with $descr and shell $shell"
|
||||||
useradd $uid_flags --gid $group --no-create-home --system --shell $shell -c "$descr" $user
|
useradd $uid_flags --gid $group --no-create-home --system --shell $shell -c "$descr" $user
|
||||||
fi
|
fi
|
||||||
@ -39,7 +39,7 @@ add_group() {
|
|||||||
declare -r gid_flags="--gid $gid"
|
declare -r gid_flags="--gid $gid"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! getent group | grep -q "^$group:" ; then
|
if ! getent group "$group" 2>&1 >/dev/null; then
|
||||||
echo "Creating system group: $group"
|
echo "Creating system group: $group"
|
||||||
groupadd $gid_flags --system $group
|
groupadd $gid_flags --system $group
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user