OLD | NEW |
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 Loading... |
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 |
OLD | NEW |