Skip to content

Commit

Permalink
Auth wont work this way
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Czyz <[email protected]>
  • Loading branch information
mczyz-antmicro committed Mar 25, 2024
1 parent 902d92b commit a731d33
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
10 changes: 10 additions & 0 deletions common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ export VNC_RESOLUTION="1920x1080x32"
export LANG="en_US.UTF-8"
export LANGUAGE="en_US.UTF-8"

# Try to kill pid based on name
kill_pid()
{
PIDS_TO_KILL=$(ps axjf | grep $1 | awk '{print $2}')
for PID in ${PIDS_TO_KILL[@]}; do
echo "Attempting to kill $PID"
kill -9 $PID
done
}

# Execute the command it not already running
startInBackgroundIfNotRunning()
{
Expand Down
3 changes: 1 addition & 2 deletions desktop-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ sudoIf chown root:${group_name} /tmp/.X11-unix
if [ "$(echo "${VNC_RESOLUTION}" | tr -cd 'x' | wc -c)" = "1" ]; then VNC_RESOLUTION=${VNC_RESOLUTION}x16; fi
screen_geometry="${VNC_RESOLUTION%*x*}"
screen_depth="${VNC_RESOLUTION##*x}"
startInBackgroundIfNotRunning "Xtigervnc" sudoUserIf "tigervncserver ${DISPLAY} -geometry ${screen_geometry} -depth ${screen_depth} -rfbport 5901 -dpi ${VNC_DPI:-96} -localhost -desktop fluxbox -fg"
# -passwd /usr/local/etc/vscode-dev-containers/vnc-passwd
startInBackgroundIfNotRunning "Xtigervnc" sudoUserIf "tigervncserver ${DISPLAY} -geometry ${screen_geometry} -depth ${screen_depth} -rfbport 5901 -dpi ${VNC_DPI:-96} -localhost -desktop fluxbox -fg" -passwd /usr/local/etc/vscode-dev-containers/vnc-passwd

# Spin up noVNC if installed and not running.
if [ -d "/usr/local/novnc" ] && [ "$(ps -ef | grep /usr/local/novnc/noVNC*/utils/launch.sh | grep -v grep)" = "" ]; then
Expand Down
12 changes: 3 additions & 9 deletions update-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,11 @@ EOF

echo "${fluxbox_menu}" > ~/.fluxbox/menu

# Try to kill existing tigervncserver
PIDS_TO_KILL=$(ps axjf | grep tigervncserver | awk '{print $2}')
echo "PIDS TO KILL = $PIDS_TO_KILL"
pkill -9 "${PIDS_TO_KILL[0]}"

# Try to kill existing novnc
PIDS_TO_KILL=$(ps axjf | grep novnc | awk '{print $2}')
echo "PIDS TO KILL = $PIDS_TO_KILL"
pkill -9 "${PIDS_TO_KILL[0]}"
kill_pid tigervncserver
kill_pid novnc

ps axjf | grep tigervncserver
ps axjf | grep novnc

bash desktop-update.sh
# rm -f /usr/local/etc/vscode-dev-containers/vnc-passwd

0 comments on commit a731d33

Please sign in to comment.