From 51b1b8c6ec573d15949fd4b73e740957d689ddf1 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Fri, 25 Nov 2022 21:32:18 -0500 Subject: [PATCH] Use os.symlink in place of shell commands Former-commit-id: 3c62f4bb691a7c8d4b7419697c0e81e5826de736 [formerly 3ad2068b116fb1d22b2d24c23453adb814966c6f] Former-commit-id: 6fd9419e1904efabae07af45293da4f56c3b3188 --- lib/sshyp.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/sshyp.py b/lib/sshyp.py index bdf7920..dfb9057 100755 --- a/lib/sshyp.py +++ b/lib/sshyp.py @@ -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) ')