Redo plasma to use novnc from alpine

This commit is contained in:
Myve 2025-01-20 09:45:38 +00:00
commit d3411e2fe9
6 changed files with 89 additions and 18 deletions

24
plasma/app/entrypoint Executable file
View file

@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Export all variables
set -a
# Abort if an error is encountered
set -e
# SSH config
if [ -f ~/.ssh/id_ed25519 ]
then
chmod 0600 ~/.ssh/id_ed25519
fi
# Run all scripts in init folder
for file in /app/init.d/*.sh
do
/usr/bin/bash -c ${file} >>/app/logs/$(echo ${file} | sed 's|/app/init.d/||;s|\.sh$||').log
done
# Read cli parameters
exec "${@}" &
# Monitor log
tail -f /app/logs/*.log

6
plasma/app/init.d/01-init.sh Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env bash
# Create base directories
for dir in ssh config/tigervnc
do
[ -d ~/.${dir} ] || mkdir -p ~/.${dir}
done

View file

@ -0,0 +1,51 @@
#!/usr/bin/env bash
# Check for MYVNC_VNCPASS variable
if [ -z ${MYVNC_VNCPASS} ]
then
echo "MYVNC_VNCPASS env variable is missing"
exit 1
fi
# Configure tigervnc auth
if [ ! -f ~/.config/tigervnc/passwd ]
then
echo "${MYVNC_VNCPASS}" | vncpasswd -f >~/.config/tigervnc/passwd
chmod 0600 ~/.config/tigervnc/passwd
fi
# Remove VNCPASS env
unset MYVNC_VNCPASS
# VNC xstartup
install /dev/stdin ~/.config/tigervnc/xstartup <<- xstartup
#!/usr/bin/env bash
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec ${STARTXBIN}
xstartup
# Turn vnc sharing on/off
if [[ ${MYVNC_VNCSHARING} == "true" ]] || [[ ${MYVNC_VNCSHARING} == "1" ]]
then
_MYVNC_VNCSHARING=alwaysshared
else
_MYVNC_VNCSHARING=nevershared
fi
# VNC config
cat >~/.config/tigervnc/config <<- vncconfig
session=plasmax11
dpi=192
geometry=1920x1080
framerate=60
depth=32
${_MYVNC_VNCSHARING}
vncconfig
# Disable KDE screenlock
cat >~/.config/kscreenlockerrc <<- 'kscreenlockerrc'
[Daemon]
Autolock=false
LockOnResume=false
Timeout=0
kscreenlockerrc

View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
# Launch Tigervnc
/usr/bin/dbus-launch vncserver :0 &