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

Side by Side Diff: scripts/image_signing/common.sh

Issue 4480001: Refuse to change the chronos password if already set unless explicitly asked. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git@master
Patch Set: review fixes Created 10 years, 1 month 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 | « no previous file | scripts/image_signing/set_chronos_password.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) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 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 # Determine script directory 7 # Determine script directory
8 SCRIPT_DIR=$(dirname $0) 8 SCRIPT_DIR=$(dirname $0)
9 PROG=$(basename $0) 9 PROG=$(basename $0)
10 GPT=cgpt 10 GPT=cgpt
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 local ro_compat_offset=$((0x464 + 3)) # Set 'highest' byte 231 local ro_compat_offset=$((0x464 + 3)) # Set 'highest' byte
232 local ro_value=$(sudo dd if="$rootfs" skip=$((offset + ro_compat_offset)) \ 232 local ro_value=$(sudo dd if="$rootfs" skip=$((offset + ro_compat_offset)) \
233 count=1 bs=1 2>/dev/null) 233 count=1 bs=1 2>/dev/null)
234 local expected_ro_value=$(printf '\377') 234 local expected_ro_value=$(printf '\377')
235 if [ "$ro_value" = "$expected_ro_value" ]; then 235 if [ "$ro_value" = "$expected_ro_value" ]; then
236 return 0 236 return 0
237 fi 237 fi
238 return 1 238 return 1
239 } 239 }
240 240
241 # Check if the 'chronos' user already has a password
242 # ARGS: rootfs
243 no_chronos_password() {
244 local rootfs=$1
245 sudo grep -q '^chronos:\*:' "$rootfs/etc/shadow"
246 }
247
241 trap "cleanup_temps_and_mounts" EXIT 248 trap "cleanup_temps_and_mounts" EXIT
242 249
OLDNEW
« no previous file with comments | « no previous file | scripts/image_signing/set_chronos_password.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698