No longer exit the tweak menu after (un-)installing an extension

Former-commit-id: 6589fef86d354b7dd3fd066e19b87b412c5e6eec
Former-commit-id: 6d9b5a407a566effa13943664d4d6ba00de40d54
This commit is contained in:
2023-07-08 19:41:45 -04:00
parent 7f4ddd2775
commit 9fc2aa69a3
+24 -20
View File
@@ -576,24 +576,28 @@ def wrapped_entry(_gm_device_type, _gm_top_message='configuration options:'):
wrapper(lambda _wrap_stdscr: (use_default_colors(), initial_setup(_wrap_stdscr))) wrapper(lambda _wrap_stdscr: (use_default_colors(), initial_setup(_wrap_stdscr)))
# any other value will be provided as the global menu device type # any other value will be provided as the global menu device type
else: else:
try: _repeat = True
_ext_name, _escalator, _action = \ while _repeat:
wrapper(lambda _wrap_stdscr: (use_default_colors(), try:
global_menu(_wrap_stdscr, _gm_device_type, _gm_top_message)))[1] _ext_name, _escalator, _action = \
except ChildProcessError: wrapper(lambda _wrap_stdscr: (use_default_colors(),
print("\n\u001b[38;5;9merror: privilege escalation required\n\nneither 'doas' nor 'sudo' were found in " global_menu(_wrap_stdscr, _gm_device_type, _gm_top_message)))[1]
"the system's $PATH\u001b[0m\n") except ChildProcessError:
return print("\n\u001b[38;5;9merror: privilege escalation required\n\nneither 'doas' nor 'sudo' were found in "
# only run if privilege escalation is needed "the system's $PATH\u001b[0m\n")
if _action is not None: return
if _action: # only run if privilege escalation is needed
# install with privilege escalation (outside of curses) if _action is not None:
from tempfile import gettempdir if _action:
_exe_dir, _ini_dir = f"{gettempdir()}/sshyp_exe", f"{gettempdir()}/sshyp_ini" # install with privilege escalation (outside of curses)
run((_escalator, 'chown', 'root:root', _exe_dir, _ini_dir)) from tempfile import gettempdir
run((_escalator, 'mv', _exe_dir, f"/usr/lib/sshyp/{_ext_name}")) _exe_dir, _ini_dir = f"{gettempdir()}/sshyp_exe", f"{gettempdir()}/sshyp_ini"
run((_escalator, 'mv', _ini_dir, f"/usr/lib/sshyp/extensions/{_ext_name}.ini")) run((_escalator, 'chown', 'root:root', _exe_dir, _ini_dir))
run((_escalator, 'mv', _exe_dir, f"/usr/lib/sshyp/{_ext_name}"))
run((_escalator, 'mv', _ini_dir, f"/usr/lib/sshyp/extensions/{_ext_name}.ini"))
else:
# uninstall with privilege escalation (outside of curses)
run((_escalator, 'rm', '-I', f"/usr/lib/sshyp/{_ext_name}",
f"/usr/lib/sshyp/extensions/{_ext_name}.ini"))
else: else:
# uninstall with privilege escalation (outside of curses) _repeat = False
run((_escalator, 'rm', '-I', f"/usr/lib/sshyp/{_ext_name}",
f"/usr/lib/sshyp/extensions/{_ext_name}.ini"))