Skip to content
This repository was archived by the owner on Jan 16, 2024. It is now read-only.

Commit 12ee268

Browse files
committed
Merge pull request #27 from baby-gnu/feature/set-user-crypted-password
Set ${CRYPTED_PASSWORD} for ${USERNAME}
2 parents bbcadaa + 1caa2bf commit 12ee268

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

base/etc/one-context.d/10-set-username-password

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# limitations under the License. #
1717
#--------------------------------------------------------------------------- #
1818

19-
[ -n "${PASSWORD}" ] || exit 0
19+
[ -n "${PASSWORD}${CRYPTED_PASSWORD}" ] || exit 0
2020

2121
if [ -z "${USERNAME}" ]
2222
then
@@ -29,4 +29,10 @@ then
2929
exit 0
3030
fi
3131

32-
chpasswd <<< "${USERNAME}:${PASSWORD}"
32+
if [ -n "${PASSWORD}" ]
33+
then
34+
chpasswd <<< "${USERNAME}:${PASSWORD}"
35+
elif [ -n "${CRYPTED_PASSWORD}" ]
36+
then
37+
usermod -p "${CRYPTED_PASSWORD}" "${USERNAME}"
38+
fi

0 commit comments

Comments
 (0)