OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # Script to set the password for the shared user account. Stores the | 7 # Script to set the password for the shared user account. Stores the |
8 # MD5crypt'd password to a file, for use by customize_rootfs.sh. | 8 # MD5crypt'd password to a file, for use by customize_rootfs.sh. |
9 | 9 |
10 # --- BEGIN COMMON.SH BOILERPLATE --- | 10 # --- BEGIN COMMON.SH BOILERPLATE --- |
(...skipping 25 matching lines...) Expand all Loading... |
36 # Parse command line | 36 # Parse command line |
37 FLAGS "$@" || exit 1 | 37 FLAGS "$@" || exit 1 |
38 eval set -- "${FLAGS_ARGV}" | 38 eval set -- "${FLAGS_ARGV}" |
39 | 39 |
40 # Die on any errors. | 40 # Die on any errors. |
41 set -e | 41 set -e |
42 | 42 |
43 # Get password | 43 # Get password |
44 read -p "Enter password for shared user account: " PASSWORD | 44 read -p "Enter password for shared user account: " PASSWORD |
45 | 45 |
46 CRYPTED_PASSWD_FILE=$SCRIPTS_DIR/shared_user_passwd.txt | |
47 CRYPTED_PASSWD="$(echo "$PASSWORD" | openssl passwd -1 -stdin)" | 46 CRYPTED_PASSWD="$(echo "$PASSWORD" | openssl passwd -1 -stdin)" |
48 PASSWORD="gone now" | 47 PASSWORD="gone now" |
49 | 48 |
50 echo "$CRYPTED_PASSWD" > $CRYPTED_PASSWD_FILE | 49 CRYPTED_PASSWD_FILE="${SCRIPTS_DIR}/shared_user_passwd.txt" |
| 50 echo "${CRYPTED_PASSWD}" > "${CRYPTED_PASSWD_FILE}" |
51 | 51 |
52 echo "Shared user password set in $CRYPTED_PASSWD_FILE" | 52 SHARED_USER_PASSWD_FILE="/etc/shared_user_passwd.txt" |
| 53 echo "${CRYPTED_PASSWD}" | sudo_clobber "${SHARED_USER_PASSWD_FILE}" |
| 54 |
| 55 echo "Password set in ${CRYPTED_PASSWD_FILE} and ${SHARED_USER_PASSWD_FILE}" |
OLD | NEW |