Use file exists to check wether install is needed

run screenfetch in helloworld module
This commit is contained in:
Marcel Schwarz 2020-03-21 04:11:01 +01:00
parent b55318da26
commit 657b864202
2 changed files with 5 additions and 6 deletions

View File

@ -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

View File

@ -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)