Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion features/src/desktop-lite/devcontainer-feature.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "desktop-lite",
"name": "Desktop Lite",
"description": "A lightweight desktop environment for development.",
"version": "1.1.0",
"version": "1.1.1",
"documentationURL": "https://github.com/Automattic/vip-codespaces/tree/trunk/features/src/desktop-lite",
"containerEnv": {
"DISPLAY": "127.0.0.1:0"
Expand Down
12 changes: 12 additions & 0 deletions features/src/desktop-lite/entrypoint.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,17 @@ fi

# shellcheck disable=SC2154,SC2086
su -s /bin/sh -c "/usr/bin/Xtigervnc -geometry \"${VNC_GEOMETRY}\" -listen tcp -ac ${AUTH_OPTS} -AlwaysShared -AcceptKeyEvents -AcceptPointerEvents -SendCutText -AcceptCutText :0" "${_REMOTE_USER}" &

cnt=0
while [ ! -S /tmp/.X11-unix/X0 ] && [ "${cnt}" -lt 10 ]; do
sleep 1
cnt=$((cnt + 1))
done

if [ ! -S /tmp/.X11-unix/X0 ]; then
echo "Xtigervnc did not make display :0 available" >&2
exit 1
fi

DISPLAY=:0 su -s /bin/sh -c '/usr/bin/openbox' "${_REMOTE_USER}" &
su -s /bin/sh -c '/usr/local/bin/easy-novnc -a :5800 -h 127.0.0.1 --no-url-password' "${_REMOTE_USER}" &
47 changes: 19 additions & 28 deletions features/test/desktop-lite/checks.sh
Original file line number Diff line number Diff line change
@@ -1,50 +1,41 @@
#!/bin/bash

# Wait for the X server to be available before running checks
cnt=0
while [[ ! -S /tmp/.X11-unix/X0 ]] && [[ "${cnt}" -lt 10 ]]; do
sleep 1
cnt=$((cnt + 1))
done

cnt=0
while ! pgrep openbox > /dev/null 2>&1 && [[ "${cnt}" -lt 5 ]]; do
sleep 1
cnt=$((cnt + 1))
done

cnt=0
while ! pgrep easy-novnc > /dev/null 2>&1 && [[ "${cnt}" -lt 5 ]]; do
sleep 1
cnt=$((cnt + 1))
done

if hash sv > /dev/null 2>&1; then
check "tigervnc is running" sudo sh -c 'sv status tigervnc | grep -E ^run:'
sudo sv stop tigervnc
check "tigervnc is stopped" sudo sh -c 'sv status tigervnc | grep -E ^down:'
sudo sv start tigervnc
# shellcheck disable=SC2034
for i in {1..10}; do
# shellcheck disable=SC2312
sudo sv status tigervnc | grep -Eq '^run:' && break
sleep 1
done
check "tigervnc is running" sudo sh -c 'sv status tigervnc | grep -E ^run:'

# shellcheck disable=SC2312
if ! sudo sv status openbox | grep -E ^run:; then
sudo ps faux
sudo cat /var/log/*
fi
check "openbox is running" sudo sh -c 'sv status openbox | grep -E ^run:'
sudo sv stop openbox
check "openbox is stopped" sudo sh -c 'sv status openbox | grep -E ^down:'
sudo sv start openbox
# shellcheck disable=SC2034
for i in {1..10}; do
# shellcheck disable=SC2312
sudo sv status openbox | grep -Eq '^run:' && break
sleep 1
done
# shellcheck disable=SC2312
if ! sudo sv status openbox | grep -E ^run:; then
sudo ps faux
sudo cat /var/log/*
fi
check "openbox is running" sudo sh -c 'sv status openbox | grep -E ^run:'

check "novnc is running" sudo sh -c 'sv status novnc | grep -E ^run:'
sudo sv stop novnc
check "novnc is stopped" sudo sh -c 'sv status novnc | grep -E ^down:'
sudo sv start novnc
# shellcheck disable=SC2034
for i in {1..10}; do
# shellcheck disable=SC2312
sudo sv status novnc | grep -Eq '^run:' && break
sleep 1
done
check "novnc is running" sudo sh -c 'sv status novnc | grep -E ^run:'
else
check "tigervnc is running" pgrep Xtigervnc
Expand Down
Loading