Add flash.sh script
This script simplifies the process of erasing the target disk and flashing `sdcard.img` onto it.gentoo
parent
b312649a50
commit
8e3d87cf45
|
@ -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
|
Loading…
Reference in New Issue