summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsetup_sdcard.sh15
1 files changed, 10 insertions, 5 deletions
diff --git a/setup_sdcard.sh b/setup_sdcard.sh
index feec35a..d15d778 100755
--- a/setup_sdcard.sh
+++ b/setup_sdcard.sh
@@ -36,6 +36,11 @@ if ! [[ -a $DEV ]]; then
print_help
fi
+# E.g.:
+# on mmcblk0, we have mmcblk0p1, mmcblk0p2...
+# on sdb, we have sdb1, sdb2...
+[[ $(basename $DEV) = "mmcblk"* ]] && PPREFIX="p"
+
sudo umount ${DEV}*
(
# Create a new empty DOS partition table
@@ -73,10 +78,10 @@ sudo umount ${DEV}*
# Refresh partition lists for devices
sudo partprobe
-sudo mkfs.vfat -F 32 "${DEV}p1"
-sudo fatlabel "${DEV}p1" BOOT
+sudo mkfs.vfat -F 32 "${DEV}${PPREFIX}1"
+sudo fatlabel "${DEV}${PPREFIX}1" BOOT
-sudo mkfs.ext4 "${DEV}p2" -F -L system
-sudo mkfs.ext4 "${DEV}p3" -F -L cache
-sudo mkfs.ext4 "${DEV}p4" -F -L data
+sudo mkfs.ext4 "${DEV}${PPREFIX}2" -F -L system
+sudo mkfs.ext4 "${DEV}${PPREFIX}3" -F -L cache
+sudo mkfs.ext4 "${DEV}${PPREFIX}4" -F -L data
sync