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:
2023-05-13 20:48:51 -04:00
parent aeb3df7aed
commit 2747aff0bf
9 changed files with 73 additions and 46 deletions
+7
View File
@@ -1,3 +1,10 @@
sshyp v1.4.99
05/13/2023
this is an in-progress update
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
sshyp v1.4.2
04/30/2023
+5 -4
View File
@@ -8,9 +8,9 @@ from shutil import move, rmtree
from sshync import delete as offline_delete, run_profile
from subprocess import CalledProcessError, DEVNULL, PIPE, run
from sys import argv, exit as s_exit
# PORT START UNAME-IMPORT
# PORT START UNAME-IMPORT-SSHYP
from os import uname
# PORT END UNAME-IMPORT
# PORT END UNAME-IMPORT-SSHYP
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"
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}")
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"
f"\u001b[38;5;15;48;5;15m{21*' '}\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{20*' '}\u001b[38;5;15;48;5;8mversion 1.4.99"
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 "
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")
@@ -737,6 +737,7 @@ if __name__ == "__main__":
offline_mode_enabled = sshyp_data.get('CLIENT-GENERAL', 'offline_mode_enabled')
if offline_mode_enabled == 'true':
ssh_error = True
quick_unlock_enabled = 'false'
else:
quick_unlock_enabled = sshyp_data.get('CLIENT-ONLINE', 'quick_unlock_enabled')
username_ssh = sshyp_data.get('SSHYNC', 'user')
+2 -2
View File
@@ -10,9 +10,9 @@ from re import sub
from shutil import get_terminal_size, which
from sshyp import copy_id_check, string_gen
from subprocess import PIPE, run
# PORT START UNAME-IMPORT
# PORT START UNAME-IMPORT-STWEAK
from os import uname
# PORT END UNAME-IMPORT
# PORT END UNAME-IMPORT-STWEAK
home, stdscr, sshyp_data = expanduser("~"), initscr(), ConfigParser()
if isfile(f"{home}/.config/sshyp/sshyp.ini"):
_exists_flag = True
+8 -6
View File
@@ -7,6 +7,8 @@ else
revision="$2"
fi
mkdir -p port-jobs/working
_create_generic_linux() {
printf '\npackaging as generic (Linux)...\n'
mkdir -p output/linuxtemp/usr/bin \
@@ -15,7 +17,7 @@ _create_generic_linux() {
output/linuxtemp/usr/share/bash-completion/completions \
output/linuxtemp/usr/share/zsh/functions/Completion/Unix
# START PORT
cp -r lib/. port-jobs/working/
cp lib/* port-jobs/working/
cd port-jobs
./CLIPTOOL.py LINUX
./CLIPBOARD.py LINUX
@@ -149,7 +151,7 @@ urls {
}
" > output/haikutemp/.PackageInfo
# START PORT
cp -r lib/. port-jobs/working/
cp lib/* port-jobs/working/
cd port-jobs
./SHEBANG.sh
./RMSERVER.py
@@ -197,7 +199,7 @@ Priority: optional
Installed-Size: 71680
" > output/debiantemp/sshyp_"$version"-"$revision"_all/DEBIAN/control
# START PORT
cp -r lib/. port-jobs/working/
cp lib/* port-jobs/working/
cd port-jobs
if [ "$1" = 'Debian' ]; then
./CLIPTOOL.py LINUX
@@ -248,7 +250,7 @@ Priority: optional
Installed-Size: 71680
" > output/termuxtemp/sshyp_"$version"-"$revision"_all_termux/DEBIAN/control
# START PORT
cp -r lib/. port-jobs/working/
cp lib/* port-jobs/working/
cd port-jobs
./CLIPTOOL.py
./CLIPBOARD.py TERMUX
@@ -306,7 +308,7 @@ cp -r %%{_sourcedir}/usr %%{buildroot}
/usr/share/man/man1/sshyp.1.gz
" > ~/rpmbuild/SPECS/sshyp.spec
# START PORT
cp -r lib/. port-jobs/working/
cp lib/* port-jobs/working/
cd port-jobs
./CLIPTOOL.py LINUX
./CLIPBOARD.py LINUX
@@ -367,7 +369,7 @@ printf "/usr/bin/sshyp
/usr/share/man/man1/sshyp.1.gz
" > output/freebsdtemp/plist
# START PORT
cp -r lib/. port-jobs/working/
cp lib/* port-jobs/working/
cd port-jobs
./CLIPTOOL.py LINUX
./CLIPBOARD.py LINUX
+6 -5
View File
@@ -8,11 +8,12 @@ arguments = argv[1:]
# define replacement text depending on arguments
if len(arguments) > 0:
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)"""
elif arguments[0] == 'MAC':
replacement = """run(['pbcopy'], stdin=Popen(['printf', _copy_line[_index].rstrip().replace('\\\\\\', '\\\\\\\\\\\\\\').replace('%', '%%')],
stdout=PIPE).stdout)
replacement = """run(['pbcopy'], stdin=Popen(['printf', _copy_line[_index].rstrip()\
.replace('\\\\\\', '\\\\\\\\\\\\\\').replace('%', '%%')],stdout=PIPE).stdout)
Popen("sleep 30; printf '' | pbcopy", shell=True)"""
elif arguments[0] == 'HAIKU':
replacement = """run(['clipboard', '-c', _copy_line[_index].rstrip()])
@@ -25,8 +26,8 @@ if len(arguments) > 0:
run(['wl-copy', _copy_line[_index].rstrip()])
Popen('sleep 30; wl-copy -c', shell=True)
else:
run(['xclip', '-sel', 'c'], stdin=Popen(['printf', _copy_line[_index].rstrip().replace('\\\\\\', '\\\\\\\\\\\\\\')
.replace('%', '%%')], stdout=PIPE).stdout)
run(['xclip', '-sel', 'c'], stdin=Popen(['printf', _copy_line[_index].rstrip()\
.replace('\\\\\\', '\\\\\\\\\\\\\\').replace('%', '%%')], stdout=PIPE).stdout)
Popen("sleep 30; printf '' | xclip -sel c", shell=True)"""
else:
s_exit()
+11 -12
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
import re
from sys import argv, exit as s_exit
from sys import argv
# read arguments
arguments = argv[1:]
@@ -13,24 +13,23 @@ string2 = '# PORT END CLIPTOOL'
if len(arguments) > 0:
regex = re.compile(f"{string1}.*?{string2}", re.DOTALL)
replacement = """# check for clipboard tool and display warning if missing
if 'WAYLAND_DISPLAY' in environ:
_display_server, _clipboard_tool, _clipboard_package = 'Wayland', 'wl-copy', 'wl-clipboard'
else:
_display_server, _clipboard_tool, _clipboard_package = 'X11', 'xclip', 'xclip'
from shutil import which
if which(_clipboard_tool) is None:
print(f'''\u001b[38;5;9mwarning: you are using {_display_server} and "{_clipboard_tool}" is not present -
if 'WAYLAND_DISPLAY' in environ:
_display_server, _clipboard_tool, _clipboard_package = 'Wayland', 'wl-copy', 'wl-clipboard'
else:
_display_server, _clipboard_tool, _clipboard_package = 'X11', 'xclip', 'xclip'
if which(_clipboard_tool) is None:
print(f'''\n\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
''')"""
''')"""
else:
regex = re.compile(f"{string1}.*?{string2}\n\n", re.DOTALL)
regex = re.compile(f"{string1}.*?{string2}\n", re.DOTALL)
replacement = ''
# read input file
text = open('working/sshyp.py', 'r').read()
text = open('working/stweak.py', 'r').read()
# find and replace the defined PORT target
new_text = re.sub(regex, replacement, text)
# write updated text
open('working/sshyp.py', 'w').write(new_text)
open('working/stweak.py', 'w').write(new_text)
+11 -11
View File
@@ -31,25 +31,25 @@ new_text = re.sub(regex, '', text)
# write updated 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
string1 = '# PORT START TWEAK-DEVTYPE'
string2 = '# PORT END TWEAK-DEVTYPE'
#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)"""
#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()
## read input file
#text = open('working/stweak.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)
#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)
#open('working/stweak.py', 'w').write(new_text)
# ARGS-SERVER
# define PORT target
+3 -1
View File
@@ -2,9 +2,11 @@
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/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/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
printf "$1 contains tab characters...\n"
read -rp 'replace with (4) spaces? (Y/n) ' replace
+20 -5
View File
@@ -16,10 +16,10 @@ if len(arguments) > 0:
else:
s_exit()
# UNAME-IMPORT
# UNAME-IMPORT-SSHYP
# define PORT target
string1 = '# PORT START UNAME-IMPORT'
string2 = '# PORT END UNAME-IMPORT'
string1 = '# PORT START UNAME-IMPORT-SSHYP'
string2 = '# PORT END UNAME-IMPORT-SSHYP'
# read input file
text = open('working/sshyp.py', 'r').read()
@@ -31,17 +31,32 @@ new_text = re.sub(regex, '', text)
# write updated 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
# define PORT target
string1 = '# PORT START UNAME-TMP'
string2 = '# PORT END UNAME-TMP'
# read input file
text = open('working/sshyp.py', 'r').read()
text = open('working/stweak.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)
open('working/stweak.py', 'w').write(new_text)