diff --git a/dockerbot/install.py b/dockerbot/install.py index 4273734..85f502d 100644 --- a/dockerbot/install.py +++ b/dockerbot/install.py @@ -27,41 +27,39 @@ class bcolors: Choose carefully! """) - def getarch(): - try: - architecture = int(input("> ")) + while True: + try: + architecture = int(input("> ")) - if architecture == 1: - return architecture - elif architecture == 2: - return architecture - elif architecture == 3: - print("You can search on google how to get it :)") - elif architecture == 4: - print("Ask the developer for help :)") - else: + if architecture in (1, 2): + return architecture + elif architecture == 3: + print("You can search on google how to get it :)") + elif architecture == 4: + print("Ask the developer for help :)") + else: + print("Enter a correct value!") + except ValueError: print("Enter a correct value!") - except: - print("Enter a correct value!") -getarch() def install(): - if getarch() == 1: + architecture = getarch() + if architecture == 1: print(f"{bcolors.WARNING}Installing requirements{bcolors.ENDC}") os.system("apt install screenfetch git wondershaper docker.io -y") print(f"{bcolors.WARNING}70% Done{bcolors.ENDC}") os.system("git clone https://github.com/dxomg/vpsbot") os.system("cd vpsbot/dockerbot") - os.system("wget -O imagesamd64.tar.gz 'https://drive.google.com/uc?id=1iUUNLS4hhSk6vCXMwjR09jCOFAblK7as&export=download&confirm=t&uuid=6aa2ceab-5731-4e33-ab08-f054aedafe3e' && docker load < imagesamd64.tar") + os.system("wget -O imagesamd64.tar.gz 'https://drive.google.com/uc?id=1iUUNLS4hhSk6vCXMwjR09jCOFAblK7as&export=download&confirm=t&uuid=6aa2ceab-5731-4e33-ab08-f054aedafe3e' && docker load < imagesamd64.tar.gz") print(f"{bcolors.WARNING}100% Done{bcolors.ENDC}") - if getarch() == 2: + if architecture == 2: print(f"{bcolors.WARNING}Installing requirements{bcolors.ENDC}") os.system("apt install screenfetch git wondershaper docker.io -y") print(f"{bcolors.WARNING}70% Done{bcolors.ENDC}") os.system("git clone https://github.com/dxomg/vpsbot") os.system("cd vpsbot/dockerbot") - os.system("wget -O imagesamd64.tar.gz 'https://drive.google.com/uc?id=1lGrbGAnDBbGpUH63X_zq2Bxy0EeOXNnY&export=download&confirm=t&uuid=90ee1fa3-806d-40c3-9cc1-d31adf586b17' && docker load < imagesarm64.tar") + os.system("wget -O imagesamd64.tar.gz 'https://drive.google.com/uc?id=1lGrbGAnDBbGpUH63X_zq2Bxy0EeOXNnY&export=download&confirm=t&uuid=90ee1fa3-806d-40c3-9cc1-d31adf586b17' && docker load < imagesarm64.tar.gz") print(f"{bcolors.OKGREEN}100% Done{bcolors.ENDC}") print(f""" {bcolors.WARNING}Install has been completed!, now go edit the config.cfg file to your needs