Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(539)

Unified Diff: set_shared_user_password.sh

Issue 6539019: Move crypted passwd file to /etc in build_image. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git@master
Patch Set: just copy for now to ensure customize_rootfs works Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build_image ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: set_shared_user_password.sh
diff --git a/set_shared_user_password.sh b/set_shared_user_password.sh
index 72d0ab06889e6e69313a055f18567b40941b4d5d..1ec80b5aa9bcef939bd80f605061487f73d21a2b 100755
--- a/set_shared_user_password.sh
+++ b/set_shared_user_password.sh
@@ -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}"
« no previous file with comments | « build_image ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698