From de739144773228742b755a55b0054c87385693f2 Mon Sep 17 00:00:00 2001 From: Marcel Schwarz Date: Thu, 5 Mar 2020 19:40:04 +0100 Subject: [PATCH 1/4] Implement systemupdate module --- modules/systemupdate/__init__.py | 5 +++++ modules/systemupdate/systemupdate.py | 15 +++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 modules/systemupdate/__init__.py create mode 100644 modules/systemupdate/systemupdate.py diff --git a/modules/systemupdate/__init__.py b/modules/systemupdate/__init__.py new file mode 100644 index 0000000..15f905e --- /dev/null +++ b/modules/systemupdate/__init__.py @@ -0,0 +1,5 @@ +from .systemupdate import Systemupdate + + +def get_module(): + return Systemupdate() diff --git a/modules/systemupdate/systemupdate.py b/modules/systemupdate/systemupdate.py new file mode 100644 index 0000000..d0b78f8 --- /dev/null +++ b/modules/systemupdate/systemupdate.py @@ -0,0 +1,15 @@ +import subprocess + +from AbstractModule import AbstractModule + + +class Systemupdate(AbstractModule): + + def run(self): + print("Running update") + subprocess.run("apt update") + subprocess.run("apt upgrade") + subprocess.run("apt dist-upgrade") + subprocess.run("apt autoremove") + subprocess.run("apt autoclean") + print("All update processes finished, please check output for further details.") From 72f0244a7c9b4b4bbfbe6d70a8c2a9cd12d19ef0 Mon Sep 17 00:00:00 2001 From: Marcel Schwarz Date: Thu, 5 Mar 2020 19:50:23 +0100 Subject: [PATCH 2/4] change run to call --- modules/systemupdate/systemupdate.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/systemupdate/systemupdate.py b/modules/systemupdate/systemupdate.py index d0b78f8..5a91883 100644 --- a/modules/systemupdate/systemupdate.py +++ b/modules/systemupdate/systemupdate.py @@ -7,9 +7,9 @@ class Systemupdate(AbstractModule): def run(self): print("Running update") - subprocess.run("apt update") - subprocess.run("apt upgrade") - subprocess.run("apt dist-upgrade") - subprocess.run("apt autoremove") - subprocess.run("apt autoclean") + subprocess.call("apt update") + subprocess.call("apt upgrade") + subprocess.call("apt dist-upgrade") + subprocess.call("apt autoremove") + subprocess.call("apt autoclean") print("All update processes finished, please check output for further details.") From 2e4ba51a5867775e0f4f90872800e9a5cdea3a4d Mon Sep 17 00:00:00 2001 From: Marcel Schwarz Date: Thu, 5 Mar 2020 19:55:10 +0100 Subject: [PATCH 3/4] Split up calls into executable and parameterlist --- modules/systemupdate/systemupdate.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/systemupdate/systemupdate.py b/modules/systemupdate/systemupdate.py index 5a91883..f148640 100644 --- a/modules/systemupdate/systemupdate.py +++ b/modules/systemupdate/systemupdate.py @@ -7,9 +7,9 @@ class Systemupdate(AbstractModule): def run(self): print("Running update") - subprocess.call("apt update") - subprocess.call("apt upgrade") - subprocess.call("apt dist-upgrade") - subprocess.call("apt autoremove") - subprocess.call("apt autoclean") + subprocess.call(["apt", "update"]) + subprocess.call(["apt", "upgrade"]) + subprocess.call(["apt", "dist-upgrade"]) + subprocess.call(["apt", "autoremove"]) + subprocess.call(["apt", "autoclean"]) print("All update processes finished, please check output for further details.") From 5d7fde28484e8accdef7f9e40de14bd02f08e815 Mon Sep 17 00:00:00 2001 From: Marcel Schwarz Date: Thu, 5 Mar 2020 19:56:54 +0100 Subject: [PATCH 4/4] Add default yes parameter --- modules/systemupdate/systemupdate.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/systemupdate/systemupdate.py b/modules/systemupdate/systemupdate.py index f148640..9e9d072 100644 --- a/modules/systemupdate/systemupdate.py +++ b/modules/systemupdate/systemupdate.py @@ -7,9 +7,9 @@ class Systemupdate(AbstractModule): def run(self): print("Running update") - subprocess.call(["apt", "update"]) - subprocess.call(["apt", "upgrade"]) - subprocess.call(["apt", "dist-upgrade"]) - subprocess.call(["apt", "autoremove"]) - subprocess.call(["apt", "autoclean"]) + subprocess.call(["apt", "update", "-y"]) + subprocess.call(["apt", "upgrade", "-y"]) + subprocess.call(["apt", "dist-upgrade", "-y"]) + subprocess.call(["apt", "autoremove", "-y"]) + subprocess.call(["apt", "autoclean", "-y"]) print("All update processes finished, please check output for further details.")