diff --git a/lib/sshyp.py b/lib/sshyp.py index 6392068..bb19422 100755 --- a/lib/sshyp.py +++ b/lib/sshyp.py @@ -221,6 +221,7 @@ def tweak(): else: symlink('/dev/shm', f"{home}/.config/sshyp/tmp") + # PORT START TWEAK-DEVTYPE # device type configuration _device_type = input('\nclient or server installation? (C/s) ') if _device_type.lower() == 's': @@ -231,6 +232,7 @@ def tweak(): else: _sshyp_data = ['client'] Path(f"{home}/.local/share/sshyp").mkdir(mode=0o700, parents=True, exist_ok=True) + # PORT END TWEAK-DEVTYPE # gpg configuration _gpg_gen = input(f"{_divider}sshyp requires the use of a unique gpg key - use an (e)xisting key or (g)enerate a" diff --git a/port-jobs/RMSERVER.PY b/port-jobs/RMSERVER.PY index 1a133bf..4b8ea5f 100755 --- a/port-jobs/RMSERVER.PY +++ b/port-jobs/RMSERVER.PY @@ -31,3 +31,23 @@ new_text = re.sub(regex, '', text) # write updated text open('working/sshyp.py', 'w').write(new_text) + +# TWEAK-DEVTYPE +# define PORT target +string1 = '# PORT START TWEAK-DEVTYPE' +string2 = '# PORT END TWEAK-DEVTYPE' + +# set replacement text +replacement = """if True: + _sshyp_data = ['client'] + Path(f"{home}/.local/share/sshyp").mkdir(mode=0o700, parents=True, exist_ok=True)""" + +# read input file +text = open('working/sshyp.py', 'r').read() + +# find and replace the defined PORT target +regex = re.compile(f"{string1}.*?{string2}", re.DOTALL) +new_text = re.sub(regex, replacement, text) + +# write updated text +open('working/sshyp.py', 'w').write(new_text)