[elbe-devel] [PATCH 11/13] Change os.sytem to call_check for "updated.py"

dion at linutronix.de dion at linutronix.de
Mon Jun 24 12:48:51 CEST 2019


From: Olivier Dion <dion at linutronix.de>

Signed-off-by: Olivier Dion <dion at linutronix.de>
---
 elbepack/updated.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/elbepack/updated.py b/elbepack/updated.py
index adad4cce..bb326584 100644
--- a/elbepack/updated.py
+++ b/elbepack/updated.py
@@ -16,6 +16,7 @@ import subprocess
 import sys
 import threading
 
+from subprocess import check_call
 from multiprocessing import Process
 from zipfile import (ZipFile, BadZipfile)
 from shutil import copyfile, rmtree, copy
@@ -180,14 +181,14 @@ class rw_access(object):
         if self.mount_orig == 'ro':
             self.status.log("remount %s read/writeable" % self.mount)
             cmd = "mount -o remount,rw %s" % self.mount
-            os.system(cmd)
+            check_call(cmd, shell=True)
 
     def __exit__(self, _typ, _value, _traceback):
         if self.mount_orig == 'ro':
             self.status.log("remount %s readonly" % self.mount)
-            os.system("sync")
+            check_call("sync", shell=True)
             cmd = "mount -o remount,ro %s" % self.mount
-            ret = os.system(cmd)
+            check_call(cmd, shell=True)
 
     def get_mount_status(self):
         with open('/etc/mtab') as mtab:
@@ -430,7 +431,7 @@ def apply_update(fname, status):
         status.log("cleanup /var/cache/apt/archives")
         # don't use execute() here, it results in an error that the apt-cache
         # is locked. We currently don't understand this behaviour :(
-        os.system("apt-get clean")
+        check_call("apt-get clean", shell=True)
         if p.exitcode != 0:
             raise Exception(
                 "Applying update failed. See logfile for more information")
-- 
2.11.0




More information about the elbe-devel mailing list