From a3e7fb77d6c8d1a4994b8427b85fa398e2be8bd3 Mon Sep 17 00:00:00 2001 From: Papoteur Date: Fri, 14 Dec 2018 19:18:42 +0100 Subject: Allow writing the label of persistent partition, fixed to "mgalive-persist" --- backend/raw_write.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'backend/raw_write.py') diff --git a/backend/raw_write.py b/backend/raw_write.py index b8f307d..d714932 100755 --- a/backend/raw_write.py +++ b/backend/raw_write.py @@ -33,6 +33,7 @@ import gettext from subprocess import call, Popen, PIPE import hashlib import gnupg +import time class Dumper(object): @@ -221,9 +222,25 @@ class Dumper(object): self.return_state = True self.finished.set() - def _do_persistence(self, target): + def _do_persistence(self, target, label): p = Popen(["fdisk",target], stdin = PIPE) p.communicate(input=b'n\np\n3\n\n\nw\n') + # mkfs.ext4 -L mgalive-persist /dev/sdf3 + print("Partition crée") + process = Popen(['mkfs.ext4','-L', label, target+"3"]) + working=True + while working: + time.sleep(0.5) + process.poll() + rc=process.returncode + if rc is None: + working=True + else: + process = None + working= False + print(rc) + return rc + def __init__(self): -- cgit v1.2.1