aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbackend/magiback11
-rwxr-xr-xbackend/raw_write.py18
-rwxr-xr-xlib/isodumper.py2
3 files changed, 25 insertions, 6 deletions
diff --git a/backend/magiback b/backend/magiback
index 01a730c..e1ec093 100755
--- a/backend/magiback
+++ b/backend/magiback
@@ -38,6 +38,7 @@ class Isodumper(raw_write.Dumper):
</method>
<method name='do_persistence'>
<arg type='s' name='target' direction='in'/>
+ <arg type='s' name='label' direction='in'/>
</method>
<method name='get_sum'>
<arg type='s' name='source' direction='in'/>
@@ -86,10 +87,10 @@ class Isodumper(raw_write.Dumper):
self.return_message = "Access denied"
self.finished.set()
- def do_persistence(self, target):
+ def do_persistence(self, target, label):
self.finished.clear()
if self.writing_perm and self.writing_target == target :
- self._do_persistence(target)
+ self._do_persistence(target, label)
else:
self.return_message = "Access denied"
self.writing_perm = False
@@ -123,10 +124,12 @@ class Isodumper(raw_write.Dumper):
return self._do_unmount([device])
def get_sum(self, source):
- key_thread = threading.Thread(target=self._get_sum, args=(source,))
- key_thread.start()
+ self.key_thread = threading.Thread(target=self._get_sum, args=(source,))
+ self.key_thread.start()
def check_write(self,target, source):
+ if hasattr(self, 'key_thread'):
+ self.key_thread.join()
self.thread = threading.Thread(target=self._check_write, args=(target, source,))
self.thread.start()
diff --git a/backend/raw_write.py b/backend/raw_write.py
index b8f307d..40a7de4 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,24 @@ 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')
+ # exemple mkfs.ext4 -L mgalive-persist /dev/sdf3
+ 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):
diff --git a/lib/isodumper.py b/lib/isodumper.py
index 4d3ca4c..b6e131e 100755
--- a/lib/isodumper.py
+++ b/lib/isodumper.py
@@ -323,7 +323,7 @@ class IsoDumper(object):
# Add persistent partition if asked
if self.persistencecb.value():
self.logger(_("Adding persistent partition"))
- iface.do_persistence(target)
+ iface.do_persistence(target,"mgalive-persist")
self.logger(_("Added persistent partition"))
self.success()
else: