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

Unified 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, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/scripts/image_to_usb.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/installer/chromeos-common.sh
diff --git a/src/platform/installer/chromeos-common.sh b/src/platform/installer/chromeos-common.sh
index f66158d097c8a73ede98ed6a48f0090e4e310faf..0e84f92a49c70a50f0034bc5b3992888b6c70636 100644
--- a/src/platform/installer/chromeos-common.sh
+++ b/src/platform/installer/chromeos-common.sh
@@ -510,3 +510,26 @@ dont_run_as_root() {
exit 1
fi
}
+
+list_usb_disks() {
+ local sd
+ for sd in /sys/block/sd*; do
+ if readlink ${sd}/device | grep -q usb &&
+ [ "$(cat ${sd}/removable)" = 1 ]; then
+ echo ${sd##*/}
+ fi
+ done
+}
+
+get_disk_info() {
+ # look for a "given" file somewhere in the path upwards from the device
+ local dev_path=/sys/block/${1}/device
+ while [ -d "${dev_path}" -a "${dev_path}" != "/sys" ]; do
+ if [ -f "${dev_path}/${2}" ]; then
+ cat "${dev_path}/${2}"
+ return
+ fi
+ dev_path=$(readlink -f ${dev_path}/..)
+ done
+ echo '[Unknown]'
+}
« 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