asahi-scripts/6.patch
2022-08-27 16:02:27 -07:00

50 lines
1.2 KiB
Diff

From aeeac0cb78610c91e4738a7f02e3f3f6da4a870a Mon Sep 17 00:00:00 2001
From: Davide Cavalca <davide@cavalca.name>
Date: Sat, 27 Aug 2022 08:57:38 -0700
Subject: [PATCH] update-m1n1: add Fedora support
Factor out logic to use the correct paths for m1n1, u-boot and DTBs in
Fedora.
Signed-off-by: Davide Cavalca <dcavalca@fedoraproject.org>
---
update-m1n1 | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/update-m1n1 b/update-m1n1
index 9de52e5..f5d3aa3 100755
--- a/update-m1n1
+++ b/update-m1n1
@@ -1,7 +1,18 @@
#!/bin/sh
set -e
-src="/usr/lib/asahi-boot/"
+ID=
+[ -e /etc/os-release ] && . /etc/os-release
+
+if [ "$ID" = fedora ]; then
+ m1n1_src="/usr/lib64/m1n1/"
+ uboot_src="/usr/share/uboot/apple_m1/"
+ DTBS=/boot/dtb-*/apple/*
+else
+ m1n1_src="/usr/lib/asahi-boot/"
+ uboot_src="/usr/lib/asahi-boot/"
+ DTBS=/lib/modules/*-ARCH/dtbs/*
+fi
umount=false
if [ ! -z "$1" ]; then
@@ -41,10 +52,8 @@ else
fi
fi
-DTBS=/lib/modules/*-ARCH/dtbs/*
-
-cat "$src/m1n1.bin" $DTBS \
- <(gzip -c "$src/u-boot-nodtb.bin") \
+cat "$m1n1_src/m1n1.bin" $DTBS \
+ <(gzip -c "$uboot_src/u-boot-nodtb.bin") \
>"${target}.new"
mv -f "${target}.new" "$target"