summaryrefslogtreecommitdiff
path: root/net-misc/tigervnc/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-06-24 13:27:08 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-06-24 13:27:08 +0100
commitbfc2a8298cab03d289dc2cfed63308396fa0babe (patch)
tree2d4288572b0938dcfc64edd39a4c1086402931a5 /net-misc/tigervnc/files
parente28a6e6eb5373071be3a09aa457f0488d753c80c (diff)
gentoo auto-resync : 24:06:2023 - 13:27:08
Diffstat (limited to 'net-misc/tigervnc/files')
-rw-r--r--net-misc/tigervnc/files/tigervnc-1.13.1.confd13
-rw-r--r--net-misc/tigervnc/files/tigervnc-1.13.1.initd88
2 files changed, 101 insertions, 0 deletions
diff --git a/net-misc/tigervnc/files/tigervnc-1.13.1.confd b/net-misc/tigervnc/files/tigervnc-1.13.1.confd
new file mode 100644
index 000000000000..bb6dae7df032
--- /dev/null
+++ b/net-misc/tigervnc/files/tigervnc-1.13.1.confd
@@ -0,0 +1,13 @@
+# Config file for /etc/init.d/tigervnc
+
+# Add the user(s) Xvnc(1) should be run for to /etc/tigervnc/vncserver.users
+# DISPLAYS is no loger used.
+
+# Optionally override the default Xsession file
+# TIGERVNC_XSESSION_FILE="/usr/share/sddm/scripts/Xsession"
+# TIGERVNC_XSESSION_FILE="/etc/gdm/Xsession"
+# TIGERVNC_XSESSION_FILE="/etc/lightdm/Xsession"
+# TIGERVNC_XSESSION_FILE="/usr/share/slim/Xsession"
+
+# vncsession no longer supports VNC_OPTS
+# Use /etc/tigervnc/vncserver-config-defaults or $HOME/.vnc/config instead
diff --git a/net-misc/tigervnc/files/tigervnc-1.13.1.initd b/net-misc/tigervnc/files/tigervnc-1.13.1.initd
new file mode 100644
index 000000000000..f7e72fa84c07
--- /dev/null
+++ b/net-misc/tigervnc/files/tigervnc-1.13.1.initd
@@ -0,0 +1,88 @@
+#!/sbin/openrc-run
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License, v2 or later
+
+# shellcheck shell=sh
+
+# Create symlinks for all displays.
+# For example for display :1, run `ln -s tigervnc /etc/init.d/tigervnc.1`
+# Then `rc-update add tigervnc.1 default`
+# For compatibility, /etc/init.d/tigervnc will start all displays.
+
+DISPLAYS=${SVCNAME#*.}
+if [ "$DISPLAYS" = "tigervnc" ]; then
+ should_warn=1
+ DISPLAYS=$(grep -v "^#" /etc/tigervnc/vncserver.users | sed -e 's/=.*//' -e 's/^://')
+fi
+
+depend() {
+ need net
+}
+
+checkconfig() {
+ if [ -n "${DISPLAYS}" ]; then
+ if [ "$1" = "start" ]; then
+ for display in $DISPLAYS; do
+ user="$(grep "^:${display}" /etc/tigervnc/vncserver.users)"
+ user=${user#*=}
+ # bug #690046
+ if [ -z "${user}" ]; then
+ eerror "User is not defined for display :${display} in /etc/tigervnc/vncserver.users"
+ return 1
+ elif ! runuser -l "${user}" -c "[ -f ~/.vnc/passwd ]"; then
+ eerror "There are no passwords defined for user ${user}."
+ return 1
+ elif [ -e "/tmp/.X11-unix/X${display}" ]; then
+ eerror "Display :${display} appears to be already in use because of /tmp/.X11-unix/X${display}"
+ eerror "Remove this file if there is no X server for :${display}"
+ return 1
+ elif [ -e "/tmp/.X${display}-lock" ]; then
+ eerror "Display :${display} appears to be already in use because of /tmp/.X${display}-lock"
+ eerror "Remove this file if there is no X server for :${display}"
+ return 1
+ fi
+ FREEDISPLAYS="${FREEDISPLAYS} ${display}"
+ done
+ fi
+ return 0
+ else
+ eerror 'There are no displays configured in /etc/tigervnc/vncserver.users'
+ return 1
+ fi
+}
+
+checkwarn() {
+ if [ "${should_warn}" = "1" ]; then
+ ewarn 'Running /etc/init.d/tigervnc in compatibility mode'
+ ewarn 'Please migrate to one service per display as detailed here:'
+ ewarn 'https://wiki.gentoo.org/wiki/TigerVNC#Migrating_from_1.13.1-r2_or_lower:'
+ fi
+}
+
+start() {
+ checkwarn
+ FREEDISPLAYS=""
+ checkconfig start || return 1
+ for display in $FREEDISPLAYS; do
+ [ -n "${TIGERVNC_XSESSION_FILE}" ] && export TIGERVNC_XSESSION_FILE
+ ebegin "Starting TigerVNC server :${display}"
+ start-stop-daemon --start --pidfile=/run/vncsession-":${display}".pid /usr/libexec/vncsession-start -- ":${display}"
+ eend $?
+ done
+}
+
+stop() {
+ checkconfig stop || return 2
+ for display in $DISPLAYS; do
+ ebegin "Stopping TigerVNC server :${display}"
+ start-stop-daemon --stop --pidfile=/run/vncsession-":${display}".pid
+ eend $?
+ done
+ # Do not fail if a server is missing
+ /bin/true
+}
+
+restart() {
+ svc_stop
+ svc_start
+}