Chromium Code Reviews| Index: scripts/image_signing/set_chronos_password.sh |
| diff --git a/scripts/image_signing/customize_image.sh b/scripts/image_signing/set_chronos_password.sh |
| similarity index 63% |
| rename from scripts/image_signing/customize_image.sh |
| rename to scripts/image_signing/set_chronos_password.sh |
| index 08b5bd39c924893ba6b9a94b06303b41f2bf6c1d..6ad8d7a5c8e8c179d53a42fec1da32e5debe3719 100755 |
| --- a/scripts/image_signing/customize_image.sh |
| +++ b/scripts/image_signing/set_chronos_password.sh |
| @@ -4,19 +4,14 @@ |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| -# Customize a Chrome OS release image. The cgpt utility must be on the |
| -# sudo path. |
| -# |
| -# The following changes are applied: |
| -# - Set the root password. |
| +# Customizes a Chrome OS release image by setting the chronos user password. |
| -# Usage: ./customize_image.sh <image.bin> <root_password> |
| +# Usage: ./set_chronos_password.sh <image.bin> <chronos_password> |
|
djmm
2010/08/11 17:35:47
A standard I've been pushing in scripts is to set
petkov
2010/08/11 18:07:27
Done in http://codereview.chromium.org/3164006/sho
|
| # Load common constants and variables. |
| . "$(dirname "$0")/common.sh" |
| readonly ROOTFS_DIR=$(mktemp -d) |
| -readonly GPT=cgpt |
| cleanup() { |
| set +e |
| @@ -30,31 +25,32 @@ failure() { |
| exit 1 |
| } |
| -change_root_password() { |
| +change_chronos_password() { |
| local password=$1 |
| - echo "Changing root password to '$password'..." |
| + echo "Changing chronos password to '$password'..." |
| local crypted_password="$(echo $password | openssl passwd -1 -stdin)" |
| local temp_shadow="$ROOTFS_DIR/etc/tempshadow" |
| - echo "root:$crypted_password:14500:0:::::" \ |
| + echo "chronos:$crypted_password:14500:0:99999::::" \ |
| | sudo tee "$temp_shadow" > /dev/null |
| - grep -Ev ^root: "$ROOTFS_DIR/etc/shadow" \ |
| + grep -Ev ^chronos: "$ROOTFS_DIR/etc/shadow" \ |
| | sudo tee -a "$temp_shadow" > /dev/null |
| sudo mv -f "$temp_shadow" "$ROOTFS_DIR/etc/shadow" |
| } |
| main() { |
| local image=$1 |
| - local root_password=$2 |
| + local chronos_password=$2 |
| if [ $# -ne 2 ]; then |
| - echo "Usage: $0 <image.bin> <root_password>" |
| + echo "Usage: $0 <image.bin> <chronos_password>" |
| exit 1 |
| fi |
| set -e |
| trap failure EXIT |
| mount_image_partition "$image" 3 $ROOTFS_DIR |
| - change_root_password "$root_password" |
| + change_chronos_password "$chronos_password" |
| cleanup |
| + touch "$image" # Updates the image modification time. |
| echo "Done." |
| trap - EXIT |
| } |