diff --git a/Makefile.builder b/Makefile.builder index 94c817c..cd38bae 100644 --- a/Makefile.builder +++ b/Makefile.builder @@ -3,6 +3,7 @@ RPM_SPEC_FILES.dom0 := \ lorax-templates-qubes/lorax-templates-qubes.spec \ pungi/pungi.spec \ anaconda/anaconda.spec \ + initial-setup-launcher/initial-setup-launcher.spec \ qubes-anaconda-addon/qubes-anaconda-addon.spec \ qubes-release/qubes-release.spec \ qubes-release/qubes-dom0-dist-upgrade.spec \ diff --git a/conf/comps-qubes.xml b/conf/comps-qubes.xml index cff23f2..c06685e 100644 --- a/conf/comps-qubes.xml +++ b/conf/comps-qubes.xml @@ -1009,6 +1009,7 @@ desktop-backgrounds-basic initial-setup + initial-setup-launcher glx-utils gnome-packagekit mesa-dri-drivers diff --git a/initial-setup-launcher/initial-setup-graphical.service.d b/initial-setup-launcher/initial-setup-graphical.service.d new file mode 100644 index 0000000..6d543be --- /dev/null +++ b/initial-setup-launcher/initial-setup-graphical.service.d @@ -0,0 +1,2 @@ +[Unit] +ConditionPathExists=/overloaded/by/initial-setup.service diff --git a/initial-setup-launcher/initial-setup-launcher.spec b/initial-setup-launcher/initial-setup-launcher.spec new file mode 100644 index 0000000..59e230e --- /dev/null +++ b/initial-setup-launcher/initial-setup-launcher.spec @@ -0,0 +1,46 @@ +Name: initial-setup-launcher +Version: 1.0 +Release: 1%{?dist} +Summary: Initial system configuration utility launcher + +Group: System Environment/Base +License: GPLv2+ +URL: https://fedoraproject.org/wiki/InitialSetup + +Source0: %{name}-%{version}.tar.bz2 + +Requires: initial-setup + +%if 0%{?qubes_builder} +%define _builddir %(pwd)/initial-setup-launcher +%endif + +%description +Launcher for initial-setup utility. Used to avoid race condition described here: +https://fedoraproject.org/wiki/Common_F23_bugs#Initial_setup_sometimes_starts_in_text_mode_instead_of_in_graphics_mode + +%prep +%if ! 0%{?qubes_builder} +%setup -q +%endif + + +%build + +%install +install -D run-initial-setup $RPM_BUILD_ROOT/usr/bin/run-initial-setup +install -m 0644 -D initial-setup-graphical.service.d \ + $RPM_BUILD_ROOT%{_unitdir}/initial-setup-graphical.service.d/30-initial-setup-launcher.conf +install -m 0644 -D initial-setup-text.service.d \ + $RPM_BUILD_ROOT%{_unitdir}/initial-setup-text.service.d/30-initial-setup-launcher.conf +install -m 0644 -D initial-setup.service \ + $RPM_BUILD_ROOT%{_unitdir}/initial-setup.service + +%files +/usr/bin/run-initial-setup +%{_unitdir}/initial-setup-graphical.service.d/30-initial-setup-launcher.conf +%{_unitdir}/initial-setup-text.service.d/30-initial-setup-launcher.conf +%{_unitdir}/initial-setup.service + +%changelog + diff --git a/initial-setup-launcher/initial-setup-text.service.d b/initial-setup-launcher/initial-setup-text.service.d new file mode 100644 index 0000000..6d543be --- /dev/null +++ b/initial-setup-launcher/initial-setup-text.service.d @@ -0,0 +1,2 @@ +[Unit] +ConditionPathExists=/overloaded/by/initial-setup.service diff --git a/initial-setup-launcher/initial-setup.service b/initial-setup-launcher/initial-setup.service new file mode 100644 index 0000000..cbaf5d6 --- /dev/null +++ b/initial-setup-launcher/initial-setup.service @@ -0,0 +1,24 @@ +[Unit] +Description=Initial Setup configuration program +After=livesys.service plymouth-quit-wait.service +After=systemd-vconsole-setup.service +Before=display-manager.service getty@tty1.service getty@ttyUSB0.service +Before=serial-getty@ttyS0.service serial-getty@ttyO0.service serial-getty@ttyO2.service +Before=serial-getty@ttyAMA0.service serial-getty@ttymxc0.service serial-getty@ttymxc3.service serial-getty@hvc0.service +Conflicts=plymouth-quit-wait.service initial-setup-text.service initial-setup-graphical.service +ConditionKernelCommandLine=!rd.live.image + +[Service] +Type=oneshot +TimeoutSec=0 +StandardInput=tty +StandardOutput=tty +RemainAfterExit=no +ExecStartPre=/bin/kill -55 1 +ExecStartPre=-/bin/plymouth quit +ExecStart=/usr/bin/run-initial-setup +ExecStartPost=/bin/kill -54 1 + +[Install] +WantedBy=graphical.target +WantedBy=multi-user.target diff --git a/initial-setup-launcher/run-initial-setup b/initial-setup-launcher/run-initial-setup new file mode 100755 index 0000000..b44c49b --- /dev/null +++ b/initial-setup-launcher/run-initial-setup @@ -0,0 +1,23 @@ +#!/bin/bash + +IS_GRAPHICAL="$(rpm -q initial-setup-gui >/dev/null 2>&1 && echo "yes" || echo "no")" +WINDOWMANAGER_SCRIPT="/usr/bin/firstboot-windowmanager" +INITIAL_SETUP_SCRIPT="/usr/bin/initial-setup" + +# check if graphical Initial Setup is installed +if test "x${IS_GRAPHICAL}" = "xyes"; then + printf "MESSAGE=starting Initial Setup GUI\nPRIORITY=6" | logger --journald + /bin/xinit ${WINDOWMANAGER_SCRIPT} ${INITIAL_SETUP_SCRIPT} -- /bin/Xorg :9 -ac -nolisten tcp +else + printf "MESSAGE=starting Initial Setup TUI\nPRIORITY=6" | logger --journald + ${INITIAL_SETUP_SCRIPT} +fi + +# check if the Initial Setup run was successful by looking at the return code +if [ $? -eq 0 ]; then + printf "MESSAGE=Initial Setup finished successfully, disabling\nPRIORITY=6" | logger --journald + /bin/systemctl disable initial-setup.service &>/dev/null + printf "MESSAGE=Initial Setup has been disabled\nPRIORITY=6" | logger --journald +else + printf "MESSAGE=Initial Setup failed, keeping enabled\nPRIORITY=3" | logger --journald +fi