OLD | NEW |
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 # | 4 # |
5 # This contains common constants and functions for installer scripts. This must | 5 # This contains common constants and functions for installer scripts. This must |
6 # evaluate properly for both /bin/bash and /bin/sh, since it's used both to | 6 # evaluate properly for both /bin/bash and /bin/sh, since it's used both to |
7 # create the initial image at compile time and to install or upgrade a running | 7 # create the initial image at compile time and to install or upgrade a running |
8 # image. | 8 # image. |
9 | 9 |
10 # Here are the GUIDs we'll be using to identify various partitions. NOTE: The | 10 # Here are the GUIDs we'll be using to identify various partitions. NOTE: The |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 if [ -x "$MKIMAGE" ]; then | 479 if [ -x "$MKIMAGE" ]; then |
480 MBR_SCRIPT_UIMG="${MBR_SCRIPT}.uimg" | 480 MBR_SCRIPT_UIMG="${MBR_SCRIPT}.uimg" |
481 "$MKIMAGE" -A "arm" -O linux -T script -a 0 -e 0 -n "COS boot" \ | 481 "$MKIMAGE" -A "arm" -O linux -T script -a 0 -e 0 -n "COS boot" \ |
482 -d ${MBR_SCRIPT} ${MBR_SCRIPT_UIMG} >&2 | 482 -d ${MBR_SCRIPT} ${MBR_SCRIPT_UIMG} >&2 |
483 else | 483 else |
484 echo "Error: u-boot mkimage not found or not executable." >&2 | 484 echo "Error: u-boot mkimage not found or not executable." >&2 |
485 exit 1 | 485 exit 1 |
486 fi | 486 fi |
487 echo ${MBR_SCRIPT_UIMG} | 487 echo ${MBR_SCRIPT_UIMG} |
488 } | 488 } |
| 489 |
| 490 |
| 491 # The scripts that source this file typically want to use the root password as |
| 492 # confirmation, unless the --run_as_root flag is given. |
| 493 dont_run_as_root() { |
| 494 if [ $(id -u) -eq "0" -a "${FLAGS_run_as_root}" -eq "${FLAGS_FALSE}" ] |
| 495 then |
| 496 echo "Note: You must be the 'chronos' user to run this script. Unless" |
| 497 echo "you pass --run_as_root and run as root." |
| 498 exit 1 |
| 499 fi |
| 500 } |
OLD | NEW |