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

Side by Side Diff: src/platform/installer/chromeos-common.sh

Issue 2269003: Add more safeguards to image_to_usb.sh. List USB drives if --to is omitted (Closed) Base URL: ssh://gitrw.chromium.org/chromiumos
Patch Set: Clean up style consistency Created 10 years, 6 months 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
« no previous file with comments | « no previous file | src/scripts/image_to_usb.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 # 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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 # The scripts that source this file typically want to use the root password as 503 # The scripts that source this file typically want to use the root password as
504 # confirmation, unless the --run_as_root flag is given. 504 # confirmation, unless the --run_as_root flag is given.
505 dont_run_as_root() { 505 dont_run_as_root() {
506 if [ $(id -u) -eq "0" -a "${FLAGS_run_as_root}" -eq "${FLAGS_FALSE}" ] 506 if [ $(id -u) -eq "0" -a "${FLAGS_run_as_root}" -eq "${FLAGS_FALSE}" ]
507 then 507 then
508 echo "Note: You must be the 'chronos' user to run this script. Unless" 508 echo "Note: You must be the 'chronos' user to run this script. Unless"
509 echo "you pass --run_as_root and run as root." 509 echo "you pass --run_as_root and run as root."
510 exit 1 510 exit 1
511 fi 511 fi
512 } 512 }
513
514 list_usb_disks() {
515 local sd
516 for sd in /sys/block/sd*; do
517 if readlink ${sd}/device | grep -q usb &&
518 [ "$(cat ${sd}/removable)" = 1 ]; then
519 echo ${sd##*/}
520 fi
521 done
522 }
523
524 get_disk_info() {
525 # look for a "given" file somewhere in the path upwards from the device
526 local dev_path=/sys/block/${1}/device
527 while [ -d "${dev_path}" -a "${dev_path}" != "/sys" ]; do
528 if [ -f "${dev_path}/${2}" ]; then
529 cat "${dev_path}/${2}"
530 return
531 fi
532 dev_path=$(readlink -f ${dev_path}/..)
533 done
534 echo '[Unknown]'
535 }
OLDNEW
« no previous file with comments | « no previous file | src/scripts/image_to_usb.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698