diff --git a/pmb/config/__init__.py b/pmb/config/__init__.py
index ca2cead3..ffd90c52 100644
--- a/pmb/config/__init__.py
+++ b/pmb/config/__init__.py
@@ -166,10 +166,6 @@ install_device_packages = [
install_size_image = "835M"
install_size_boot = "100M"
-# fnmatch-patterns, that the sdcard patch must match. Otherwise the
-# installer will refuse to format the device.
-install_valid_sdcard_devices = ["/dev/mmcblk*", "/dev/loop*"]
-
#
# FLASH
diff --git a/pmb/helpers/mount.py b/pmb/helpers/mount.py
index 008bfff0..c8e3ed0a 100644
--- a/pmb/helpers/mount.py
+++ b/pmb/helpers/mount.py
@@ -31,6 +31,8 @@ def ismount(folder):
words = line.split()
if len(words) >= 2 and words[1] == folder:
return True
+ if words[0] == folder:
+ return True
return False
diff --git a/pmb/install/blockdevice.py b/pmb/install/blockdevice.py
index cd6a7a0e..9770a3bd 100644
--- a/pmb/install/blockdevice.py
+++ b/pmb/install/blockdevice.py
@@ -18,6 +18,7 @@ along with pmbootstrap. If not, see .
"""
import logging
import os
+import glob
import pmb.helpers.mount
import pmb.install.losetup
import pmb.helpers.cli
@@ -25,13 +26,6 @@ import pmb.config
import fnmatch
-def sdcard_validate_path(args):
- for pattern in pmb.config.install_valid_sdcard_devices:
- if fnmatch.fnmatch(args.sdcard, pattern):
- return True
- return False
-
-
def mount_sdcard(args):
# Sanity checks
if args.deviceinfo["external_disk_install"] != "true":
@@ -40,9 +34,10 @@ def mount_sdcard(args):
if not os.path.exists(args.sdcard):
raise RuntimeError("The sdcard device does not exist: " +
args.sdcard)
- if not sdcard_validate_path(args):
- raise RuntimeError("The sdcard path does not look valid. We will"
- " not attempt to format this!")
+ for path in glob.glob(args.sdcard + "*"):
+ if pmb.helpers.mount.ismount(path):
+ raise RuntimeError(path + " is mounted! We will not attempt"
+ " to format this!")
if pmb.helpers.cli.ask(args, "EVERYTHING ON " + args.sdcard + " WILL BE"
" ERASED! CONTINUE?") != "y":
raise RuntimeError("Aborted.")
diff --git a/pmb/install/partition.py b/pmb/install/partition.py
index 48c2abea..8736d527 100644
--- a/pmb/install/partition.py
+++ b/pmb/install/partition.py
@@ -16,6 +16,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see .
"""
+import os
import logging
import pmb.chroot
import pmb.config
@@ -30,9 +31,21 @@ def partitions_mount(args):
if not args.sdcard:
img_path = "/home/user/rootfs/" + args.device + ".img"
prefix = pmb.install.losetup.device_by_back_file(args, img_path)
- for suffix in ["p1", "p2"]:
- pmb.helpers.mount.bind_blockdevice(args, prefix + suffix,
- args.work + "/chroot_native/dev/install" + suffix)
+
+ partition_prefix = None
+ for symbol in ["p", ""]:
+ if os.path.exists(prefix + symbol + "1"):
+ partition_prefix = symbol
+ if not partition_prefix:
+ raise RuntimeError("Unable to find the partition prefix,"
+ " expected the first partition of " +
+ prefix + " to be located at " + prefix
+ + "1 or " + prefix + "p1!")
+
+ for i in [1, 2]:
+ source = prefix + partition_prefix + str(i)
+ target = args.work + "/chroot_native/dev/installp" + str(i)
+ pmb.helpers.mount.bind_blockdevice(args, source, target)
def partition(args):