summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2017-08-10 11:56:58 +0200
committerRobert Foss <robert.foss@collabora.com>2017-08-10 12:15:21 +0200
commit8058021f639a0a7d566a264b2d8ef03d64f0636b (patch)
treee7e806724c7a29e31b1bdb56e8b8726c5a925552
parente871ac4afdae643b4cd5b39446777f1a56513f48 (diff)
downloadrdu2-master.tar.gz
rdu2-master.tar.xz
sdcard: mmcblk devices require partition prefix, sd devices don'tHEADmaster
Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
-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