diff --git a/lib/stweak.py b/lib/stweak.py index 5d84dcb..871d730 100644 --- a/lib/stweak.py +++ b/lib/stweak.py @@ -354,6 +354,7 @@ def whitelist_menu(): # PORT END WHITELIST-SERVER +# PORT START TWEAK-EXTEND-FUNCTIONS # downloads/updates extensions def extension_downloader(): from os import chmod @@ -424,6 +425,7 @@ def extension_menu(): else: break return _ext_name, _escalator, _action +# PORT END TWEAK-EXTEND-FUNCTIONS # runs secondary configuration menu @@ -508,10 +510,12 @@ def global_menu(_scr, _device_type, _top_message): elif _success == 2: curses_radio(['okay'], '\u001b[38;5;9merror: re-encryption failed: entry directory not found\u001b[0m') elif _choice == 7: + # PORT START TWEAK-EXTEND-OPTION _ext_name, _escalator, _action = extension_menu() # if root is needed for extension management... if _ext_name: return _ext_name, _escalator, _action + # PORT END TWEAK-EXTEND-OPTION else: _exit_signal = True if _exit_signal: diff --git a/package.sh b/package.sh index 9d8f55d..8603aa5 100755 --- a/package.sh +++ b/package.sh @@ -155,6 +155,7 @@ urls { cd port-jobs ./SHEBANG.sh ./RMSERVER.py + ./RMEXTMAN.py ./CLIPTOOL.py ./CLIPBOARD.py HAIKU ./UNAME.py TMP @@ -243,6 +244,7 @@ _create_termux() { cp lib/* port-jobs/working/ cd port-jobs ./RMSERVER.py + ./RMEXTMAN.py ./CLIPTOOL.py ./CLIPBOARD.py TERMUX ./UNAME.py TERMUX diff --git a/port-jobs/RMEXTMAN.py b/port-jobs/RMEXTMAN.py new file mode 100755 index 0000000..8331011 --- /dev/null +++ b/port-jobs/RMEXTMAN.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 +import re + +devtype_replacement = """_install_type = curses_radio(('client (ssh-synchronized)', 'client (offline)'), + 'device + sync type configuration')""" + +targets = (('TWEAK-EXTEND-FUNCTIONS', 'stweak.py', '\n', '\n\n', ''), + ('TWEAK-EXTEND-OPTION', 'stweak.py', '', '', "curses_radio(['okay'], " + "'extension management is not supported on this platform\\\\n\\\\ninstead, you may install and manage " + "extensions through your system package manager\\\\n\\\\nofficial extension packages are available " + "at https://github.com/rwinkhart/sshyp-labs/releases')")) +for target in targets: + # read text from target file + text = open(f"working/{target[1]}", 'r').read() + # compile regex and modify text + regex = re.compile(f"{target[2]}# PORT START {target[0]}.*?# PORT END {target[0]}{target[3]}", re.DOTALL) + new_text = re.sub(regex, target[4], text) + # write updated text to target file + open(f"working/{target[1]}", 'w').write(new_text)