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 # Load common constants. This should be the first executable line. | 10 # Load common constants. This should be the first executable line. |
11 # The path to common.sh should be relative to your script's location. | 11 # The path to common.sh should be relative to your script's location. |
12 . "$(dirname "$0")/common.sh" | 12 . "$(dirname "$0")/common.sh" |
13 | 13 |
14 # Script must be run inside the chroot | 14 # Script must be run inside the chroot |
15 assert_inside_chroot | 15 restart_in_chroot_if_needed $* |
16 | 16 |
17 FLAGS_HELP="USAGE: $0 [flags]" | 17 FLAGS_HELP="USAGE: $0 [flags]" |
18 | 18 |
19 # Parse command line | 19 # Parse command line |
20 FLAGS "$@" || exit 1 | 20 FLAGS "$@" || exit 1 |
21 eval set -- "${FLAGS_ARGV}" | 21 eval set -- "${FLAGS_ARGV}" |
22 | 22 |
23 # Die on any errors. | 23 # Die on any errors. |
24 set -e | 24 set -e |
25 | 25 |
26 # Get password | 26 # Get password |
27 read -p "Enter password for shared user account: " PASSWORD | 27 read -p "Enter password for shared user account: " PASSWORD |
28 | 28 |
29 CRYPTED_PASSWD_FILE=$SCRIPTS_DIR/shared_user_passwd.txt | 29 CRYPTED_PASSWD_FILE=$SCRIPTS_DIR/shared_user_passwd.txt |
30 CRYPTED_PASSWD="$(echo "$PASSWORD" | openssl passwd -1 -stdin)" | 30 CRYPTED_PASSWD="$(echo "$PASSWORD" | openssl passwd -1 -stdin)" |
31 PASSWORD="gone now" | 31 PASSWORD="gone now" |
32 | 32 |
33 echo "$CRYPTED_PASSWD" > $CRYPTED_PASSWD_FILE | 33 echo "$CRYPTED_PASSWD" > $CRYPTED_PASSWD_FILE |
34 | 34 |
35 echo "Shared user password set in $CRYPTED_PASSWD_FILE" | 35 echo "Shared user password set in $CRYPTED_PASSWD_FILE" |
OLD | NEW |