Changed subprocess.call-s to subbprocess.run-s

Additional status information in restore mode
This commit is contained in:
2021-12-09 23:55:23 +01:00
parent f3c24be9a3
commit 84cd8bc83f

13
main.py
View File

@@ -1,8 +1,8 @@
import datetime
import getopt
import os
import subprocess
import datetime
import sys
import getopt
def run_daily():
@@ -47,9 +47,10 @@ def restore():
packagelist.close()
exit(2)
else:
subprocess.call(["dpkg", "--set-selections"], stdin=packagelist)
subprocess.call(["apt-get", "dselect-upgrade"])
subprocess.run(["dpkg", "--set-selections"], stdin=packagelist)
subprocess.run(["apt-get", "dselect-upgrade"])
packagelist.close()
print("Restoration of packages complete")
else:
print("You're not root! You can't restore packages unless you are root!")
try:
@@ -59,8 +60,10 @@ def restore():
"correct order of arguments: first -d/--backup-dir then -r/--restore!")
config.close()
else:
subprocess.call(['dconf', 'load'], stdin=config)
subprocess.run(['dconf', 'load'], stdin=config)
config.close()
print("Restoration of settings is complete")
print("Exitting...")
exit()