mirror of
https://github.com/flatcar/scripts.git
synced 2025-12-07 18:31:54 +01:00
Move crypted passwd file to /etc in build_image.
This temporary hack is intended to provide to developers a smooth transition to the new crypted password file location. BUG=chromium-os:11664 TEST=build_image Change-Id: I34383f6e08ee8db53e407b30df604c403c72b5eb Review URL: http://codereview.chromium.org/6539019
This commit is contained in:
parent
60a5ce0751
commit
ab463c0844
@ -139,6 +139,10 @@ check_blacklist() {
|
||||
|
||||
check_blacklist
|
||||
|
||||
# TODO(petkov): Remove along with the --move_to_etc flag support once the
|
||||
# transition dust settles.
|
||||
"${SCRIPTS_DIR}"/set_shared_user_password.sh --move_to_etc
|
||||
|
||||
# Verify user didn't specify incompatible flags for dev install shim
|
||||
if [ "${FLAGS_factory_install}" -eq "${FLAGS_TRUE}" ] &&
|
||||
[ "${FLAGS_dev_install}" -eq "${FLAGS_TRUE}" ] ; then
|
||||
|
||||
@ -33,6 +33,11 @@ restart_in_chroot_if_needed "$@"
|
||||
|
||||
FLAGS_HELP="USAGE: $0 [flags]"
|
||||
|
||||
# TODO(petkov): This flag and setting of src/scripts/shared_user_passwd.txt can
|
||||
# go away once the transition dust settles.
|
||||
DEFINE_boolean move_to_etc ${FLAGS_FALSE} \
|
||||
"Move src/scripts/shared_user_passwd.txt to /etc."
|
||||
|
||||
# Parse command line
|
||||
FLAGS "$@" || exit 1
|
||||
eval set -- "${FLAGS_ARGV}"
|
||||
@ -40,16 +45,23 @@ eval set -- "${FLAGS_ARGV}"
|
||||
# Die on any errors.
|
||||
set -e
|
||||
|
||||
CRYPTED_PASSWD_FILE="${SCRIPTS_DIR}/shared_user_passwd.txt"
|
||||
SHARED_USER_PASSWD_FILE="/etc/shared_user_passwd.txt"
|
||||
|
||||
if [ ${FLAGS_move_to_etc} -eq ${FLAGS_TRUE} ]; then
|
||||
if [ -r "${CRYPTED_PASSWD_FILE}" ]; then
|
||||
cat "${CRYPTED_PASSWD_FILE}" | sudo_clobber "${SHARED_USER_PASSWD_FILE}"
|
||||
echo "Copied ${CRYPTED_PASSWD_FILE} to ${SHARED_USER_PASSWD_FILE}."
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Get password
|
||||
read -p "Enter password for shared user account: " PASSWORD
|
||||
|
||||
CRYPTED_PASSWD="$(echo "$PASSWORD" | openssl passwd -1 -stdin)"
|
||||
PASSWORD="gone now"
|
||||
|
||||
CRYPTED_PASSWD_FILE="${SCRIPTS_DIR}/shared_user_passwd.txt"
|
||||
echo "${CRYPTED_PASSWD}" > "${CRYPTED_PASSWD_FILE}"
|
||||
|
||||
SHARED_USER_PASSWD_FILE="/etc/shared_user_passwd.txt"
|
||||
echo "${CRYPTED_PASSWD}" | sudo_clobber "${SHARED_USER_PASSWD_FILE}"
|
||||
|
||||
echo "Password set in ${CRYPTED_PASSWD_FILE} and ${SHARED_USER_PASSWD_FILE}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user