Set ${CRYPTED_PASSWORD} for ${USERNAME}

User provides either a clear text ${PASSWORD} or a crypted
${CRYPTED_PASSWORD}.
pull/27/head
Daniel Dehennin 9 years ago
parent bbcadaa59d
commit 1caa2bfb6b

@ -16,7 +16,7 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
[ -n "${PASSWORD}" ] || exit 0
[ -n "${PASSWORD}${CRYPTED_PASSWORD}" ] || exit 0
if [ -z "${USERNAME}" ]
then
@ -29,4 +29,10 @@ then
exit 0
fi
chpasswd <<< "${USERNAME}:${PASSWORD}"
if [ -n "${PASSWORD}" ]
then
chpasswd <<< "${USERNAME}:${PASSWORD}"
elif [ -n "${CRYPTED_PASSWORD}" ]
then
usermod -p "${CRYPTED_PASSWORD}" "${USERNAME}"
fi

Loading…
Cancel
Save