mirror of
https://github.com/Snigdha-OS/snigdhaos-wsl.git
synced 2025-09-20 20:24:57 +02:00
🐛 fix(_arch): converting to arch
This commit is contained in:
82
usr/bin/kex
82
usr/bin/kex
@@ -213,14 +213,19 @@ function start-kex-win() {
|
||||
SCREEN=":1"
|
||||
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
|
||||
print-verbose "Skipping sound support"
|
||||
unset PULSE_SERVER
|
||||
else
|
||||
print-verbose "Sound support requested"
|
||||
if [ -z "$PULSE_SERVER" ] || [ "${USE_EXISTING_GUI_VARS}" != 1 ]; then
|
||||
export PULSE_SERVER=tcp:${HOSTIP}
|
||||
fi
|
||||
export PULSE_SERVER=tcp:${HOSTIP}
|
||||
# if [ -z "$PULSE_SERVER" ] || [ "${USE_EXISTING_GUI_VARS}" != 1 ]; then
|
||||
# export PULSE_SERVER=tcp:${HOSTIP}
|
||||
# fi
|
||||
fi
|
||||
|
||||
## REF: https://github.com/microsoft/WSL/issues/9303
|
||||
@@ -241,8 +246,10 @@ function start-kex-win() {
|
||||
fi
|
||||
|
||||
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=$?
|
||||
|
||||
if [ "${result}" != "0" ]; then
|
||||
print-verbose "${VNCSRV}: ${result}"
|
||||
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() {
|
||||
print-verbose "Stopping Win-KeX server (Win)"
|
||||
taskkill.exe /IM win-kex-win-x64 /T /F >/dev/null 2>&1
|
||||
local output_1=$(${VNCSRV} -kill :1 2>&1)
|
||||
local output_2=$(${VNCSRV} -kill :2 2>&1)
|
||||
# taskkill.exe /IM win-kex-win-x64 /T /F >/dev/null 2>&1
|
||||
/init /mnt/c/Windows/system32/taskkill.exe taskkill.exe /IM win-kex-win-x64 /T /F >/dev/null 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
|
||||
printf "\t${light_cyan}Win-KeX server (Win) stopped${reset}\n"
|
||||
return 0
|
||||
@@ -311,7 +324,7 @@ function sessions-kex-sl() {
|
||||
&& vcxsrvhost=1
|
||||
if [ "${vcxsrvhost}" == "1" ]; then
|
||||
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
|
||||
else
|
||||
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"
|
||||
print-verbose "Log file: ${log}"
|
||||
|
||||
if [ "${USE_EXISTING_GUI_VARS}" != 1 ]; then
|
||||
if ! sessions-kex-sl; then
|
||||
stop-kex-sl
|
||||
${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
|
||||
status-kex-sl
|
||||
# if [ "${USE_EXISTING_GUI_VARS}" != 1 ]; then
|
||||
# if ! sessions-kex-sl; then
|
||||
# stop-kex-sl
|
||||
# ${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
|
||||
# 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
|
||||
status-kex-sl
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
function stop-kex-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
|
||||
printf "\t${light_cyan}Win-KeX server (SL) stopped${reset}\n"
|
||||
return 0
|
||||
@@ -365,7 +389,8 @@ function stop-kex-sl() {
|
||||
|
||||
function status-kex-sl(){
|
||||
##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
|
||||
printf "\t${green}Win-KeX server (SL) is running${reset}\n"
|
||||
# 0 = true
|
||||
@@ -397,7 +422,8 @@ function passwd-read-esm() {
|
||||
function passwd-exist-esm() {
|
||||
print-verbose "Checking if password set for Win-KeX server (ESM)"
|
||||
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 $?
|
||||
}
|
||||
|
||||
@@ -406,7 +432,8 @@ function passwd-set-esm() {
|
||||
printf "Please enter Win-KeX server (ESM) password for user ${USR}:"
|
||||
passwd=$(passwd-read-esm)
|
||||
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() {
|
||||
@@ -426,9 +453,14 @@ function status-kex-win() {
|
||||
|
||||
function sessions-kex-win() {
|
||||
local result
|
||||
sessions=$(vncserver -list | sed s/"TigerVNC"/"Win-KeX"/)
|
||||
if [[ ${sessions} == *"590"* ]]; then
|
||||
printf "\n${sessions}\n"
|
||||
# sessions=$(vncserver -list | sed s/"TigerVNC"/"Win-KeX"/)
|
||||
sessions=$(systemctl is-active vncserver@$SCREEN.service 2>&1)
|
||||
# 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"
|
||||
result=0
|
||||
else
|
||||
|
Reference in New Issue
Block a user