1
0
mirror of https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git synced 2025-12-16 03:42:44 +03:00

Add passwd parameter to user-data

This commit is contained in:
Aleksandr Berkuta 2025-05-30 16:30:32 +03:00 committed by Aleksandr Berkuta
parent 0dc24601b2
commit 6c377c76da

View File

@ -243,7 +243,7 @@ in_list() {
init__userdata_users() {
local users="$(get_userdata users)"
for i in $users; do
local name="" gecos="" homedir="" shell="" primary_group="" groups=""
local name="" gecos="" homedir="" shell="" primary_group="" groups="" passwd="" hashed_passwd=""
local system=false no_create_home=false lock_passwd=true
local keys="$(get_userdata users/$i)"
if [ "$i" = 1 ] && [ "$keys" = "default" ]; then
@ -272,6 +272,10 @@ init__userdata_users() {
if in_list no_create_home $keys; then
no_create_home="$(get_userdata users/$i/no_create_home)"
fi
if in_list passwd $keys; then
passwd="$(get_userdata users/$i/passwd)"
echo "${user}:${passwd}" | $MOCK chpasswd -e
fi
if getent passwd "$user" >/dev/null; then
log -i -t "$phase" info "$ACTION: user $user already exists"