From 7744f40caadd5772f2914c9a698cd2de965496a8 Mon Sep 17 00:00:00 2001 From: Marcos Mello Date: Wed, 10 Nov 2021 21:13:13 -0300 Subject: [PATCH] Make dovnc imply dostartx Also do not append more than once to /root/.bash_profile in case both dovnc and dostartx are set. Fixes systemrescue/systemrescue-sources#234 --- airootfs/etc/systemd/scripts/sysrescue-initialize | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/airootfs/etc/systemd/scripts/sysrescue-initialize b/airootfs/etc/systemd/scripts/sysrescue-initialize index dfbda26..0004eea 100755 --- a/airootfs/etc/systemd/scripts/sysrescue-initialize +++ b/airootfs/etc/systemd/scripts/sysrescue-initialize @@ -52,11 +52,14 @@ do ;; # Auto-start the graphical environment (tty1 only) - dostartx) + # dovnc implies dostartx + dostartx|dovnc) echo "Found option '${curopt}' on the boot command line" - echo '[[ ! $DISPLAY ]] && [[ ! $SSH_TTY ]] && [[ $XDG_VTNR == 1 ]] && startx' | \ - tee -a /root/.bash_profile > /root/.zlogin - ;; + str='[[ ! $DISPLAY ]] && [[ ! $SSH_TTY ]] && [[ $XDG_VTNR == 1 ]] && startx' + grep -qF "$str" /root/.bash_profile || echo "$str" >> /root/.bash_profile + echo "$str" > /root/.zlogin + # Must not break the case block because there is another dovnc pattern to match below + ;;& # Require authenticated console access noautologin) @@ -79,7 +82,7 @@ do # Auto-start x11vnc with the graphical environment dovnc) - echo "Found option '${curopt}' on the boot command line" + # The "Found option..." message was already shown above in the dostartx pattern { echo '[ -f ~/.vnc/passwd ] && pwopt="-usepw" || pwopt="-nopw"' echo 'x11vnc $pwopt -nevershared -forever -logfile /var/log/x11vnc.log &'