diff options
| author | Papoteur <papoteur@mageia.org> | 2025-11-08 12:48:53 +0100 |
|---|---|---|
| committer | Papoteur <papoteur@mageia.org> | 2025-12-19 18:53:38 +0100 |
| commit | df07d08294994a0e9cc066df5fe8b13c772ed5bf (patch) | |
| tree | 70dbb325d830aec6b4fc7265df86313130fb905a /backend/raw_write.py | |
| parent | 707709d26dd2dd368707606be6f86e8acc590070 (diff) | |
| download | isodumper-df07d08294994a0e9cc066df5fe8b13c772ed5bf.tar isodumper-df07d08294994a0e9cc066df5fe8b13c772ed5bf.tar.gz isodumper-df07d08294994a0e9cc066df5fe8b13c772ed5bf.tar.bz2 isodumper-df07d08294994a0e9cc066df5fe8b13c772ed5bf.tar.xz isodumper-df07d08294994a0e9cc066df5fe8b13c772ed5bf.zip | |
refact: use rename _do_persistence feature in magiback and use it for format operations.
Diffstat (limited to 'backend/raw_write.py')
| -rwxr-xr-x | backend/raw_write.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/backend/raw_write.py b/backend/raw_write.py index fe21046..7a7ae18 100755 --- a/backend/raw_write.py +++ b/backend/raw_write.py @@ -198,7 +198,7 @@ class Dumper(object): return False return True - def _do_persistence(self, target, label, key, fs_type): + def _do_format(self, target, label, key, fs_type, order=3): logging.debug("Start doing persistence partition") p = Popen(["fdisk", target], stdin=PIPE, stderr=PIPE) # commands: @@ -208,7 +208,7 @@ class Dumper(object): # default first sector # default last sector # w : write and quit - outs, errs = p.communicate(input=b"n\np\n3\n\n\nw\n") + outs, errs = p.communicate(input=b"n\np\n" + bytes(order) + b"\n\n\nw\n") working = True while working: time.sleep(0.5) @@ -266,7 +266,7 @@ class Dumper(object): if key == "": # example mkfs.ext4 -L mgalive-persist /dev/sdf3 self.return_message = _("Additional partition added. Formatting...") - path = target + "3" + path = target + str(order) # Format partition according to the fs_type specified fs_type = fs_type.lower() if fs_type == "fat32": @@ -314,9 +314,9 @@ class Dumper(object): else: # example cryptsetup luksFormat /dev/sdb3 self.return_message = _("Persistent partition added. Encrypting...") - base_target = os.path.basename(target) + "3" + base_target = os.path.basename(target) + str(order) process = Popen( - ["cryptsetup", "luksFormat", "-q", target + "3", "-d", "-"], + ["cryptsetup", "luksFormat", "-q", target + str(order), "-d", "-"], stdin=PIPE, stderr=PIPE, ) @@ -349,7 +349,7 @@ class Dumper(object): [ "cryptsetup", "luksOpen", - target + "3", + target + str(order), "crypt_" + base_target, "-d", "-", |
