summaryrefslogtreecommitdiff
path: root/setup-user.in
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-05-19 19:11:29 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2022-05-19 19:26:54 +0000
commit41a5ddd15079bf0f75100335bb163ba629b70eae (patch)
tree45fd08878ed237ca350638a58327b82ec0abc491 /setup-user.in
parent2425a623a2437d21bbc176e9f72cd1523bc47486 (diff)
downloadalpine-conf-41a5ddd15079bf0f75100335bb163ba629b70eae.zip
setup-user: suggest a username
use first char in first name and all last name, in lower case as suggested user name.
Diffstat (limited to 'setup-user.in')
-rw-r--r--setup-user.in3
1 files changed, 2 insertions, 1 deletions
diff --git a/setup-user.in b/setup-user.in
index 789ff84..4c900a9 100644
--- a/setup-user.in
+++ b/setup-user.in
@@ -52,7 +52,8 @@ fi
if [ -n "$interactive" ] && [ -z "$username" ]; then
while true; do
- ask "Enter username for $fullname:"
+ ask "Enter username for $fullname" \
+ $(echo "$fullname" | sed -E 's/^(.).*\s+(.*)/\1\2/' | tr '[:upper:]' '[:lower:]')
username="$resp"
if [ -n "$fullname" ]; then
$MOCK adduser -g "$fullname" $nopassword "$username" && break