From db6491c679237df1e56db5fe532b9553f6140589 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Wed, 30 Aug 2017 18:58:51 +0000 Subject: [PATCH] Fix #475: Retry finding the install partitions (#479) --- pmb/install/partition.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/pmb/install/partition.py b/pmb/install/partition.py index 0fbd5946..c9d12475 100644 --- a/pmb/install/partition.py +++ b/pmb/install/partition.py @@ -16,8 +16,9 @@ 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 os +import time import pmb.chroot import pmb.config import pmb.install.losetup @@ -33,9 +34,17 @@ def partitions_mount(args): prefix = pmb.install.losetup.device_by_back_file(args, img_path) partition_prefix = None - for symbol in ["p", ""]: - if os.path.exists(prefix + symbol + "1"): - partition_prefix = symbol + tries = 20 + for i in range(tries): + for symbol in ["p", ""]: + if os.path.exists(prefix + symbol + "1"): + partition_prefix = symbol + if partition_prefix is not None: + break + logging.debug("NOTE: (" + str(i + 1) + "/" + str(tries) + ") failed to find" + " the install partition. Retrying...") + time.sleep(0.1) + if partition_prefix is None: raise RuntimeError("Unable to find the partition prefix," " expected the first partition of " +