diff options
author | root <root@YZenbook.local> | 2018-12-13 18:54:35 +0100 |
---|---|---|
committer | root <root@YZenbook.local> | 2018-12-13 18:54:35 +0100 |
commit | 790b0c624000b023d18f32aaa3387de36e24a7ec (patch) | |
tree | 3893e44531c3db30ec8af3f18cbe50e7a7e7b560 /backend | |
parent | 67d4650d78c1270a02bcaae65a7005da080c48a8 (diff) | |
download | isodumper-790b0c624000b023d18f32aaa3387de36e24a7ec.tar isodumper-790b0c624000b023d18f32aaa3387de36e24a7ec.tar.gz isodumper-790b0c624000b023d18f32aaa3387de36e24a7ec.tar.bz2 isodumper-790b0c624000b023d18f32aaa3387de36e24a7ec.tar.xz isodumper-790b0c624000b023d18f32aaa3387de36e24a7ec.zip |
Add operations for persistent partition creation
Diffstat (limited to 'backend')
-rwxr-xr-x | backend/magiback | 17 | ||||
-rwxr-xr-x | backend/raw_write.py | 7 |
2 files changed, 23 insertions, 1 deletions
diff --git a/backend/magiback b/backend/magiback index 904afcf..01a730c 100755 --- a/backend/magiback +++ b/backend/magiback @@ -36,6 +36,9 @@ class Isodumper(raw_write.Dumper): <arg type='s' name='target' direction='in'/> <arg type='s' name='source' direction='in'/> </method> + <method name='do_persistence'> + <arg type='s' name='target' direction='in'/> + </method> <method name='get_sum'> <arg type='s' name='source' direction='in'/> </method> @@ -67,6 +70,9 @@ class Isodumper(raw_write.Dumper): self.sum_check = "" self.sum_check_searched = False self.signature_checked = False + self.writing_perm = False + self.writing_target = "" + def do_write(self,source, target, size, dbus_context): self.finished.clear() @@ -74,10 +80,21 @@ class Isodumper(raw_write.Dumper): self.thread = threading.Thread(target=self._do_write, args=(source, target, size, )) self.thread.start() logging.debug("Writing thread started") + self.writing_perm = True + self.writing_target = target else: self.return_message = "Access denied" self.finished.set() + def do_persistence(self, target): + self.finished.clear() + if self.writing_perm and self.writing_target == target : + self._do_persistence(target) + else: + self.return_message = "Access denied" + self.writing_perm = False + self.writing_target = "" + @property def done(self): return self.finished.wait(1) diff --git a/backend/raw_write.py b/backend/raw_write.py index d9a5a19..b8f307d 100755 --- a/backend/raw_write.py +++ b/backend/raw_write.py @@ -30,7 +30,7 @@ import os import io import gettext -from subprocess import call +from subprocess import call, Popen, PIPE import hashlib import gnupg @@ -221,6 +221,11 @@ class Dumper(object): self.return_state = True self.finished.set() + def _do_persistence(self, target): + p = Popen(["fdisk",target], stdin = PIPE) + p.communicate(input=b'n\np\n3\n\n\nw\n') + + def __init__(self): gettext.install('isodumper', localedir='/usr/share/locale') # Operation running |