mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-03 07:37:16 -04:00
port-jobs: Allow server tweak code to be removed by RMSERVER.py
Former-commit-id: 788a356261f2bafbe66c1c7fa38204ba4f238cfa Former-commit-id: 7ee419cde8eb74ce7bd4e2b6e671ac081dabfffa
This commit is contained in:
@@ -221,6 +221,7 @@ def tweak():
|
|||||||
else:
|
else:
|
||||||
symlink('/dev/shm', f"{home}/.config/sshyp/tmp")
|
symlink('/dev/shm', f"{home}/.config/sshyp/tmp")
|
||||||
|
|
||||||
|
# PORT START TWEAK-DEVTYPE
|
||||||
# device type configuration
|
# device type configuration
|
||||||
_device_type = input('\nclient or server installation? (C/s) ')
|
_device_type = input('\nclient or server installation? (C/s) ')
|
||||||
if _device_type.lower() == 's':
|
if _device_type.lower() == 's':
|
||||||
@@ -231,6 +232,7 @@ def tweak():
|
|||||||
else:
|
else:
|
||||||
_sshyp_data = ['client']
|
_sshyp_data = ['client']
|
||||||
Path(f"{home}/.local/share/sshyp").mkdir(mode=0o700, parents=True, exist_ok=True)
|
Path(f"{home}/.local/share/sshyp").mkdir(mode=0o700, parents=True, exist_ok=True)
|
||||||
|
# PORT END TWEAK-DEVTYPE
|
||||||
|
|
||||||
# gpg configuration
|
# 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"
|
_gpg_gen = input(f"{_divider}sshyp requires the use of a unique gpg key - use an (e)xisting key or (g)enerate a"
|
||||||
|
|||||||
@@ -31,3 +31,23 @@ new_text = re.sub(regex, '', text)
|
|||||||
|
|
||||||
# write updated text
|
# write updated text
|
||||||
open('working/sshyp.py', 'w').write(new_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)
|
||||||
|
|||||||
Reference in New Issue
Block a user