aboutsummaryrefslogtreecommitdiffstats
path: root/backend
diff options
context:
space:
mode:
Diffstat (limited to 'backend')
-rwxr-xr-xbackend/magiback17
-rwxr-xr-xbackend/raw_write.py7
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