mirror of
https://github.com/FlatL1neAPT/TorghostNG
synced 2024-12-04 17:19:15 +00:00
Update install.py
This commit is contained in:
parent
b0e5b30ee1
commit
09866d5b8b
1 changed files with 62 additions and 11 deletions
73
install.py
73
install.py
|
@ -3,8 +3,6 @@
|
|||
from torngconf.theme import *
|
||||
from torghostng import geteuid, system, path, name, getoutput, sleep, argv, check_lang, choose_lang, try_again
|
||||
|
||||
SLEEP = 1.25
|
||||
|
||||
|
||||
def banner():
|
||||
print(the_banner)
|
||||
|
@ -20,16 +18,67 @@ def check_windows_check_root():
|
|||
print(language.root_please)
|
||||
exit()
|
||||
|
||||
def check_torghostng():
|
||||
def check_lang():
|
||||
try:
|
||||
if path.isfile('/usr/bin/torghostng') == True:
|
||||
print()
|
||||
|
||||
if path.isfile('torngconf/langconf.txt') == True:
|
||||
with open('torngconf/langconf.txt') as file_lang:
|
||||
lang = eval(file_lang.readline())
|
||||
|
||||
file_lang.close()
|
||||
|
||||
print(lang.applying_language, end='', flush=True)
|
||||
print(lang.done)
|
||||
|
||||
return lang
|
||||
else:
|
||||
lang = choose_lang()
|
||||
return lang
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print()
|
||||
exit()
|
||||
except (NameError, SyntaxError):
|
||||
lang = choose_lang()
|
||||
return lang
|
||||
except FileNotFoundError:
|
||||
print("TorghostNG is lacking its needed files. Reinstall TorghostNG pls")
|
||||
exit()
|
||||
|
||||
|
||||
def choose_lang(language=English):
|
||||
try:
|
||||
with open('torngconf/langconf.txt', mode="w") as file_lang:
|
||||
file_lang.truncate(0)
|
||||
|
||||
print(language.language_list)
|
||||
choice = int(input(language.choose_your_lang))
|
||||
|
||||
if choice == 1:
|
||||
print(English.applying_language, end='', flush=True)
|
||||
file_lang.write("English")
|
||||
|
||||
print(English.done)
|
||||
print(English.current_language + "English")
|
||||
return English
|
||||
|
||||
if choice == 2:
|
||||
print(Vietnamese.applying_language, end='', flush=True)
|
||||
file_lang.write("Vietnamese")
|
||||
|
||||
print(Vietnamese.done)
|
||||
print(Vietnamese.current_language + "Vietnamese")
|
||||
return Vietnamese
|
||||
|
||||
else:
|
||||
print(language.invalid_choice)
|
||||
choose_lang()
|
||||
|
||||
file_lang.close()
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print()
|
||||
exit()
|
||||
|
||||
def uninstall():
|
||||
try:
|
||||
choice = str(input(language.wanna_uninstall))
|
||||
|
@ -38,7 +87,6 @@ def uninstall():
|
|||
print(language.uninstalling)
|
||||
system('sudo rm -rf /usr/bin/torngconf')
|
||||
system('sudo rm /usr/bin/torghostng')
|
||||
sleep(SLEEP)
|
||||
print(language.uninstalled)
|
||||
exit()
|
||||
|
||||
|
@ -46,6 +94,8 @@ def uninstall():
|
|||
print(language.torghostng_tip.format('sudo torghostng') + color.END)
|
||||
exit()
|
||||
|
||||
print(language.video_tutorials)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print()
|
||||
exit()
|
||||
|
@ -129,14 +179,14 @@ def install_package(package):
|
|||
package == 'python3-pip'
|
||||
|
||||
system(INSTALL_PACKAGES + package)
|
||||
|
||||
sleep(SLEEP)
|
||||
|
||||
print(icon.success + language.done)
|
||||
|
||||
print(language.installed.format(package))
|
||||
|
||||
if path.isfile('/usr/bin/upgradepkg') == True:
|
||||
print(language.torghostng_tip.format('sudo python3 torghostng.py'))
|
||||
print(language.video_tutorials)
|
||||
exit()
|
||||
|
||||
except KeyboardInterrupt:
|
||||
|
@ -153,7 +203,7 @@ def pyinstaller():
|
|||
print(language.installing.format('PyInstaller'))
|
||||
system('sudo pip2 uninstall pyinstaller')
|
||||
system('sudo pip3 install pyinstaller')
|
||||
sleep(SLEEP)
|
||||
|
||||
print(icon.success + language.done)
|
||||
print(language.installed.format('PyInstaller'))
|
||||
|
||||
|
@ -162,9 +212,10 @@ def pyinstaller():
|
|||
system('sudo cp -r dist/torghostng /usr/bin')
|
||||
system('sudo cp -r torngconf /usr/bin')
|
||||
system('chmod +x /usr/bin/torghostng')
|
||||
sleep(SLEEP)
|
||||
|
||||
print(icon.success + language.done)
|
||||
print(language.torghostng_tip.format('sudo torghostng') + color.END)
|
||||
print(language.video_tutorials)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print()
|
||||
|
|
Loading…
Reference in a new issue