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

Side by Side Diff: set_shared_user_password.sh

Issue 6240018: This starts to fix the scripts so that they load from /usr/lib/crosutils (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: fixing bad merge 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « run_remote_tests.sh ('k') | ssh_test.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 # --- BEGIN COMMON.SH BOILERPLATE ---
11 # The path to common.sh should be relative to your script's location. 11 # Load common CrOS utilities. Inside the chroot this file is installed in
12 . "$(dirname "$0")/common.sh" 12 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's
13 # location.
14 find_common_sh() {
15 local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")"))
16 local path
17
18 SCRIPT_ROOT=
19 for path in "${common_paths[@]}"; do
20 if [ -r "${path}/common.sh" ]; then
21 SCRIPT_ROOT=${path}
22 break
23 fi
24 done
25 }
26
27 find_common_sh
28 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1)
29 # --- END COMMON.SH BOILERPLATE ---
13 30
14 # Script must be run inside the chroot 31 # Script must be run inside the chroot
15 restart_in_chroot_if_needed $* 32 restart_in_chroot_if_needed "$@"
16 33
17 FLAGS_HELP="USAGE: $0 [flags]" 34 FLAGS_HELP="USAGE: $0 [flags]"
18 35
19 # Parse command line 36 # Parse command line
20 FLAGS "$@" || exit 1 37 FLAGS "$@" || exit 1
21 eval set -- "${FLAGS_ARGV}" 38 eval set -- "${FLAGS_ARGV}"
22 39
23 # Die on any errors. 40 # Die on any errors.
24 set -e 41 set -e
25 42
26 # Get password 43 # Get password
27 read -p "Enter password for shared user account: " PASSWORD 44 read -p "Enter password for shared user account: " PASSWORD
28 45
29 CRYPTED_PASSWD_FILE=$SCRIPTS_DIR/shared_user_passwd.txt 46 CRYPTED_PASSWD_FILE=$SCRIPTS_DIR/shared_user_passwd.txt
30 CRYPTED_PASSWD="$(echo "$PASSWORD" | openssl passwd -1 -stdin)" 47 CRYPTED_PASSWD="$(echo "$PASSWORD" | openssl passwd -1 -stdin)"
31 PASSWORD="gone now" 48 PASSWORD="gone now"
32 49
33 echo "$CRYPTED_PASSWD" > $CRYPTED_PASSWD_FILE 50 echo "$CRYPTED_PASSWD" > $CRYPTED_PASSWD_FILE
34 51
35 echo "Shared user password set in $CRYPTED_PASSWD_FILE" 52 echo "Shared user password set in $CRYPTED_PASSWD_FILE"
OLDNEW
« no previous file with comments | « run_remote_tests.sh ('k') | ssh_test.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698