Add programs list, implement subprocess to start apt, error handling
This commit is contained in:
parent
33737fec66
commit
f5cd3c6234
@ -1,6 +1,19 @@
|
|||||||
|
import json
|
||||||
|
import subprocess
|
||||||
|
|
||||||
from AbstractModule import AbstractModule
|
from AbstractModule import AbstractModule
|
||||||
|
|
||||||
|
|
||||||
class CmdToolsModule(AbstractModule):
|
class CmdToolsModule(AbstractModule):
|
||||||
def run(self):
|
def run(self):
|
||||||
print("Commandline Tools")
|
print("Try to install basic Command-line tools")
|
||||||
|
|
||||||
|
with open("modules/command-line tools/programs.json") as config_file:
|
||||||
|
programms_list = json.load(config_file)
|
||||||
|
|
||||||
|
out = subprocess.run(["apt", "install"] + programms_list, shell=True, capture_output=True)
|
||||||
|
if len(out.stderr) > 0:
|
||||||
|
print(out.stderr.decode())
|
||||||
|
print("Install might be not complete, please check output above.")
|
||||||
|
else:
|
||||||
|
print("Installed successful.")
|
||||||
|
8
modules/command-line tools/programs.json
Normal file
8
modules/command-line tools/programs.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[
|
||||||
|
"bleachbit",
|
||||||
|
"nano",
|
||||||
|
"xrdp",
|
||||||
|
"htop",
|
||||||
|
"bash-completion",
|
||||||
|
"dialog"
|
||||||
|
]
|
Loading…
Reference in New Issue
Block a user