From de4d00ddf5eecffa1e20fb5e1b3eeb7c91d641d2 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Aug 21 2023 14:17:59 +0000 Subject: livesys-main: Don't create liveuser on GNOME GNOME is going to be creating the liveuser from gnome initial setup from now on and also handling starting the installer from there as well. This commit changes the livesys scripts to not create the liveuser account or try to use the liveuser home directory. It also turns off fedora-welcome and turns back on gnome-tour. --- diff --git a/libexec/livesys/livesys-main b/libexec/livesys/livesys-main index cfb9e03..b21105d 100755 --- a/libexec/livesys/livesys-main +++ b/libexec/livesys/livesys-main @@ -22,6 +22,15 @@ fi { [ "${cmdline##* rd.live.image[= ]}" = "$cmdline" ] && [ "${cmdline##* liveimg[= ]}" = "$cmdline" ]; } && exit 0 +autouser=1 +if [ -f /etc/sysconfig/livesys ]; then + . /etc/sysconfig/livesys + + if [ "${livesys_session}" = "gnome" -a -d /var/lib/gnome-initial-setup/ ]; then + autouser=0 + fi +fi + [ -e /.liveimg-configured ] && configdone=1 livedir="LiveOS" @@ -91,9 +100,11 @@ fi ################### Code below runs only on first boot ##################### # add liveuser user with no passwd -action "Adding live user" useradd ${USERADDARGS:+"$USERADDARGS"} -c "Live System User" liveuser -passwd -d liveuser > /dev/null -usermod -aG wheel liveuser > /dev/null +if [ "${autouser}" -eq "1" ]; then + action "Adding live user" useradd ${USERADDARGS:+"$USERADDARGS"} -c "Live System User" liveuser + passwd -d liveuser > /dev/null + usermod -aG wheel liveuser > /dev/null +fi # Remove root password lock passwd -d root > /dev/null @@ -133,16 +144,10 @@ sed -i 's/rtcsync//' /etc/chrony.conf # https://bugzilla.redhat.com/show_bug.cgi?id=1370222 hostnamectl set-hostname "localhost-live" -if [ -f /etc/sysconfig/livesys ]; then - - . /etc/sysconfig/livesys - - if [ "${livesys_session}" ]; then - if [ -f "/usr/libexec/livesys/sessions.d/livesys-${livesys_session}" ]; then - . /usr/libexec/livesys/sessions.d/"livesys-${livesys_session}" - fi +if [ "${livesys_session}" ]; then + if [ -f "/usr/libexec/livesys/sessions.d/livesys-${livesys_session}" ]; then + . /usr/libexec/livesys/sessions.d/"livesys-${livesys_session}" fi - fi # allow extra stuff to be defined for derived spins (e.g., fedora labs) @@ -151,8 +156,10 @@ if [ -f /var/lib/livesys/livesys-session-extra ]; then fi # make sure to set the right permissions and selinux contexts -chown -R liveuser:liveuser /home/liveuser/ -restorecon -RF /home/liveuser/ +if [ -d /home/liveuser ]; then + chown -R liveuser:liveuser /home/liveuser/ + restorecon -RF /home/liveuser/ +fi #>>>>> Mark things as configured and keep this at the end of this script. <<<<< : > /.liveimg-configured diff --git a/libexec/livesys/sessions.d/livesys-gnome b/libexec/livesys/sessions.d/livesys-gnome index 76994e9..d6d6e10 100755 --- a/libexec/livesys/sessions.d/livesys-gnome +++ b/libexec/livesys/sessions.d/livesys-gnome @@ -4,6 +4,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later # +cmdline="$(cat /proc/cmdline)" # disable gnome-software automatically downloading updates cat >> /usr/share/glib-2.0/schemas/org.gnome.software.gschema.override << FOE @@ -20,9 +21,11 @@ cat >> /usr/share/gnome-shell/search-providers/org.gnome.Software-search-provide DefaultDisabled=true FOE -# don't run gnome-initial-setup -mkdir ~liveuser/.config -: > ~liveuser/.config/gnome-initial-setup-done +if [ ! -d /var/lib/gnome-initial-setup ]; then + # don't run gnome-initial-setup + mkdir ~liveuser/.config + : > ~liveuser/.config/gnome-initial-setup-done +fi # suppress anaconda spokes redundant with gnome-initial-setup cat >> /etc/sysconfig/anaconda << FOE @@ -48,22 +51,24 @@ if [ -f /usr/share/applications/liveinst.desktop ]; then favorite-apps=['firefox.desktop', 'org.gnome.Calendar.desktop', 'rhythmbox.desktop', 'org.gnome.Photos.desktop', 'org.gnome.Nautilus.desktop', 'anaconda.desktop'] FOE - # Make the welcome screen show up - # The name was changed in March 2023 in Fedora 39, we can stop - # caring about the old name (fedora-welcome.desktop) when F38 is - # EOL - for deskname in org.fedoraproject.welcome-screen.desktop fedora-welcome.desktop; do - if [ -f /usr/share/anaconda/gnome/${deskname} ]; then - mkdir -p ~liveuser/.config/autostart - cp /usr/share/anaconda/gnome/${deskname} /usr/share/applications/ - cp /usr/share/anaconda/gnome/${deskname} ~liveuser/.config/autostart/ - fi - done - - # Disable GNOME welcome tour so it doesn't overlap with Fedora welcome screen - cat >> /usr/share/glib-2.0/schemas/org.gnome.shell.gschema.override << FOE -welcome-dialog-last-shown-version='4294967295' -FOE + if [ ! -d /var/lib/gnome-initial-setup ]; then + # Make the welcome screen show up + # The name was changed in March 2023 in Fedora 39, we can stop + # caring about the old name (fedora-welcome.desktop) when F38 is + # EOL + for deskname in org.fedoraproject.welcome-screen.desktop fedora-welcome.desktop; do + if [ -f /usr/share/anaconda/gnome/${deskname} ]; then + mkdir -p ~liveuser/.config/autostart + cp /usr/share/anaconda/gnome/${deskname} /usr/share/applications/ + cp /usr/share/anaconda/gnome/${deskname} ~liveuser/.config/autostart/ + fi + done + + # Disable GNOME welcome tour so it doesn't overlap with Fedora welcome screen + cat >> /usr/share/glib-2.0/schemas/org.gnome.shell.gschema.override <<- " FOE" + welcome-dialog-last-shown-version='4294967295' + FOE + fi # Copy Anaconda branding in place if [ -d /usr/share/lorax/product/usr/share/anaconda ]; then @@ -74,12 +79,14 @@ fi # rebuild schema cache with any overrides we installed glib-compile-schemas /usr/share/glib-2.0/schemas -# set up auto-login -cat > /etc/gdm/custom.conf << FOE -[daemon] -AutomaticLoginEnable=True -AutomaticLogin=liveuser -FOE +# set up auto-login if it's a non-persistent boot +if [ "${cmdline##* rd.live.overlay[= ]}" != "$cmdline" -o ! -d /var/lib/gnome-initial-setup ]; then + cat > /etc/gdm/custom.conf <<- " FOE" + [daemon] + AutomaticLoginEnable=True + AutomaticLogin=liveuser + FOE +fi # Turn off PackageKit-command-not-found while uninstalled if [ -f /etc/PackageKit/CommandNotFound.conf ]; then