🐛 fix(_arch): converting to arch

This commit is contained in:
Eshan Roy
2024-12-01 11:22:05 +05:30
parent 2854c2e02c
commit eb44f204b5

View File

@@ -202,7 +202,7 @@ function start-kex-win() {
# if [ ! -f ~/.config/tigervnc/passwd ]; then # if [ ! -f ~/.config/tigervnc/passwd ]; then
# passwd-set-win # passwd-set-win
# fi # fi
if [ ! -f ~/.vnc/passwd ]; then if [ ! -f ~/.vnc/passwd ]; then
passwd-set-win passwd-set-win
fi fi
@@ -213,14 +213,19 @@ function start-kex-win() {
SCREEN=":1" SCREEN=":1"
fi fi
if ! grep -q "$SCREEN=$USER" "/etc/tigervnc/vncserver.users"; then
echo "$SCREEN=$USER" | sudo tee -a /etc/tigervnc/vncserver.users
fi
if [ -z ${SOUND} ]; then if [ -z ${SOUND} ]; then
print-verbose "Skipping sound support" print-verbose "Skipping sound support"
unset PULSE_SERVER unset PULSE_SERVER
else else
print-verbose "Sound support requested" print-verbose "Sound support requested"
if [ -z "$PULSE_SERVER" ] || [ "${USE_EXISTING_GUI_VARS}" != 1 ]; then export PULSE_SERVER=tcp:${HOSTIP}
export PULSE_SERVER=tcp:${HOSTIP} # if [ -z "$PULSE_SERVER" ] || [ "${USE_EXISTING_GUI_VARS}" != 1 ]; then
fi # export PULSE_SERVER=tcp:${HOSTIP}
# fi
fi fi
## REF: https://github.com/microsoft/WSL/issues/9303 ## REF: https://github.com/microsoft/WSL/issues/9303
@@ -241,8 +246,10 @@ function start-kex-win() {
fi fi
print-verbose "Running Win-KeX server (Win)" print-verbose "Running Win-KeX server (Win)"
${VNCSRV} -useold -xstartup ${XSTARTUP} -SecurityTypes=VeNCrypt,TLSVnc ${SCREEN} >/dev/null 2>&1 </dev/null # ${VNCSRV} -useold -xstartup ${XSTARTUP} -SecurityTypes=VeNCrypt,TLSVnc ${SCREEN} >/dev/null 2>&1 </dev/null
sudo systemctl start vncserver@$SCREEN.sevice >/dev/null 2>&1 </dev/null
result=$? result=$?
if [ "${result}" != "0" ]; then if [ "${result}" != "0" ]; then
print-verbose "${VNCSRV}: ${result}" print-verbose "${VNCSRV}: ${result}"
print-verbose "Possible Win-KeX server (Win) did not start up correctly. Check logs: ~/.vnc/$(hostname).${SCREEN}.log" print-verbose "Possible Win-KeX server (Win) did not start up correctly. Check logs: ~/.vnc/$(hostname).${SCREEN}.log"
@@ -258,9 +265,15 @@ function start-kex-win() {
function stop-kex-win() { function stop-kex-win() {
print-verbose "Stopping Win-KeX server (Win)" print-verbose "Stopping Win-KeX server (Win)"
taskkill.exe /IM win-kex-win-x64 /T /F >/dev/null 2>&1 # taskkill.exe /IM win-kex-win-x64 /T /F >/dev/null 2>&1
local output_1=$(${VNCSRV} -kill :1 2>&1) /init /mnt/c/Windows/system32/taskkill.exe taskkill.exe /IM win-kex-win-x64 /T /F >/dev/null 2>&1
local output_2=$(${VNCSRV} -kill :2 2>&1) # local output_1=$(${VNCSRV} -kill :1 2>&1)
# local output_2=$(${VNCSRV} -kill :2 2>&1)
sudo systemctl stop vncserver@:1.sevice 2>&1
sudo systemctl stop vncserver@:2.sevice 2>&1
local output_1=$(systemctl is-active vncserver@:2.sevice 2>&1)
local output_2=$(systemctl is-active vncserver@:2.sevice 2>&1)
# sudo systemctl stop
if [[ "${output_1}" == *"success!"* || "${output_2}" == *"success!"* ]]; then if [[ "${output_1}" == *"success!"* || "${output_2}" == *"success!"* ]]; then
printf "\t${light_cyan}Win-KeX server (Win) stopped${reset}\n" printf "\t${light_cyan}Win-KeX server (Win) stopped${reset}\n"
return 0 return 0
@@ -311,7 +324,7 @@ function sessions-kex-sl() {
&& vcxsrvhost=1 && vcxsrvhost=1
if [ "${vcxsrvhost}" == "1" ]; then if [ "${vcxsrvhost}" == "1" ]; then
print-verbose "Found possible Win-KeX server (SL) running on host: ${HOSTIP}" print-verbose "Found possible Win-KeX server (SL) running on host: ${HOSTIP}"
XSERVSESSION=0 XSERVSESSION=0 # means server host display on :0.0
return 0 return 0
else else
printf "\tUnable to find Win-KeX server (SL) running on host: ${HOSTIP}" printf "\tUnable to find Win-KeX server (SL) running on host: ${HOSTIP}"
@@ -338,24 +351,35 @@ function start-kex-sl() {
log="/tmp/win-kex-sl_$(whoami).log" log="/tmp/win-kex-sl_$(whoami).log"
print-verbose "Log file: ${log}" print-verbose "Log file: ${log}"
if [ "${USE_EXISTING_GUI_VARS}" != 1 ]; then # if [ "${USE_EXISTING_GUI_VARS}" != 1 ]; then
if ! sessions-kex-sl; then # if ! sessions-kex-sl; then
stop-kex-sl # stop-kex-sl
${XSERV} :${XSERVSESSION} -ac -terminate ${XMULTIMONITORS} -logfile ${log} -logverbose 10 -multiwindow -lesspointer -clipboard ${wgl} >/dev/null 2>&1 & # ${XSERV} :${XSERVSESSION} -ac -terminate ${XMULTIMONITORS} -logfile ${log} -logverbose 10 -multiwindow -lesspointer -clipboard ${wgl} >/dev/null 2>&1 &
result=$? # result=$?
if [ "${result}" != "0" ]; then # if [ "${result}" != "0" ]; then
print-verbose "${XSERV}: ${result}" # print-verbose "${XSERV}: ${result}"
print-verbose "Possible Win-KeX server (SL) may not have been successful" # print-verbose "Possible Win-KeX server (SL) may not have been successful"
fi # fi
status-kex-sl # status-kex-sl
# fi
# fi
if ! session-kex-sl; then
stop-kex-sl
/init /${XSERV} ${XSERV} :${XSERVSESSION} -ac -terminate ${XMULTIMONITORS} -logfile ${log} -logverbose 10 -multiwindow -lesspointer -clipboard ${wgl} >/dev/null 2>&1 &
result=$?
if [ "${result}" != "0" ]; then
print-verbose "${XSERV}: ${result}"
print-verbose "Possible Win-KeX server (SL) may not have been successful"
fi fi
status-kex-sl
fi fi
return 0 return 0
} }
function stop-kex-sl() { function stop-kex-sl() {
print-verbose "Stopping Win-KeX server (SL)" print-verbose "Stopping Win-KeX server (SL)"
taskkill.exe /IM vcxsrv.exe /T /F >/dev/null 2>&1 # taskkill.exe /IM vcxsrv.exe /T /F >/dev/null 2>&1
/init /mnt/c/Windows/system32/taskkill.exe taskkill.exe /IM vcxsrv.exe /T /F >/dev/null 2>&1
if [ "$?" == "0" ]; then if [ "$?" == "0" ]; then
printf "\t${light_cyan}Win-KeX server (SL) stopped${reset}\n" printf "\t${light_cyan}Win-KeX server (SL) stopped${reset}\n"
return 0 return 0
@@ -365,7 +389,8 @@ function stop-kex-sl() {
function status-kex-sl(){ function status-kex-sl(){
##status=$(powershell.exe get-process vcxsrv 2>&1) ##status=$(powershell.exe get-process vcxsrv 2>&1)
status=$(tasklist.exe | grep vcxsrv) # status=$(tasklist.exe | grep vcxsrv)
status=$(/init /mnt/c/Windows/system32/taskkill.exe taskkill.exe | grep vcxsrv)
if [ $? == "0" ]; then if [ $? == "0" ]; then
printf "\t${green}Win-KeX server (SL) is running${reset}\n" printf "\t${green}Win-KeX server (SL) is running${reset}\n"
# 0 = true # 0 = true
@@ -397,7 +422,8 @@ function passwd-read-esm() {
function passwd-exist-esm() { function passwd-exist-esm() {
print-verbose "Checking if password set for Win-KeX server (ESM)" print-verbose "Checking if password set for Win-KeX server (ESM)"
USR=$(whoami) USR=$(whoami)
cmdkey.exe /list:LegacyGeneric:target=TERMSRV/${HOST} | grep -q ${USR} # cmdkey.exe /list:LegacyGeneric:target=TERMSRV/${HOST} | grep -q ${USR}
/init /mnt/c/Windows/system32/cmdkey.exe cmdkey.exe /list:LegacyGeneric:target=TERMSRV/${HOST} | grep -q ${USR}
return $? return $?
} }
@@ -406,7 +432,8 @@ function passwd-set-esm() {
printf "Please enter Win-KeX server (ESM) password for user ${USR}:" printf "Please enter Win-KeX server (ESM) password for user ${USR}:"
passwd=$(passwd-read-esm) passwd=$(passwd-read-esm)
printf "\n" printf "\n"
cmdkey.exe /generic:TERMSRV/${HOST} /user:${USR} /pass:${passwd} >/dev/null 2>&1 & # cmdkey.exe /generic:TERMSRV/${HOST} /user:${USR} /pass:${passwd} >/dev/null 2>&1 &
/init /mnt/c/Windows/system32/cmdkey.exe cmdkey.exe /generic:TERMSRV/${HOST} /user:${USR} /pass:${passwd} >/dev/null 2>&1 &
} }
function status-all() { function status-all() {
@@ -426,9 +453,14 @@ function status-kex-win() {
function sessions-kex-win() { function sessions-kex-win() {
local result local result
sessions=$(vncserver -list | sed s/"TigerVNC"/"Win-KeX"/) # sessions=$(vncserver -list | sed s/"TigerVNC"/"Win-KeX"/)
if [[ ${sessions} == *"590"* ]]; then sessions=$(systemctl is-active vncserver@$SCREEN.service 2>&1)
printf "\n${sessions}\n" # if [[ ${sessions} == *"590"* ]]; then
# printf "\n${sessions}\n"
# printf "\nYou can use the Win-KeX client (Win) to connect to any of these displays\n"
# result=0
if [[ ${sessions} == "active" ]]; then
printf "\n$(echo "Port 590$SCREEN" | sed 's/://')\n"
printf "\nYou can use the Win-KeX client (Win) to connect to any of these displays\n" printf "\nYou can use the Win-KeX client (Win) to connect to any of these displays\n"
result=0 result=0
else else