From bf9eae7a77d5d51c182d7b3c6651f4eca7302059 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Apr 23 2024 13:15:56 +0000 Subject: Add fixup script for branding packages in pre-F40 systems --- diff --git a/asahi-branding-fixup.service b/asahi-branding-fixup.service new file mode 100644 index 0000000..6de5b19 --- /dev/null +++ b/asahi-branding-fixup.service @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: MIT + +[Unit] +Description=Fix Fedora Asahi branding packages +After=network-online.target + +[Service] +Type=oneshot +TimeoutSec=0 +RemainAfterExit=yes +ExecStart=/usr/libexec/fedora-asahi-remix-scripts/fixup-branding-packages.sh + +[Install] +WantedBy=multi-user.target diff --git a/fedora-asahi-remix-scripts.spec b/fedora-asahi-remix-scripts.spec index 0f02228..a13c4c9 100644 --- a/fedora-asahi-remix-scripts.spec +++ b/fedora-asahi-remix-scripts.spec @@ -1,6 +1,6 @@ Name: fedora-asahi-remix-scripts -Version: 20231219 -Release: 2%{?dist} +Version: 20240423 +Release: 1%{?dist} Summary: Fedora Asahi Remix utility scripts License: MIT @@ -26,28 +26,41 @@ Utility scripts for the Fedora Asahi Remix. %install install -Dpm0644 -t %{buildroot}%{_unitdir} asahi-extras-firstboot.service install -Dpm0644 -t %{buildroot}%{_unitdir} asahi-setup-swap-firstboot.service +install -Dpm0644 -t %{buildroot}%{_unitdir} asahi-branding-fixup.service install -Dpm0755 -t %{buildroot}%{_libexecdir}/%{name} install-extras.sh install -Dpm0755 -t %{buildroot}%{_libexecdir}/%{name} setup-swap.sh +install -Dpm0755 -t %{buildroot}%{_libexecdir}/%{name} fixup-branding-packages.sh %post %systemd_post asahi-extras-firstboot.service %systemd_post asahi-setup-swap-firstboot.service +%systemd_post asahi-branding-fixup.service +%if 0%{?fedora} && 0%{?fedora} < 42 +# Special case just to deal with broken branding issues +systemctl enable asahi-branding-fixup.service +%endif %preun %systemd_preun asahi-extras-firstboot.service %systemd_preun asahi-setup-swap-firstboot.service +%systemd_preun asahi-branding-fixup.service %postun %systemd_postun asahi-extras-firstboot.service %systemd_postun asahi-setup-swap-firstboot.service +%systemd_postun asahi-branding-fixup.service %files %license LICENSE %{_unitdir}/asahi-extras-firstboot.service %{_unitdir}/asahi-setup-swap-firstboot.service +%{_unitdir}/asahi-branding-fixup.service %{_libexecdir}/%{name}/ %changelog +* Tue Apr 23 2024 Neal Gompa - 20240423-1 +- Add fixup script for branding packages in pre-F40 systems + * Sat Apr 20 2024 Davide Cavalca - 20231219-2 - Rebuild for Fedora Linux 40 diff --git a/fixup-branding-packages.sh b/fixup-branding-packages.sh new file mode 100644 index 0000000..b869ea2 --- /dev/null +++ b/fixup-branding-packages.sh @@ -0,0 +1,38 @@ +#!/usr/bin/sh +# SPDX-License-Identifier: MIT + +# Test if the basic identity is not used +if ! rpm --quiet --query fedora-asahi-remix-release-identity-basic; then + systemctl disable asahi-branding-fixup.service + exit 0 +fi + +# Check if network connectivity is present +CONNECTION_STATUS="$(curl -s http://fedoraproject.org/static/hotspot.txt)" +if [ "${CONNECTION_STATUS}" != "OK" ]; then + echo "No internet connectivity, exiting..." + exit 0 +fi + +# Ensure the correct identity packages are installed + +if rpm --quiet --query fedora-asahi-remix-release-kde; then + dnf --assumeyes install --allowerasing fedora-asahi-remix-release-identity-kde + systemctl disable asahi-branding-fixup.service + exit 0 +fi + +if rpm --quiet --query fedora-asahi-remix-release-workstation; then + dnf --assumeyes install --allowerasing fedora-asahi-remix-release-identity-workstation + systemctl disable asahi-branding-fixup.service + exit 0 +fi + +if rpm --quiet --query fedora-asahi-remix-release-server; then + dnf --assumeyes install --allowerasing fedora-asahi-remix-release-identity-server + systemctl disable asahi-branding-fixup.service + exit 0 +fi + +systemctl disable asahi-branding-fixup.service +exit 0