mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-05 00:27:13 -04:00
Updated port-jobs to allow for packaging the new config setup, fixed offline mode error
Former-commit-id: 511d1d887fb34b8613f063fc7992418bb614a740 Former-commit-id: 03f6817527864c52012de1d02bb2c34e8fed8a18
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
sshyp v1.4.99
|
||||||
|
05/13/2023
|
||||||
|
|
||||||
|
this is an in-progress update
|
||||||
|
|
||||||
|
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
|
||||||
|
|
||||||
sshyp v1.4.2
|
sshyp v1.4.2
|
||||||
04/30/2023
|
04/30/2023
|
||||||
|
|
||||||
|
|||||||
+5
-4
@@ -8,9 +8,9 @@ from shutil import move, rmtree
|
|||||||
from sshync import delete as offline_delete, run_profile
|
from sshync import delete as offline_delete, run_profile
|
||||||
from subprocess import CalledProcessError, DEVNULL, PIPE, run
|
from subprocess import CalledProcessError, DEVNULL, PIPE, run
|
||||||
from sys import argv, exit as s_exit
|
from sys import argv, exit as s_exit
|
||||||
# PORT START UNAME-IMPORT
|
# PORT START UNAME-IMPORT-SSHYP
|
||||||
from os import uname
|
from os import uname
|
||||||
# PORT END UNAME-IMPORT
|
# PORT END UNAME-IMPORT-SSHYP
|
||||||
home = expanduser("~")
|
home = expanduser("~")
|
||||||
|
|
||||||
|
|
||||||
@@ -238,8 +238,8 @@ def print_info():
|
|||||||
print(f"{_border}{_blank}\n\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m{3*' '}\u001b[38;5;15;48;5;8m"
|
print(f"{_border}{_blank}\n\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m{3*' '}\u001b[38;5;15;48;5;8m"
|
||||||
f"sshyp ", f"copyright (c) 2021-2023 ", f"randall winkhart\u001b[38;5;15;48;5;15m{3*' '}"
|
f"sshyp ", f"copyright (c) 2021-2023 ", f"randall winkhart\u001b[38;5;15;48;5;15m{3*' '}"
|
||||||
f"\u001b[38;5;7;48;5;8m/\u001b[0m\n{_blank}")
|
f"\u001b[38;5;7;48;5;8m/\u001b[0m\n{_blank}")
|
||||||
print(f"\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m{20*' '}\u001b[38;5;15;48;5;8mversion 1.4.2"
|
print(f"\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m{20*' '}\u001b[38;5;15;48;5;8mversion 1.4.99"
|
||||||
f"\u001b[38;5;15;48;5;15m{21*' '}\u001b[38;5;7;48;5;8m/\u001b[0m")
|
f"\u001b[38;5;15;48;5;15m{20*' '}\u001b[38;5;7;48;5;8m/\u001b[0m")
|
||||||
print(f"\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m{9*' '}\u001b[38;5;15;48;5;8mthe argumentative "
|
print(f"\u001b[38;5;7;48;5;8m/\u001b[38;5;15;48;5;15m{9*' '}\u001b[38;5;15;48;5;8mthe argumentative "
|
||||||
f"agronomist update\u001b[38;5;15;48;5;15m{10*' '}\u001b[38;5;7;48;5;8m/\u001b[0m")
|
f"agronomist update\u001b[38;5;15;48;5;15m{10*' '}\u001b[38;5;7;48;5;8m/\u001b[0m")
|
||||||
print(f"{_blank}\n{_border}\nsee https://github.com/rwinkhart/sshyp for more information\n")
|
print(f"{_blank}\n{_border}\nsee https://github.com/rwinkhart/sshyp for more information\n")
|
||||||
@@ -737,6 +737,7 @@ if __name__ == "__main__":
|
|||||||
offline_mode_enabled = sshyp_data.get('CLIENT-GENERAL', 'offline_mode_enabled')
|
offline_mode_enabled = sshyp_data.get('CLIENT-GENERAL', 'offline_mode_enabled')
|
||||||
if offline_mode_enabled == 'true':
|
if offline_mode_enabled == 'true':
|
||||||
ssh_error = True
|
ssh_error = True
|
||||||
|
quick_unlock_enabled = 'false'
|
||||||
else:
|
else:
|
||||||
quick_unlock_enabled = sshyp_data.get('CLIENT-ONLINE', 'quick_unlock_enabled')
|
quick_unlock_enabled = sshyp_data.get('CLIENT-ONLINE', 'quick_unlock_enabled')
|
||||||
username_ssh = sshyp_data.get('SSHYNC', 'user')
|
username_ssh = sshyp_data.get('SSHYNC', 'user')
|
||||||
|
|||||||
+2
-2
@@ -10,9 +10,9 @@ from re import sub
|
|||||||
from shutil import get_terminal_size, which
|
from shutil import get_terminal_size, which
|
||||||
from sshyp import copy_id_check, string_gen
|
from sshyp import copy_id_check, string_gen
|
||||||
from subprocess import PIPE, run
|
from subprocess import PIPE, run
|
||||||
# PORT START UNAME-IMPORT
|
# PORT START UNAME-IMPORT-STWEAK
|
||||||
from os import uname
|
from os import uname
|
||||||
# PORT END UNAME-IMPORT
|
# PORT END UNAME-IMPORT-STWEAK
|
||||||
home, stdscr, sshyp_data = expanduser("~"), initscr(), ConfigParser()
|
home, stdscr, sshyp_data = expanduser("~"), initscr(), ConfigParser()
|
||||||
if isfile(f"{home}/.config/sshyp/sshyp.ini"):
|
if isfile(f"{home}/.config/sshyp/sshyp.ini"):
|
||||||
_exists_flag = True
|
_exists_flag = True
|
||||||
|
|||||||
+8
-6
@@ -7,6 +7,8 @@ else
|
|||||||
revision="$2"
|
revision="$2"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
mkdir -p port-jobs/working
|
||||||
|
|
||||||
_create_generic_linux() {
|
_create_generic_linux() {
|
||||||
printf '\npackaging as generic (Linux)...\n'
|
printf '\npackaging as generic (Linux)...\n'
|
||||||
mkdir -p output/linuxtemp/usr/bin \
|
mkdir -p output/linuxtemp/usr/bin \
|
||||||
@@ -15,7 +17,7 @@ _create_generic_linux() {
|
|||||||
output/linuxtemp/usr/share/bash-completion/completions \
|
output/linuxtemp/usr/share/bash-completion/completions \
|
||||||
output/linuxtemp/usr/share/zsh/functions/Completion/Unix
|
output/linuxtemp/usr/share/zsh/functions/Completion/Unix
|
||||||
# START PORT
|
# START PORT
|
||||||
cp -r lib/. port-jobs/working/
|
cp lib/* port-jobs/working/
|
||||||
cd port-jobs
|
cd port-jobs
|
||||||
./CLIPTOOL.py LINUX
|
./CLIPTOOL.py LINUX
|
||||||
./CLIPBOARD.py LINUX
|
./CLIPBOARD.py LINUX
|
||||||
@@ -149,7 +151,7 @@ urls {
|
|||||||
}
|
}
|
||||||
" > output/haikutemp/.PackageInfo
|
" > output/haikutemp/.PackageInfo
|
||||||
# START PORT
|
# START PORT
|
||||||
cp -r lib/. port-jobs/working/
|
cp lib/* port-jobs/working/
|
||||||
cd port-jobs
|
cd port-jobs
|
||||||
./SHEBANG.sh
|
./SHEBANG.sh
|
||||||
./RMSERVER.py
|
./RMSERVER.py
|
||||||
@@ -197,7 +199,7 @@ Priority: optional
|
|||||||
Installed-Size: 71680
|
Installed-Size: 71680
|
||||||
" > output/debiantemp/sshyp_"$version"-"$revision"_all/DEBIAN/control
|
" > output/debiantemp/sshyp_"$version"-"$revision"_all/DEBIAN/control
|
||||||
# START PORT
|
# START PORT
|
||||||
cp -r lib/. port-jobs/working/
|
cp lib/* port-jobs/working/
|
||||||
cd port-jobs
|
cd port-jobs
|
||||||
if [ "$1" = 'Debian' ]; then
|
if [ "$1" = 'Debian' ]; then
|
||||||
./CLIPTOOL.py LINUX
|
./CLIPTOOL.py LINUX
|
||||||
@@ -248,7 +250,7 @@ Priority: optional
|
|||||||
Installed-Size: 71680
|
Installed-Size: 71680
|
||||||
" > output/termuxtemp/sshyp_"$version"-"$revision"_all_termux/DEBIAN/control
|
" > output/termuxtemp/sshyp_"$version"-"$revision"_all_termux/DEBIAN/control
|
||||||
# START PORT
|
# START PORT
|
||||||
cp -r lib/. port-jobs/working/
|
cp lib/* port-jobs/working/
|
||||||
cd port-jobs
|
cd port-jobs
|
||||||
./CLIPTOOL.py
|
./CLIPTOOL.py
|
||||||
./CLIPBOARD.py TERMUX
|
./CLIPBOARD.py TERMUX
|
||||||
@@ -306,7 +308,7 @@ cp -r %%{_sourcedir}/usr %%{buildroot}
|
|||||||
/usr/share/man/man1/sshyp.1.gz
|
/usr/share/man/man1/sshyp.1.gz
|
||||||
" > ~/rpmbuild/SPECS/sshyp.spec
|
" > ~/rpmbuild/SPECS/sshyp.spec
|
||||||
# START PORT
|
# START PORT
|
||||||
cp -r lib/. port-jobs/working/
|
cp lib/* port-jobs/working/
|
||||||
cd port-jobs
|
cd port-jobs
|
||||||
./CLIPTOOL.py LINUX
|
./CLIPTOOL.py LINUX
|
||||||
./CLIPBOARD.py LINUX
|
./CLIPBOARD.py LINUX
|
||||||
@@ -367,7 +369,7 @@ printf "/usr/bin/sshyp
|
|||||||
/usr/share/man/man1/sshyp.1.gz
|
/usr/share/man/man1/sshyp.1.gz
|
||||||
" > output/freebsdtemp/plist
|
" > output/freebsdtemp/plist
|
||||||
# START PORT
|
# START PORT
|
||||||
cp -r lib/. port-jobs/working/
|
cp lib/* port-jobs/working/
|
||||||
cd port-jobs
|
cd port-jobs
|
||||||
./CLIPTOOL.py LINUX
|
./CLIPTOOL.py LINUX
|
||||||
./CLIPBOARD.py LINUX
|
./CLIPBOARD.py LINUX
|
||||||
|
|||||||
@@ -8,11 +8,12 @@ arguments = argv[1:]
|
|||||||
# define replacement text depending on arguments
|
# define replacement text depending on arguments
|
||||||
if len(arguments) > 0:
|
if len(arguments) > 0:
|
||||||
if arguments[0] == 'WSL':
|
if arguments[0] == 'WSL':
|
||||||
replacement = """run(['powershell.exe', '-c', "Set-Clipboard '" + _copy_line[_index].rstrip().replace("'", "''") + "'"])
|
replacement = """run(['powershell.exe', '-c', "Set-Clipboard '" + _copy_line[_index].rstrip()\
|
||||||
|
.replace("'", "''") + "'"])
|
||||||
Popen("sleep 30; pwsh.exe -c 'echo \\"\\" | Set-Clipboard'", shell=True)"""
|
Popen("sleep 30; pwsh.exe -c 'echo \\"\\" | Set-Clipboard'", shell=True)"""
|
||||||
elif arguments[0] == 'MAC':
|
elif arguments[0] == 'MAC':
|
||||||
replacement = """run(['pbcopy'], stdin=Popen(['printf', _copy_line[_index].rstrip().replace('\\\\\\', '\\\\\\\\\\\\\\').replace('%', '%%')],
|
replacement = """run(['pbcopy'], stdin=Popen(['printf', _copy_line[_index].rstrip()\
|
||||||
stdout=PIPE).stdout)
|
.replace('\\\\\\', '\\\\\\\\\\\\\\').replace('%', '%%')],stdout=PIPE).stdout)
|
||||||
Popen("sleep 30; printf '' | pbcopy", shell=True)"""
|
Popen("sleep 30; printf '' | pbcopy", shell=True)"""
|
||||||
elif arguments[0] == 'HAIKU':
|
elif arguments[0] == 'HAIKU':
|
||||||
replacement = """run(['clipboard', '-c', _copy_line[_index].rstrip()])
|
replacement = """run(['clipboard', '-c', _copy_line[_index].rstrip()])
|
||||||
@@ -25,8 +26,8 @@ if len(arguments) > 0:
|
|||||||
run(['wl-copy', _copy_line[_index].rstrip()])
|
run(['wl-copy', _copy_line[_index].rstrip()])
|
||||||
Popen('sleep 30; wl-copy -c', shell=True)
|
Popen('sleep 30; wl-copy -c', shell=True)
|
||||||
else:
|
else:
|
||||||
run(['xclip', '-sel', 'c'], stdin=Popen(['printf', _copy_line[_index].rstrip().replace('\\\\\\', '\\\\\\\\\\\\\\')
|
run(['xclip', '-sel', 'c'], stdin=Popen(['printf', _copy_line[_index].rstrip()\
|
||||||
.replace('%', '%%')], stdout=PIPE).stdout)
|
.replace('\\\\\\', '\\\\\\\\\\\\\\').replace('%', '%%')], stdout=PIPE).stdout)
|
||||||
Popen("sleep 30; printf '' | xclip -sel c", shell=True)"""
|
Popen("sleep 30; printf '' | xclip -sel c", shell=True)"""
|
||||||
else:
|
else:
|
||||||
s_exit()
|
s_exit()
|
||||||
|
|||||||
+11
-12
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import re
|
import re
|
||||||
from sys import argv, exit as s_exit
|
from sys import argv
|
||||||
|
|
||||||
# read arguments
|
# read arguments
|
||||||
arguments = argv[1:]
|
arguments = argv[1:]
|
||||||
@@ -13,24 +13,23 @@ string2 = '# PORT END CLIPTOOL'
|
|||||||
if len(arguments) > 0:
|
if len(arguments) > 0:
|
||||||
regex = re.compile(f"{string1}.*?{string2}", re.DOTALL)
|
regex = re.compile(f"{string1}.*?{string2}", re.DOTALL)
|
||||||
replacement = """# check for clipboard tool and display warning if missing
|
replacement = """# check for clipboard tool and display warning if missing
|
||||||
if 'WAYLAND_DISPLAY' in environ:
|
if 'WAYLAND_DISPLAY' in environ:
|
||||||
_display_server, _clipboard_tool, _clipboard_package = 'Wayland', 'wl-copy', 'wl-clipboard'
|
_display_server, _clipboard_tool, _clipboard_package = 'Wayland', 'wl-copy', 'wl-clipboard'
|
||||||
else:
|
else:
|
||||||
_display_server, _clipboard_tool, _clipboard_package = 'X11', 'xclip', 'xclip'
|
_display_server, _clipboard_tool, _clipboard_package = 'X11', 'xclip', 'xclip'
|
||||||
from shutil import which
|
if which(_clipboard_tool) is None:
|
||||||
if which(_clipboard_tool) is None:
|
print(f'''\n\u001b[38;5;9mwarning: you are using {_display_server} and "{_clipboard_tool}" is not present -
|
||||||
print(f'''\u001b[38;5;9mwarning: you are using {_display_server} and "{_clipboard_tool}" is not present -
|
|
||||||
copying entry fields will not function until "{_clipboard_package}" is installed\u001b[0m
|
copying entry fields will not function until "{_clipboard_package}" is installed\u001b[0m
|
||||||
''')"""
|
''')"""
|
||||||
else:
|
else:
|
||||||
regex = re.compile(f"{string1}.*?{string2}\n\n", re.DOTALL)
|
regex = re.compile(f"{string1}.*?{string2}\n", re.DOTALL)
|
||||||
replacement = ''
|
replacement = ''
|
||||||
|
|
||||||
# read input file
|
# read input file
|
||||||
text = open('working/sshyp.py', 'r').read()
|
text = open('working/stweak.py', 'r').read()
|
||||||
|
|
||||||
# find and replace the defined PORT target
|
# find and replace the defined PORT target
|
||||||
new_text = re.sub(regex, replacement, text)
|
new_text = re.sub(regex, replacement, text)
|
||||||
|
|
||||||
# write updated text
|
# write updated text
|
||||||
open('working/sshyp.py', 'w').write(new_text)
|
open('working/stweak.py', 'w').write(new_text)
|
||||||
|
|||||||
+11
-11
@@ -31,25 +31,25 @@ 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
|
# TWEAK-DEVTYPE TODO Disabled due to new config menu changes, needs re-written so that device type cannot be set to server on RMSERVER devices
|
||||||
# define PORT target
|
# define PORT target
|
||||||
string1 = '# PORT START TWEAK-DEVTYPE'
|
#string1 = '# PORT START TWEAK-DEVTYPE'
|
||||||
string2 = '# PORT END TWEAK-DEVTYPE'
|
#string2 = '# PORT END TWEAK-DEVTYPE'
|
||||||
|
|
||||||
# set replacement text
|
# set replacement text
|
||||||
replacement = """if True:
|
#replacement = """if True:
|
||||||
_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)"""
|
||||||
|
|
||||||
# read input file
|
## read input file
|
||||||
text = open('working/sshyp.py', 'r').read()
|
#text = open('working/stweak.py', 'r').read()
|
||||||
|
|
||||||
# find and replace the defined PORT target
|
# find and replace the defined PORT target
|
||||||
regex = re.compile(f"{string1}.*?{string2}", re.DOTALL)
|
#regex = re.compile(f"{string1}.*?{string2}", re.DOTALL)
|
||||||
new_text = re.sub(regex, replacement, text)
|
#new_text = re.sub(regex, replacement, text)
|
||||||
|
|
||||||
# write updated text
|
# write updated text
|
||||||
open('working/sshyp.py', 'w').write(new_text)
|
#open('working/stweak.py', 'w').write(new_text)
|
||||||
|
|
||||||
# ARGS-SERVER
|
# ARGS-SERVER
|
||||||
# define PORT target
|
# define PORT target
|
||||||
|
|||||||
+3
-1
@@ -2,9 +2,11 @@
|
|||||||
if [ "$1" = 'TABS' ]; then
|
if [ "$1" = 'TABS' ]; then
|
||||||
unexpand -t 3,7,11,15,19,23,27,31,35,39,43,47,51,55,59,63,67,71,75,79,83,87,91,95,99,103,107,111,115,119,123 working/sshyp.py > working/sshyp.py.new
|
unexpand -t 3,7,11,15,19,23,27,31,35,39,43,47,51,55,59,63,67,71,75,79,83,87,91,95,99,103,107,111,115,119,123 working/sshyp.py > working/sshyp.py.new
|
||||||
unexpand -t 3,7,11,15,19,23,27,31,35,39,43,47,51,55,59,63,67,71,75,79,83,87,91,95,99,103,107,111,115,119,123 working/sshync.py > working/sshync.py.new
|
unexpand -t 3,7,11,15,19,23,27,31,35,39,43,47,51,55,59,63,67,71,75,79,83,87,91,95,99,103,107,111,115,119,123 working/sshync.py > working/sshync.py.new
|
||||||
|
unexpand -t 3,7,11,15,19,23,27,31,35,39,43,47,51,55,59,63,67,71,75,79,83,87,91,95,99,103,107,111,115,119,123 working/stweak.py > working/stweak.py.new
|
||||||
mv working/sshyp.py.new working/sshyp.py
|
mv working/sshyp.py.new working/sshyp.py
|
||||||
mv working/sshync.py.new working/sshync.py
|
mv working/sshync.py.new working/sshync.py
|
||||||
chmod +x working/sshyp.py working/sshync.py
|
mv working/stweak.py.new working/stweak.py
|
||||||
|
chmod +x working/sshyp.py working/sshync.py working/stweak.py
|
||||||
elif [ "$(grep -qP '\t' "$1" && echo TABS)" = 'TABS' ]; then
|
elif [ "$(grep -qP '\t' "$1" && echo TABS)" = 'TABS' ]; then
|
||||||
printf "$1 contains tab characters...\n"
|
printf "$1 contains tab characters...\n"
|
||||||
read -rp 'replace with (4) spaces? (Y/n) ' replace
|
read -rp 'replace with (4) spaces? (Y/n) ' replace
|
||||||
|
|||||||
+20
-5
@@ -16,10 +16,10 @@ if len(arguments) > 0:
|
|||||||
else:
|
else:
|
||||||
s_exit()
|
s_exit()
|
||||||
|
|
||||||
# UNAME-IMPORT
|
# UNAME-IMPORT-SSHYP
|
||||||
# define PORT target
|
# define PORT target
|
||||||
string1 = '# PORT START UNAME-IMPORT'
|
string1 = '# PORT START UNAME-IMPORT-SSHYP'
|
||||||
string2 = '# PORT END UNAME-IMPORT'
|
string2 = '# PORT END UNAME-IMPORT-SSHYP'
|
||||||
|
|
||||||
# read input file
|
# read input file
|
||||||
text = open('working/sshyp.py', 'r').read()
|
text = open('working/sshyp.py', 'r').read()
|
||||||
@@ -31,17 +31,32 @@ 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)
|
||||||
|
|
||||||
|
# UNAME-IMPORT-STWEAK
|
||||||
|
# define PORT target
|
||||||
|
string1 = '# PORT START UNAME-IMPORT-STWEAK'
|
||||||
|
string2 = '# PORT END UNAME-IMPORT-STWEAK'
|
||||||
|
|
||||||
|
# read input file
|
||||||
|
text = open('working/stweak.py', 'r').read()
|
||||||
|
|
||||||
|
# find and replace the defined PORT target
|
||||||
|
regex = re.compile(f"{string1}.*?{string2}\n", re.DOTALL)
|
||||||
|
new_text = re.sub(regex, '', text)
|
||||||
|
|
||||||
|
# write updated text
|
||||||
|
open('working/stweak.py', 'w').write(new_text)
|
||||||
|
|
||||||
# UNAME-TMP
|
# UNAME-TMP
|
||||||
# define PORT target
|
# define PORT target
|
||||||
string1 = '# PORT START UNAME-TMP'
|
string1 = '# PORT START UNAME-TMP'
|
||||||
string2 = '# PORT END UNAME-TMP'
|
string2 = '# PORT END UNAME-TMP'
|
||||||
|
|
||||||
# read input file
|
# read input file
|
||||||
text = open('working/sshyp.py', 'r').read()
|
text = open('working/stweak.py', 'r').read()
|
||||||
|
|
||||||
# find and replace the defined PORT target
|
# find and replace the defined PORT target
|
||||||
regex = re.compile(f"{string1}.*?{string2}", re.DOTALL)
|
regex = re.compile(f"{string1}.*?{string2}", re.DOTALL)
|
||||||
new_text = re.sub(regex, replacement, text)
|
new_text = re.sub(regex, replacement, text)
|
||||||
|
|
||||||
# write updated text
|
# write updated text
|
||||||
open('working/sshyp.py', 'w').write(new_text)
|
open('working/stweak.py', 'w').write(new_text)
|
||||||
|
|||||||
Reference in New Issue
Block a user