set_shared_user_password.sh updates /etc/shared_user_passwd.txt

This is necessary so that the baselayout ebuild can be
changed to set /etc/passwd and /etc/shadow appropriately.
A previous attempt to do this through an environment
variable in make.conf.user failed because pkg_postinst
from binary packages run in their prebuilt environment
(and, thus, are not picking the user specific variables).

BUG=chromium-os:11664
TEST=ran set_shared_user_password.sh multiple times, observed
/etc/shared_user_passwd.txt and shared_user_passwd.txt getting updated.

Change-Id: I23b77c7417db0fd18b251f7cca62027813b182a8

Review URL: http://codereview.chromium.org/6534003
This commit is contained in:
Darin Petkov 2011-02-17 09:34:29 -08:00
parent c5ae0344d2
commit 36e69d0c77

View File

@ -43,10 +43,13 @@ set -e
# Get password
read -p "Enter password for shared user account: " PASSWORD
CRYPTED_PASSWD_FILE=$SCRIPTS_DIR/shared_user_passwd.txt
CRYPTED_PASSWD="$(echo "$PASSWORD" | openssl passwd -1 -stdin)"
PASSWORD="gone now"
echo "$CRYPTED_PASSWD" > $CRYPTED_PASSWD_FILE
CRYPTED_PASSWD_FILE="${SCRIPTS_DIR}/shared_user_passwd.txt"
echo "${CRYPTED_PASSWD}" > "${CRYPTED_PASSWD_FILE}"
echo "Shared user password set in $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}"