Add flash.sh script
This script simplifies the process of erasing the target disk and flashing `sdcard.img` onto it.
This commit is contained in:
20
flash.sh
Executable file
20
flash.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
# vim: set sw=4 ts=4 sts=4 et :
|
||||
|
||||
dev=$(readlink -f "$1")
|
||||
wipefs -fa "${dev}"
|
||||
pv images/sdcard.img \
|
||||
| dd of="${dev}" bs=1M conv=sparse oflag=sync
|
||||
sync; sync; sync
|
||||
sleep 1
|
||||
for p in /sys/class/block/${dev##*/}/*/partition; do
|
||||
[ -f "${p}" ] || continue
|
||||
case $(cat "${p}") in
|
||||
1|2)
|
||||
;;
|
||||
*)
|
||||
p=${p%/*}
|
||||
wipefs -fa /dev/${p##*/}
|
||||
;;
|
||||
esac
|
||||
done
|
||||
Reference in New Issue
Block a user