mirror of
https://github.com/flatcar/scripts.git
synced 2026-05-04 19:56:32 +02:00
image_to_usb: fix typo in flag checking which eats hard drives
The variable setup is "FLAGS_force_non_usb", not "FLAGS_force_non". Trying to run this currently results in: ./image_to_usb.sh: line 189: [: -ne: unary operator expected Copying USB image .../chromiumos_image.bin to device /dev/sdb... This should have instead errored out: Error: Device /dev/sdb does not appear to be a USB or MMC disk! Without this fix, image_to_usb.sh proceeds to corrupt the non-usb disk (which in my case happened to be a backing store for lvm where all my source was stored and ext4 not surprisingly barfed). BUG=None TEST=`./image_to_usb.sh --board=x86-alex -y --to=/dev/sdb` (where /dev/sdb is a disk) now errors out instead of clobbering data TEST=`./image_to_usb.sh --board=x86-alex -y --to=/dev/sdc` (where /dev/sdc is USB) still works Change-Id: Id691846393c02cf199309495ae2080b15626e684 Reviewed-on: https://gerrit.chromium.org/gerrit/14334 Reviewed-by: Zdenek Behan <zbehan@chromium.org> Reviewed-by: Chris Wolfe <cwolfe@chromium.org> Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
parent
a4856380eb
commit
3e7245a788
@ -186,7 +186,7 @@ if [ -b "${FLAGS_to}" ]; then
|
||||
list_mmc_disks | grep -q '^'${FLAGS_to##*/}'$'; then
|
||||
disk_manufacturer=$(get_disk_info ${FLAGS_to##*/} manufacturer)
|
||||
disk_product=$(get_disk_info ${FLAGS_to##*/} product)
|
||||
elif [ ${FLAGS_force_non} -ne ${FLAGS_TRUE} ]; then
|
||||
elif [ ${FLAGS_force_non_usb} -ne ${FLAGS_TRUE} ]; then
|
||||
# Safeguard against writing to a real non-USB disk or non-SD disk
|
||||
echo "Error: Device ${FLAGS_to} does not appear to be a USB or MMC disk!"
|
||||
echo " To override this safeguard, use the --force_non_usb flag"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user