From b09431877e2506846f73534a0760a62acd3f22d8 Mon Sep 17 00:00:00 2001 From: Lucas Noki Date: Sun, 2 Aug 2020 04:16:30 +0200 Subject: [PATCH] Check if lnxtools.sh is run as root Update requirements.txt Update wording --- lnxtools.sh | 6 +++++- modules/helloworld/__init__.py | 5 +++-- modules/install/__init__.py | 4 +++- requirements.txt | 3 +++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lnxtools.sh b/lnxtools.sh index e4ee61b..17feb51 100755 --- a/lnxtools.sh +++ b/lnxtools.sh @@ -1,5 +1,10 @@ #!/bin/bash +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root" + exit 1 +fi + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" cd "$DIR" || exit FILE=./your_system_information.txt @@ -8,7 +13,6 @@ if [ ! -f "$FILE" ]; then echo "Preparing your system for the first run" apt-get update -y && apt-get upgrade -y apt-get install curl screenfetch python3.7 python3-pip -y - pip3 install setuptools wheel regex pip3 install -r requirements.txt python3 main.py helloworld else diff --git a/modules/helloworld/__init__.py b/modules/helloworld/__init__.py index 899a56f..bae0abf 100644 --- a/modules/helloworld/__init__.py +++ b/modules/helloworld/__init__.py @@ -5,9 +5,10 @@ from print_helpers import print_gr def helloworld(): - print_gr("This shows that your installation is working correctly.") + print_gr("This shows that your installation is working correctly") subprocess.call("screenfetch", shell=True) - print_gr("You can now start using the tool.") + print_gr("You can now proceed with setting up individual modules") + print_gr("Run ./lnxtools.sh to see all available commands") 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/__init__.py b/modules/install/__init__.py index ce0c49e..ae74316 100644 --- a/modules/install/__init__.py +++ b/modules/install/__init__.py @@ -1,5 +1,7 @@ import subprocess +from print_helpers import print_gr + def basic_tools(): """Install the most basic tools!""" @@ -8,7 +10,7 @@ def basic_tools(): "apt update && apt-get install -y bleachbit nano htop bash-completion dialog powertop tree wget vim git", shell=True ) - print("Script ran to completion.") + print_gr("Module basictools has successfully finished!") def hard_drive_tools(): diff --git a/requirements.txt b/requirements.txt index df7c954..9bf425a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,5 @@ fire==0.3.1 PyInquirer==1.0.3 +regex==2020.7.14 +wheel==0.34.2 +setuptools==49.2.0