From 7082dfb0f5625b23d99b678bb40eb41a4e4de496 Mon Sep 17 00:00:00 2001 From: myve Date: Thu, 25 Jul 2024 01:26:27 +0000 Subject: [PATCH] Update plasma webtop --- base/mirrorlist | 21 +++++++ plasma/.env | 8 +++ plasma/10-tigervnc.sh | 51 +++++++++++++++++ plasma/90-tigervnc.sh | 3 + plasma/Dockerfile | 31 +++++++++++ plasma/docker-compose.yaml | 28 ++++++++++ plasma/up | 27 +++++++++ plasma/webtop:plasma.sh | 109 ------------------------------------- 8 files changed, 169 insertions(+), 109 deletions(-) create mode 100644 base/mirrorlist create mode 100644 plasma/.env create mode 100755 plasma/10-tigervnc.sh create mode 100755 plasma/90-tigervnc.sh create mode 100644 plasma/Dockerfile create mode 100644 plasma/docker-compose.yaml create mode 100755 plasma/up delete mode 100644 plasma/webtop:plasma.sh diff --git a/base/mirrorlist b/base/mirrorlist new file mode 100644 index 0000000..e37c414 --- /dev/null +++ b/base/mirrorlist @@ -0,0 +1,21 @@ +################################################################################ +################# Arch Linux mirrorlist generated by Reflector ################# +################################################################################ + +# With: reflector --country CA,US --protocol https --sort rate --age 24 --latest 10 --fastest 10 --exclude 'tyzoid|cicku' +# When: 2024-07-19 19:44:07 UTC +# From: https://archlinux.org/mirrors/status/json/ +# Retrieved: 2024-07-19 19:43:57 UTC +# Last Check: 2024-07-19 19:22:47 UTC + +Server = https://mirror.sfo12.us.leaseweb.net/archlinux/$repo/os/$arch +Server = https://mirror.qctronics.com/archlinux/$repo/os/$arch +Server = https://arch.mirror.constant.com/$repo/os/$arch +Server = https://mirror.wdc1.us.leaseweb.net/archlinux/$repo/os/$arch +Server = https://mirrors.vectair.net/archlinux/$repo/os/$arch +Server = https://america.mirror.pkgbuild.com/$repo/os/$arch +Server = https://mirrors.lug.mtu.edu/archlinux/$repo/os/$arch +Server = https://us.arch.niranjan.co/$repo/os/$arch +Server = https://mirror.theash.xyz/arch/$repo/os/$arch +Server = https://mirror.tmmworkshop.com/archlinux/$repo/os/$arch + diff --git a/plasma/.env b/plasma/.env new file mode 100644 index 0000000..9098a80 --- /dev/null +++ b/plasma/.env @@ -0,0 +1,8 @@ +# .env for myvnc KDE plasma webtop +MYVNC_KDEPLASMA_PORT= +MYVNC_KDEPLASMA_VNCPASS= + +MYVNC_KDEPLASMA_CUSTOM_TITLE= +MYVNC_KDEPLASMA_PROXYPATH= + +MYVNC_KDEPLASMA_VNCSHARING= diff --git a/plasma/10-tigervnc.sh b/plasma/10-tigervnc.sh new file mode 100755 index 0000000..8a0ddf5 --- /dev/null +++ b/plasma/10-tigervnc.sh @@ -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 ~/.vnc/passwd ] +then + echo "${MYVNC_VNCPASS}" | vncpasswd -f >~/.vnc/passwd + chmod 0600 ~/.vnc/passwd +fi + +# Remove VNCPASS env +unset MYVNC_VNCPASS + +# VNC xstartup +install /dev/stdin ~/.vnc/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 >~/.vnc/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 diff --git a/plasma/90-tigervnc.sh b/plasma/90-tigervnc.sh new file mode 100755 index 0000000..c187a37 --- /dev/null +++ b/plasma/90-tigervnc.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +# Launch Tigervnc +/usr/bin/dbus-launch vncserver :0 & diff --git a/plasma/Dockerfile b/plasma/Dockerfile new file mode 100644 index 0000000..131bd9e --- /dev/null +++ b/plasma/Dockerfile @@ -0,0 +1,31 @@ +# syntax = docker/dockerfile:1 +FROM myvnc/arch/base +USER root + +# X session environment variable +ENV STARTXBIN=startplasma-x11 + +# Install packages +RUN --mount=type=cache,sharing=locked,target=/var/cache/pacman \ + pacman -Syu --ask 4 --needed \ + tigervnc \ + cuda openssh vim pacman-contrib rsync git \ + plasma konsole kate dolphin kompare kcalc \ + jack2 ttf-dejavu \ + firefox firefox-decentraleyes firefox-ublock-origin \ + torbrowser-launcher \ + shotwell ffmpegthumbs ark okular \ + remmina libvncserver \ + && pacman -Scc --ask 4 \ + && printf '%s\n' 'Cmnd_Alias MISCELLANEOUS = /usr/bin/pacman' >/etc/sudoers.d/01-MISCELLANEOUS + +# configure nvidia container runtime +# https://github.com/NVIDIA/nvidia-container-runtime#environment-variables-oci-spec +ENV NVIDIA_VISIBLE_DEVICES=all +ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility + +# Tigervnc +COPY *.sh /app/init.d/ + +# Reset user home directory +USER user diff --git a/plasma/docker-compose.yaml b/plasma/docker-compose.yaml new file mode 100644 index 0000000..76d9212 --- /dev/null +++ b/plasma/docker-compose.yaml @@ -0,0 +1,28 @@ +services: + kdeplasma: + image: myvnc/arch/webtop:plasma + container_name: kdeplasma + restart: unless-stopped + build: . + ports: + - ${MYVNC_KDEPLASMA_PORT}:6900 + environment: + MYVNC_VNCPASS: ${MYVNC_KDEPLASMA_VNCPASS} + MYVNC_CUSTOM_TITLE: ${MYVNC_KDEPLASMA_CUSTOM_TITLE} + MYVNC_PROXYPATH: ${MYVNC_KDEPLASMA_PROXYPATH} + MYVNC_VNCSHARING: ${MYVNC_KDEPLASMA_VNCSHARING} + networks: + - kdeplasma + # Optional + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: all + capabilities: + - gpu + +networks: + kdeplasma: + external: false diff --git a/plasma/up b/plasma/up new file mode 100755 index 0000000..fac9971 --- /dev/null +++ b/plasma/up @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +# Docker build +# Optional buildtag +# DOCKER_BUILDKIT=1 \ +# docker build . \ +# --build-arg debug=${debug:-""} \ +# --tag ${buildtag:-myvnc/novnc} +# Grab options +while [ ${1} ] +do + case ${1} in + -b | --build | b | build ) + build="--build" + ;; + -d | --detach | d | detach ) + detach="--detach" + ;; + bd | db ) + build="--build" + detach="--detach" + ;; + esac + shift +done + +# Compose up +docker compose up ${build} ${detach} diff --git a/plasma/webtop:plasma.sh b/plasma/webtop:plasma.sh deleted file mode 100644 index 0f101d9..0000000 --- a/plasma/webtop:plasma.sh +++ /dev/null @@ -1,109 +0,0 @@ -## Dockerfile -cat >Dockerfile <<- 'Dockerfile' -# syntax = docker/dockerfile:1.2 -FROM myvnc/base -USER root - -# X session environment variable -ENV STARTXBIN startplasma-x11 - -# Install packages -RUN --mount=type=cache,sharing=locked,target=/var/cache/pacman \ - pacman -Syu --ask 4 --needed \ - tigervnc \ - cuda openssh vim pacman-contrib rsync git \ - plasma konsole kate dolphin kompare kcalc \ - jack2 ttf-dejavu \ - firefox firefox-decentraleyes firefox-ublock-origin \ - torbrowser-launcher \ - shotwell ffmpegthumbs ark okular \ - remmina libvncserver \ - && pacman -Scc --ask 4 \ - && echo 'Cmnd_Alias MISCELLANEOUS = /usr/bin/pacman -S' >/etc/sudoers.d/01-MISCELLANEOUS - -# configure nvidia container runtime -# https://github.com/NVIDIA/nvidia-container-runtime#environment-variables-oci-spec -ENV NVIDIA_VISIBLE_DEVICES all -ENV NVIDIA_DRIVER_CAPABILITIES compute,utility - -# Tigervnc -COPY 10-tigervnc.sh 90-tigervnc.sh /app/init.d/ -RUN chmod +x /app/init.d/* - -# Reset user home directory -USER user -WORKDIR /home/user -Dockerfile - -## Plasma/tigervnc Setup -cat >10-tigervnc.sh <<- '10-tigervnc.sh' -#!/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 ~/.vnc/passwd ] -then - echo "${MYVNC_VNCPASS}" | vncpasswd -f >~/.vnc/passwd - chmod 0600 ~/.vnc/passwd -fi - -# Remove VNCPASS env -unset MYVNC_VNCPASS - -# VNC xstartup -install /dev/stdin ~/.vnc/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 >~/.vnc/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 - -# SSH config -if [ -f ~/.ssh/id_ed25519 ] -then - chmod 0600 ~/.ssh/id_ed25519 -fi -10-tigervnc.sh - -## TigerVNC launch script -cat >90-tigervnc.sh <<- '90-tigervnc.sh' -#!/usr/bin/env bash -# Launch Tigervnc -/usr/bin/dbus-launch vncserver :0 & -90-tigervnc.sh - -## Docker build -DOCKER_BUILDKIT=1 docker build ./. \ - --tag myvnc/webtop:plasma \ - && rm -f Dockerfile *.sh \ No newline at end of file