summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--setup-user.in10
1 files changed, 8 insertions, 2 deletions
diff --git a/setup-user.in b/setup-user.in
index a94b533..88f28b4 100644
--- a/setup-user.in
+++ b/setup-user.in
@@ -6,7 +6,7 @@ PREFIX=@PREFIX@
usage() {
cat <<-__EOF__
- usage: setup-user [-h] [-f FULLNAME] [-g GROUPS] [-k SSHKEY] [USERNAME]
+ usage: setup-user [-h] [-a] [-u] [-f FULLNAME] [-g GROUPS] [-k SSHKEY] [USERNAME]
Create user account
@@ -17,19 +17,22 @@ usage() {
-g Comma or space separated list of groups to add user to
-k ssh key or URL to ssh key (eg. https://gitlab.alpinelinux.org/user.keys)
or 'none' for no key
+ -u Unlock the user automatically (eg. creating the user non-interactively
+ with an ssh key for login)
If USERNAME is not specified user will be prompted.
__EOF__
exit $1
}
-while getopts "af:g:hk:" opt; do
+while getopts "af:g:hk:u" opt; do
case $opt in
a) admin=1;;
h) usage 0;;
f) fullnameopt="$OPTARG";;
g) groups="$OPTARG";;
k) keysopt="$OPTARG";;
+ u) forceunlock=1;;
'?') usage "1" >&2;;
esac
done
@@ -140,3 +143,6 @@ if [ -n "$admin" ]; then
$MOCK addgroup "$username" "wheel" || exit
fi
+if [ -n "$forceunlock" ]; then
+ $MOCK passwd -u "$username" 2> /dev/null
+fi \ No newline at end of file