From 226f30fc245f7c876810c80918d150a3bafab4fd Mon Sep 17 00:00:00 2001 From: Knut Anderssen Date: Tue, 26 Apr 2022 00:05:42 +0100 Subject: [PATCH] Revert "AY: Do not stop xvnc.socket but rely on systemd" This reverts commit 0f3456341afa58b6265fe9217a0ccfcce975ecf9. --- package/YaST2-Firstboot.service | 2 +- package/YaST2-Second-Stage.service | 4 ++-- startup/Second-Stage/S09-cleanup | 1 + startup/YaST2.call | 1 + startup/common/misc.sh | 30 ++++++++++++++++++++++++++++++ 5 files changed, 35 insertions(+), 3 deletions(-) diff --git a/package/YaST2-Firstboot.service b/package/YaST2-Firstboot.service index c4c669b37..c5b03a3e0 100644 --- a/package/YaST2-Firstboot.service +++ b/package/YaST2-Firstboot.service @@ -6,7 +6,7 @@ After=purge-kernels.service Conflicts=plymouth-start.service Before=getty@tty1.service serial-getty@ttyS0.service serial-getty@ttyS1.service serial-getty@ttyS2.service Before=serial-getty@hvc0.service serial-getty@ttyAMA0.service -Before=display-manager.service xvnc.socket +Before=display-manager.service ConditionPathExists=/var/lib/YaST2/reconfig_system OnFailure=shutdown.target diff --git a/package/YaST2-Second-Stage.service b/package/YaST2-Second-Stage.service index 064d56a5c..b7f40f7e8 100644 --- a/package/YaST2-Second-Stage.service +++ b/package/YaST2-Second-Stage.service @@ -10,8 +10,8 @@ Conflicts=plymouth-start.service Before=getty@tty1.service getty@tty2.service getty@tty3.service getty@tty4.service getty@tty5.service getty@tty6.service Before=serial-getty@ttyS0.service serial-getty@ttyS1.service serial-getty@ttyS2.service Before=serial-getty@hvc0.service serial-getty@ttyAMA0.service serial-getty@ttysclp0.service -# Prevent too early user login (bsc#1196594) and too early vnc connection (bsc#1197265) -Before=display-manager.service xvnc.socket +# Prevent too early user login (bsc#1196594) +Before=display-manager.service ConditionPathExists=/var/lib/YaST2/runme_at_boot [Service] diff --git a/startup/Second-Stage/S09-cleanup b/startup/Second-Stage/S09-cleanup index 8911ede4a..0905e5271 100755 --- a/startup/Second-Stage/S09-cleanup +++ b/startup/Second-Stage/S09-cleanup @@ -15,6 +15,7 @@ if [ ! -z "$VNC" ] && [ "$VNC" -eq 1 ] ; then log "\tkill all VNC sessions..." killall Xvnc >/dev/null 2>&1 rm -fv /root/.vnc/passwd.yast + restore_xvnc fi # 13.3) stop network and sshd if [ "$Y2_NETWORK_ACTIVE" -ne 0 ] ; then diff --git a/startup/YaST2.call b/startup/YaST2.call index d930da832..63250da29 100755 --- a/startup/YaST2.call +++ b/startup/YaST2.call @@ -172,6 +172,7 @@ function prepare_for_vnc () { if [ $VNCPASS_EXCEPTION = 0 ];then disable_splash displayVNCMessage + stop_xvnc startVNCServer wait_for_x11 if [ "$server_running" = 1 ];then diff --git a/startup/common/misc.sh b/startup/common/misc.sh index e80da5ad3..27e225efd 100644 --- a/startup/common/misc.sh +++ b/startup/common/misc.sh @@ -187,6 +187,36 @@ function disable_splash () { [ -f /proc/splash ] && echo "verbose" > /proc/splash } +#----[ stop_xvnc]-----# +function stop_xvnc () { +#-------------------------------------------------- +# stop xvnc since its default configuration collides +# with the Xvnc server used for VNC installation +# --- + systemctl stop xvnc.socket >/dev/null 2>&1 +# stop also running instances of xvnc to allow start our own + systemctl stop xvnc@* >/dev/null 2>&1 +} + +#----[ is_xvnc_enabled ]-----# +function is_xvnc_enabled () { +# return 0 if xvnc is enabled +# --- + systemctl --quiet is-enabled xvnc.socket >/dev/null 2>&1 + return $? +} + +#----[ restore_xvnc ]-----# +function restore_xvnc () { +#-------------------------------------------------- +# start xvnc again if it is enabled, once the Xvnc +# server already owns its port +# --- + if is_xvnc_enabled; then + systemctl start xvnc.socket + fi +} + #----[ have_pid ]----# function have_pid () { #------------------------------------------------------