Skip to content

Commit

Permalink
update kasm init to support egress - arch
Browse files Browse the repository at this point in the history
  • Loading branch information
thelamer committed Sep 9, 2024
1 parent 60e32bd commit b42e2ce
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ RUN \
chown -R 1000:1000 /kasmbins && \
chown 1000:1000 /usr/share/kasmvnc/www/Downloads && \
mkdir -p /dockerstartup && \
mv \
/usr/sbin/notify-send \
/usr/sbin/notify-send-real && \
echo "**** dind support ****" && \
groupadd -r dockremap && \
useradd -r -g dockremap dockremap && \
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile.aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,9 @@ RUN \
chown -R 1000:1000 /kasmbins && \
chown 1000:1000 /usr/share/kasmvnc/www/Downloads && \
mkdir -p /dockerstartup && \
mv \
/usr/sbin/notify-send \
/usr/sbin/notify-send-real && \
echo "**** dind support ****" && \
groupadd -r dockremap && \
useradd -r -g dockremap dockremap && \
Expand Down
32 changes: 32 additions & 0 deletions root/kasminit
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,38 @@ elif ! diff -q /proot-apps/pversion ${HOME}/.local/bin/pversion > /dev/null; the
cp /proot-apps/* ${HOME}/.local/bin/
fi

## Network egress wait ##
while :; do
interfaces=$(ip link show type veth | awk -F: '/^[0-9]+: / {print $2}' | awk '{print $1}' | sed 's/@.*//')
if [ -z "$interfaces" ]; then
sleep 1
continue
fi
for interface in $interfaces; do
if [[ $interface == eth* ]]; then
break 2
fi
if [[ $interface == k-p-* ]]; then
egress_file="/dockerstartup/.egress_status"
while [ ! -f "$egress_file" ]; do
sleep 1
done
egress_status=$(cat $egress_file)
if [ "$egress_status" == "ready" ]; then
if [ -z "$KASM_PROFILE_LDR" ]; then
http_proxy="" https_proxy="" curl -k "https://${KASM_API_HOST}:${KASM_API_PORT}/api/set_kasm_session_status?token=${KASM_API_JWT}" -H 'Content-Type: application/json' -d '{"status": "running"}'
fi
break 2
fi
if [ "$egress_status" == "error" ]; then
echo "Failed to establish egress gateway. Exiting..."
exit 1
fi
fi
done
sleep 1
done

## KasmVNC init ##
# Password
if [[ -f $HOME/.kasmpasswd ]]; then
Expand Down
3 changes: 3 additions & 0 deletions root/usr/bin/notify-send
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#! /bin/bash

dbus-launch /usr/sbin/notify-send-real "$@"

0 comments on commit b42e2ce

Please sign in to comment.