summaryrefslogtreecommitdiff
path: root/setup-user.in
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-07-01 13:57:24 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-07-01 14:08:31 +0200
commit11492f2e2adc07fce1e98e09c88ee518c8b448ac (patch)
tree60a6d706a56390d210774ae0d64b591d1d0cd075 /setup-user.in
parentac908aa749f9854a257f6d4957e1342a4db0e1f9 (diff)
downloadalpine-conf-11492f2e2adc07fce1e98e09c88ee518c8b448ac.zip
setup-user: avoid eternal loop on adduser failure
Make sure we dont loop forever if adduser fails to create the user. fixes https://gitlab.alpinelinux.org/alpine/alpine-conf/-/issues/10519
Diffstat (limited to 'setup-user.in')
-rw-r--r--setup-user.in6
1 files changed, 6 insertions, 0 deletions
diff --git a/setup-user.in b/setup-user.in
index 34a5a38..c39c15b 100644
--- a/setup-user.in
+++ b/setup-user.in
@@ -55,6 +55,10 @@ while true; do
else
suggest=no
fi
+ # dont suggest something that has failed before
+ if [ "$suggest" = "$failed_username" ]; then
+ suggest=
+ fi
ask "Setup a user? (enter a lower-case loginname, or 'no')" $suggest
case "$resp" in
no) exit 0;;
@@ -76,6 +80,8 @@ while true; do
if ! [ -n "$interactive" ]; then
exit 1
fi
+ failed_username="$username"
+ username=
done
if [ -n "$interactive" ] && [ -z "$keysopt" ]; then