Commit 9912db89 authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Make ChangePassword task always respect USERS var

Only the users defined by SNF_IMAGE_PROPERTY_USERS var will have their
passwords changed by ChangePassword task.
parent d984217b
......@@ -31,12 +31,18 @@ windows_password() {
local target="$1"
local password="$2"
echo -n "Installing new admin password..."
echo "@echo off" > "$target/Windows/SnfScripts/ChangeAdminPassword.cmd"
echo "net user Administrator $password" >> \
"$target/Windows/SnfScripts/ChangeAdminPassword.cmd"
echo done
if [ -z "$SNF_IMAGE_PROPERTY_USERS" ]; then
SNF_IMAGE_PROPERTY_USERS="Administrator"
fi
for usr in $SNF_IMAGE_PROPERTY_USERS; do
echo -n "Installing new password for user \`$usr'..."
echo "net user $usr $password" >> \
"$target/Windows/SnfScripts/ChangeAdminPassword.cmd"
echo done
done
}
linux_password() {
......@@ -86,6 +92,9 @@ if [ -z "$SNF_IMAGE_PASSWORD" ]; then
log_error "Password is missing"
fi
#trim users var
SNF_IMAGE_PROPERTY_USERS=$(echo $SNF_IMAGE_PROPERTY_USERS)
if [ "$SNF_IMAGE_PROPERTY_OSFAMILY" = "windows" ]; then
windows_password "$SNF_IMAGE_TARGET" "$SNF_IMAGE_PASSWORD"
elif [ "$SNF_IMAGE_PROPERTY_OSFAMILY" = "linux" ]; then
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment