40 lines
1.5 KiB
Python
40 lines
1.5 KiB
Python
from core.services.helpers.setup_sudo_scripts import auto_install_sudo_script, test_if_in_sudo_folder
|
|
from core.services.helpers.manage_assets import sudo_assets_folder_setup
|
|
from core.models.Result import Result, ResultError
|
|
|
|
import sys
|
|
|
|
choice = input("""
|
|
The setup of the firewall & managed-DNS is just moving two bash scripts to a sudo protected folder.
|
|
|
|
What would you like to do?
|
|
a) Run the script manually yourself, with "sudo bash setup.sh"
|
|
b) Get an automated installer.
|
|
""")
|
|
|
|
if choice == "a":
|
|
results = sudo_assets_folder_setup()
|
|
print("Okay it copied the scripts to your Downloads folder in a folder named 'hydraveil_sudo_scripts'. Please review the scripts. Then when you're ready, run 'sudo bash setup.sh'")
|
|
|
|
ran_it = input("Hit enter after you ran it to confirm it worked.")
|
|
confirmed = test_if_in_sudo_folder()
|
|
if confirmed.valid:
|
|
print("Confirmed it worked.")
|
|
else:
|
|
print(f"I'm sorry it did not work, {confirmed.message}")
|
|
|
|
elif choice == "b":
|
|
results = auto_install_sudo_script()
|
|
if results.valid:
|
|
print("The setup script ran successfully. Testing..")
|
|
confirmed = test_if_in_sudo_folder()
|
|
if confirmed.valid:
|
|
print("Confirmed it worked.")
|
|
else:
|
|
print(f"I'm sorry it did not work, {confirmed.message}")
|
|
else:
|
|
print(f"Setup script did NOT work because {results.message}")
|
|
|
|
else:
|
|
print(f"Invalid choice! You can't pick {choice}. Please run the script again, and pick 'a' or 'b'")
|
|
sys.exit()
|