Use os.symlink in place of shell commands

Former-commit-id: 3c62f4bb691a7c8d4b7419697c0e81e5826de736 [formerly 3ad2068b11]
Former-commit-id: 6fd9419e1904efabae07af45293da4f56c3b3188
This commit is contained in:
2022-11-25 21:32:18 -05:00
parent 5f0a40efc0
commit 51b1b8c6ec
+4 -3
View File
@@ -232,17 +232,18 @@ def copy_id_check(_port, _username_ssh, _ip, _client_device_id):
def tweak(): # runs configuration wizard
from os import symlink
_divider = f"\n{'=' * (get_terminal_size()[0] - int((.5 * get_terminal_size()[0])))}\n\n"
# config directory creation
Path(expanduser('~/.config/sshyp/devices')).mkdir(0o700, parents=True, exist_ok=True)
if not Path(f"{expanduser('~/.config/sshyp/tmp')}").exists():
if uname()[0] == 'Haiku' or uname()[0] == 'FreeBSD':
system(f"ln -s /tmp {expanduser('~/.config/sshyp/tmp')}")
symlink('/tmp', expanduser('~/.config/sshyp/tmp'))
elif Path("/data/data/com.termux").exists():
system(f"ln -s '/data/data/com.termux/files/usr/tmp' {expanduser('~/.config/sshyp/tmp')}")
symlink('/data/data/com.termux/files/usr/tmp', expanduser('~/.config/sshyp/tmp'))
else:
system(f"ln -s /dev/shm {expanduser('~/.config/sshyp/tmp')}")
symlink('/dev/shm', expanduser('~/.config/sshyp/tmp'))
# device type configuration
_device_type = input('\nclient or server installation? (C/s) ')