diff --git a/lnxtools.sh b/lnxtools.sh index 77ef64b..e4ee61b 100755 --- a/lnxtools.sh +++ b/lnxtools.sh @@ -1,17 +1,16 @@ #!/bin/bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +cd "$DIR" || exit +FILE=./your_system_information.txt -if [ "$1" == "prepare" ] -then +if [ ! -f "$FILE" ]; then echo "Preparing your system for the first run" - apt update -y && apt upgrade -y - apt install python3.7 python3-pip -y + apt-get update -y && apt-get upgrade -y + apt-get install curl screenfetch python3.7 python3-pip -y pip3 install setuptools wheel regex - cd $DIR pip3 install -r requirements.txt python3 main.py helloworld else - cd $DIR python3 main.py "$@" fi diff --git a/modules/helloworld/HelloWorld.py b/modules/helloworld/HelloWorld.py index c30b036..50975bb 100644 --- a/modules/helloworld/HelloWorld.py +++ b/modules/helloworld/HelloWorld.py @@ -1,6 +1,13 @@ +import subprocess + + class HelloWorld: """docstring for SampleModule.""" def run(self): print("This shows that your installation is working correctly.") + subprocess.call("screenfetch", shell=True) print("You can now start using the tool.") + output = subprocess.check_output("cat /etc/*-release", shell=True).decode("UTF-8") + with open("your_system_information.txt", "w") as file: + file.write(output) diff --git a/modules/install/ToolsInstaller.py b/modules/install/ToolsInstaller.py index 0a0d408..e6c64f9 100644 --- a/modules/install/ToolsInstaller.py +++ b/modules/install/ToolsInstaller.py @@ -1,23 +1,22 @@ -import json import subprocess class ToolsInstaller: - def __init__(self): - with open("modules/install/programs.json") as config_file: - self.programs_json = json.load(config_file) - def basic_tools(self): """Install the most basic tools!""" print("Try to install basic Command-line tools") - - programs_list = " ".join(p for p in self.programs_json['basic-tools']) - subprocess.run("apt install" + programs_list, shell=True) - + subprocess.run("apt-get install -y bleachbit nano xrdp htop bash-completion dialog powertop tree wget", + shell=True) print("Script ran to completion.") def hard_drive_tools(self): """Install tools to look up smart information from your hard-drives""" - programs_list = " ".join(p for p in self.programs_json['hard-drive']) - subprocess.run("apt install " + programs_list, shell=True) + subprocess.run("apt-get install -y smartmontools gsmartcontrol", shell=True) + + def docker(self): + """Install the Docker service on the machine""" + subprocess.run("curl -fsSL https://get.docker.com | bash", shell=True) + subprocess.run("curl -L \"https://github.com/docker/compose/releases/download/" + "1.25.4/docker-compose-$(uname -s)-$(uname -m)\" -o /usr/local/bin/docker-compose" + "&& chmod +x /usr/local/bin/docker-compose", shell=True) diff --git a/modules/install/programs.json b/modules/install/programs.json deleted file mode 100644 index 8a225c5..0000000 --- a/modules/install/programs.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "basic-tools": [ - "bleachbit", - "nano", - "xrdp", - "htop", - "bash-completion", - "dialog", - "powertop", - "tree" - ], - "hard-drive": [ - "smartmontools", - "gsmartcontrol" - ] -} \ No newline at end of file