public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Viorel Munteanu" <ceamac@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/tigervnc/, net-misc/tigervnc/files/
Date: Sat, 22 Jun 2024 07:57:11 +0000 (UTC)	[thread overview]
Message-ID: <1719042989.1031f5a7340e83c2cc260c3948e458274a3badd0.ceamac@gentoo> (raw)

commit:     1031f5a7340e83c2cc260c3948e458274a3badd0
Author:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 22 07:51:34 2024 +0000
Commit:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
CommitDate: Sat Jun 22 07:56:29 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1031f5a7

net-misc/tigervnc: fix tigervnc config path check

New users use ${XDG_CONFIG_HOME}/tigervnc, existing users can still use ~/.vnc

Closes: https://bugs.gentoo.org/934624
Signed-off-by: Viorel Munteanu <ceamac <AT> gentoo.org>

 net-misc/tigervnc/files/tigervnc-1.13.90.initd     | 91 ++++++++++++++++++++++
 ...c-1.13.90.ebuild => tigervnc-1.13.90-r1.ebuild} |  5 +-
 2 files changed, 94 insertions(+), 2 deletions(-)

diff --git a/net-misc/tigervnc/files/tigervnc-1.13.90.initd b/net-misc/tigervnc/files/tigervnc-1.13.90.initd
new file mode 100644
index 000000000000..bf9eee12787b
--- /dev/null
+++ b/net-misc/tigervnc/files/tigervnc-1.13.90.initd
@@ -0,0 +1,91 @@
+#!/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
+				# 1.13.90 changed the default config directory to ~/.config/tigervnc
+				# but still supports ~/.vnc if not found
+				elif ! runuser -l "${user}" -s /bin/bash -c \
+					"[[ ( -d ${XDG_CONFIG_HOME:-~/.config}/tigervnc && -f ${XDG_CONFIG_HOME:-~/.config}/tigervnc/passwd ) || ( ! -d ${XDG_CONFIG_HOME:-~/.config}/tigervnc && -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
+}

diff --git a/net-misc/tigervnc/tigervnc-1.13.90.ebuild b/net-misc/tigervnc/tigervnc-1.13.90-r1.ebuild
similarity index 97%
rename from net-misc/tigervnc/tigervnc-1.13.90.ebuild
rename to net-misc/tigervnc/tigervnc-1.13.90-r1.ebuild
index 5115c063e325..24dd8515063c 100644
--- a/net-misc/tigervnc/tigervnc-1.13.90.ebuild
+++ b/net-misc/tigervnc/tigervnc-1.13.90-r1.ebuild
@@ -199,7 +199,7 @@ src_install() {
 		rm -v "${ED}"/usr/$(get_libdir)/xorg/modules/extensions/libvnc.la || die
 
 		newconfd "${FILESDIR}"/${PN}-1.13.1.confd ${PN}
-		newinitd "${FILESDIR}"/${PN}-1.13.1.initd ${PN}
+		newinitd "${FILESDIR}"/${PN}-1.13.90.initd ${PN}
 
 		systemd_douserunit unix/vncserver/vncserver@.service
 
@@ -215,9 +215,10 @@ src_install() {
 pkg_postinst() {
 	xdg_pkg_postinst
 
-	use server && {
+	use server && [[ -n ${REPLACING_VERSIONS} ]] && ver_test "${REPLACING_VERSIONS}" -lt 1.13.1-r3 && {
 		elog 'OpenRC users: please migrate to one service per display as documented here:'
 		elog 'https://wiki.gentoo.org/wiki/TigerVNC#Migrating_from_1.13.1-r2_or_lower:'
+		elog
 	}
 
 	local OPTIONAL_DM="gnome-base/gdm x11-misc/lightdm x11-misc/sddm x11-misc/slim"


             reply	other threads:[~2024-06-22  7:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-22  7:57 Viorel Munteanu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-09-01 10:56 [gentoo-commits] repo/gentoo:master commit in: net-misc/tigervnc/, net-misc/tigervnc/files/ Viorel Munteanu
2024-07-27 19:36 Viorel Munteanu
2023-08-03  6:00 Viorel Munteanu
2023-06-24  9:08 Viorel Munteanu
2023-05-03 17:06 Viorel Munteanu
2023-03-31  7:03 Viorel Munteanu
2022-05-13 20:04 Sam James
2022-03-22 18:01 Sam James
2021-12-07 23:45 Sam James
2021-09-17  2:34 Sam James
2018-12-15 19:10 Matt Turner
2018-07-23  8:46 Tony Vroon
2017-11-27 15:56 Alice Ferrazzi
2017-03-02 11:12 Michael Palimaka
2017-01-26 10:26 Michael Palimaka
2017-01-25 18:05 Matt Turner
2016-01-29 15:55 Michał Górny
2016-01-09 11:44 Jeroen Roovers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1719042989.1031f5a7340e83c2cc260c3948e458274a3badd0.ceamac@gentoo \
    --to=ceamac@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox