From 657b864202903dc8891a29e8f736ca7d995f3b32 Mon Sep 17 00:00:00 2001 From: Marcel Schwarz Date: Sat, 21 Mar 2020 04:11:01 +0100 Subject: [PATCH] Use file exists to check wether install is needed run screenfetch in helloworld module --- lnxtools.sh | 9 ++++----- modules/helloworld/HelloWorld.py | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lnxtools.sh b/lnxtools.sh index 3dc3971..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-get update -y && apt-get upgrade -y - apt-get install python3.7 python3-pip -y + apt-get install curl screenfetch python3.7 python3-pip -y pip3 install setuptools wheel regex - cd "$DIR" || exit pip3 install -r requirements.txt python3 main.py helloworld else - cd "$DIR" || exit python3 main.py "$@" fi diff --git a/modules/helloworld/HelloWorld.py b/modules/helloworld/HelloWorld.py index da7e0c2..50975bb 100644 --- a/modules/helloworld/HelloWorld.py +++ b/modules/helloworld/HelloWorld.py @@ -6,8 +6,8 @@ class HelloWorld: 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") - print("Your system information \n" + output) with open("your_system_information.txt", "w") as file: file.write(output)