asahi-scripts/asahi-scripts.spec
Janne Grunau eb78052afd Fix update-m1n1 invocation from kernel-install add ...
At the time kernel-install runs 15-update-m1n1.install "/boot/dtb" might
be a dangling symlink as /boot/dtb-${KERNEL_VERSION} has not yet been
created.
Take advantage of the proposed $DTBS directory support [1] and use
"/boot/dtb" as DTBS default location.
Add an fedora specific patch to detect the dangling symlink and use the
dtb directory from the kernel's modules directory in /usr/lib/modules.

1: https://github.com/AsahiLinux/asahi-scripts/pull/67
2025-08-19 23:16:25 +02:00

146 lines
4.3 KiB
RPMSpec

Name: asahi-scripts
Version: 20250713
Release: %autorelease
Summary: Miscellaneous admin scripts for Asahi Linux
License: MIT
URL: https://github.com/AsahiLinux/asahi-scripts
Source: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
Source: update-m1n1.sysconfig
Source2: 15-update-m1n1.install
Patch01: 0001-update-m1n1-Expand-DTBS-if-it-is-a-directory.patch
Patch02: 0002-fedora-update-m1n1-handle-dangling-boot-dtb-symlinks.patch
BuildArch: noarch
BuildRequires: make
BuildRequires: sed
BuildRequires: systemd-rpm-macros
Requires: bash
Requires: coreutils
Requires: grep
Requires: sed
Requires: systemd-udev
Requires: util-linux-core
%description
This package contains miscellaneous admin scripts for the Asahi Linux reference
distro.
%package -n asahi-fwupdate
Summary: Asahi Linux firmware extractor
Requires: %{name} = %{version}-%{release}
# Not using python3dist(asahi-firmware) because its version is fixed
Requires: python3-asahi_firmware >= 0.5.4
%description -n asahi-fwupdate
Asahi Linux firmware updater.
%package -n dracut-asahi
Summary: Dracut config for Apple Silicon Macs
Requires: dracut
Requires: linux-firmware-vendor = %{version}-%{release}
%description -n dracut-asahi
Dracut config for Apple Silicon Macs.
%package -n linux-firmware-vendor
Summary: Ensure /lib/firmware/vendor exists for firmware handoff
Requires: linux-firmware
%description -n linux-firmware-vendor
This package ensures /lib/firmware/vendor exists so that firmware can be handed
over properly from the initramfs.
%package -n update-m1n1
Summary: Keep m1n1 up to date
Requires: %{name} = %{version}-%{release}
Requires: bash
Requires: gzip
Requires: m1n1
Requires: uboot-images-armv8
# grubby's /usr/lib/kernel/install.d/10-devicetree.install creates the
# /boot/dtb symlink update-m1n1 uses to construct the 2nd stage m1n1 image
Requires: grubby
%description -n update-m1n1
Keep m1n1 up to date on Apple Silicon systems.
%package -n asahi-battery
Summary: Asahi Linux battery charge control scripts
Requires: %{name} = %{version}-%{release}
Requires: systemd
Requires: systemd-udev
%description -n asahi-battery
Asahi Linux battery charge control scripts restore charge_control_end_threshold
on system start.
%prep
%autosetup -p1
%build
# nothing to do here
%install
%make_install install-fedora \
PREFIX="%{_prefix}" \
BIN_DIR="%{_sbindir}" \
CONFIG_DIR="%{_sysconfdir}/sysconfig"
install -Ddpm0755 %{buildroot}%{_prefix}/lib/firmware/vendor
install -Dpm0644 %SOURCE1 %{buildroot}%{_sysconfdir}/sysconfig/update-m1n1
# Install kernel-install script
install -Dpm0755 -t %{buildroot}%{_kernel_install_dir} %{SOURCE2}
%transfiletriggerin -n asahi-fwupdate -- %{_sbindir}/asahi-fwupdate %{_bindir}/asahi-fwextract
%{_sbindir}/asahi-fwupdate || :
# This needs to be a separate trigger because we can't use python3_sitearch here
%transfiletriggerin -n asahi-fwupdate -- /usr/lib/python
grep -q 'asahi_firmware' && %{_sbindir}/asahi-fwupdate || :
# We can't use _libdir here because it gets incorrectly expanded to /usr/lib
%transfiletriggerin -n update-m1n1 -- /usr/lib/m1n1 /usr/lib64/m1n1 /usr/share/uboot/apple_m1 /etc/m1n1.conf
%{_sbindir}/update-m1n1 || :
%files
%license LICENSE
%{_datadir}/%{name}/
%{_sbindir}/asahi-diagnose
%{_udevhwdbdir}/65-autosuspend-override-asahi-sdhci.hwdb
%files -n asahi-fwupdate
%license LICENSE
%{_sbindir}/asahi-fwupdate
%files -n dracut-asahi
%license LICENSE
%{_prefix}/lib/dracut/dracut.conf.d/10-asahi.conf
%{_prefix}/lib/dracut/modules.d/91kernel-modules-asahi/
%{_prefix}/lib/dracut/modules.d/99asahi-firmware/
%files -n linux-firmware-vendor
%license LICENSE
%dir %{_prefix}/lib/firmware/vendor
%files -n update-m1n1
%license LICENSE
%config(noreplace) %{_sysconfdir}/sysconfig/update-m1n1
%{_kernel_install_dir}/15-update-m1n1.install
%{_sbindir}/update-m1n1
%files -n asahi-battery
%{_unitdir}/macsmc-battery-charge-control-end-threshold.path
%{_unitdir}/macsmc-battery-charge-control-end-threshold.service
%{_udevrulesdir}/93-macsmc-battery-charge-control.rules
%ghost %config(noreplace) %{_sysconfdir}/udev/macsmc-battery.conf
%changelog
%autochangelog