| 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 # Globals | 7 # Globals |
| 8 # ---------------------------------------------------------------------------- | 8 # ---------------------------------------------------------------------------- |
| 9 | 9 |
| 10 # Determine script directory | 10 # Determine script directory |
| 11 SCRIPT_DIR=$(dirname $0) | 11 SCRIPT_DIR=$(dirname $0) |
| 12 PROG=$(basename $0) | 12 PROG=$(basename $0) |
| 13 GPT=cgpt | 13 GPT=cgpt |
| 14 | 14 |
| 15 # The tag when the rootfs is changed. | 15 # The tag when the rootfs is changed. |
| 16 TAG_NEEDS_TO_BE_SIGNED="/root/.need_to_be_signed" | 16 TAG_NEEDS_TO_BE_SIGNED="/root/.need_to_be_signed" |
| 17 | 17 |
| 18 # List of Temporary files and mount points. |
| 19 TEMP_FILE_LIST=$(mktemp) |
| 20 TEMP_DIR_LIST=$(mktemp) |
| 21 |
| 18 # Array of actions that are executed during the clean up process. | 22 # Array of actions that are executed during the clean up process. |
| 19 declare -a cleanup_actions | 23 declare -a cleanup_actions |
| 20 | 24 |
| 21 # Adds an action to be executed during the clean up process. | 25 # Adds an action to be executed during the clean up process. |
| 22 # Actions are executed in the reverse order of when they were added. | 26 # Actions are executed in the reverse order of when they were added. |
| 23 # ARGS: ACTION | 27 # ARGS: ACTION |
| 24 add_cleanup_action() { | 28 add_cleanup_action() { |
| 25 cleanup_actions[${#cleanup_actions[*]}]=$1 | 29 cleanup_actions[${#cleanup_actions[*]}]=$1 |
| 26 } | 30 } |
| 27 | 31 |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 # Check if the 'chronos' user already has a password | 356 # Check if the 'chronos' user already has a password |
| 353 # Args: rootfs | 357 # Args: rootfs |
| 354 no_chronos_password() { | 358 no_chronos_password() { |
| 355 local rootfs=$1 | 359 local rootfs=$1 |
| 356 sudo grep -q '^chronos:\*:' "$rootfs/etc/shadow" | 360 sudo grep -q '^chronos:\*:' "$rootfs/etc/shadow" |
| 357 } | 361 } |
| 358 | 362 |
| 359 trap "cleanup" INT TERM EXIT | 363 trap "cleanup" INT TERM EXIT |
| 360 | 364 |
| 361 add_cleanup_action "cleanup_temps_and_mounts" | 365 add_cleanup_action "cleanup_temps_and_mounts" |
| OLD | NEW |