Skip to content

Commit

Permalink
fix(desktop-lite): initial environment for services
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Aug 13, 2024
1 parent 4d48356 commit 7e1ace9
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 10 deletions.
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.0.0",
"version": "1.0.1",
"documentationURL": "https://github.com/Automattic/vip-codespaces/tree/trunk/features/src/desktop-lite",
"containerEnv": {
"DISPLAY": "127.0.0.1:0"
Expand Down
7 changes: 3 additions & 4 deletions features/src/desktop-lite/entrypoint.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ else
fi

# shellcheck disable=SC2154,SC2086
setpriv --reuid="${_REMOTE_USER}" --regid="${_REMOTE_USER}" --inh-caps=-all --init-groups \
/usr/bin/Xtigervnc -geometry "${VNC_GEOMETRY}" -listen tcp -ac ${AUTH_OPTS} -AlwaysShared -AcceptKeyEvents -AcceptPointerEvents -SendCutText -AcceptCutText :0 &
DISPLAY=:0 setpriv --reuid="${_REMOTE_USER}" --regid="${_REMOTE_USER}" --inh-caps=-all --init-groups /usr/bin/openbox &
setpriv --reuid="${_REMOTE_USER}" --regid="${_REMOTE_USER}" --inh-caps=-all --init-groups /usr/local/bin/easy-novnc -a :5800 -h 127.0.0.1 --no-url-password &
su -s /bin/sh -c "/usr/bin/Xtigervnc -geometry \"${VNC_GEOMETRY}\" -listen tcp -ac ${AUTH_OPTS} -AlwaysShared -AcceptKeyEvents -AcceptPointerEvents -SendCutText -AcceptCutText :0" "${_REMOTE_USER}" &
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}" &
2 changes: 1 addition & 1 deletion features/src/desktop-lite/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ if [ "${ENABLED}" = "true" ]; then
PACKAGES="${PACKAGES} tigervnc-standalone-server"
fi

if ! hash tigervncpasswd >/dev/null 2>&1; then
if ! hash tigervncpasswd >/dev/null 2>&1 && [ -n "$(apt-cache --names-only search '^tigervnc-tools$')" ]; then
PACKAGES="${PACKAGES} tigervnc-tools"
fi

Expand Down
7 changes: 6 additions & 1 deletion features/src/desktop-lite/service-run.novnc.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,10 @@ set -eu
exec 2>&1

# shellcheck disable=SC2154
exec chpst -u "${_REMOTE_USER}:${_REMOTE_USER}" \
export USER="${_REMOTE_USER}"
export LOGNAME="${USER}"
# shellcheck disable=SC2155
export HOME="$(getent passwd "${USER}" | cut -d: -f6)"

exec chpst -u "${USER}:${USER}" \
/usr/local/bin/easy-novnc -a :5800 -h 127.0.0.1 --no-url-password
7 changes: 6 additions & 1 deletion features/src/desktop-lite/service-run.openbox.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ sv start tigervnc || true

export DISPLAY=:0
# shellcheck disable=SC2154
exec chpst -u "${_REMOTE_USER}:${_REMOTE_USER}" /usr/bin/openbox
export USER="${_REMOTE_USER}"
export LOGNAME="${USER}"
# shellcheck disable=SC2155
export HOME="$(getent passwd "${USER}" | cut -d: -f6)"

exec chpst -u "${USER}:${USER}" /usr/bin/openbox
10 changes: 8 additions & 2 deletions features/src/desktop-lite/service-run.tigervnc.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ else
AUTH_OPTS="-SecurityTypes None"
fi

# shellcheck disable=SC2154,SC2086
exec chpst -u "${_REMOTE_USER}:${_REMOTE_USER}" \
# shellcheck disable=SC2154
export USER="${_REMOTE_USER}"
export LOGNAME="${USER}"
# shellcheck disable=SC2155
export HOME="$(getent passwd "${USER}" | cut -d: -f6)"

# shellcheck disable=SC2086
exec chpst -u "${USER}:${USER}" \
/usr/bin/Xtigervnc -geometry "${VNC_GEOMETRY}" -listen tcp -ac ${AUTH_OPTS} -AlwaysShared -AcceptKeyEvents -AcceptPointerEvents -SendCutText -AcceptCutText :0

Check warning on line 24 in features/src/desktop-lite/service-run.tigervnc.tpl

View workflow job for this annotation

GitHub Actions / Lint with shellcheck

VNC_GEOMETRY is referenced but not assigned.

0 comments on commit 7e1ace9

Please sign in to comment.