Skip to content

Commit e686944

Browse files
committed
feat: Add systemd service to auto-fetch Apple firmware and ensure its execution on first boot.
1 parent 1119a5e commit e686944

3 files changed

Lines changed: 21 additions & 11 deletions

File tree

.github/workflows/iso.sh

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,28 @@
33
os=$(uname -s)
44
case "$os" in
55
(Darwin)
6-
true
6+
echo -e "GET http://github.com HTTP/1.0\n\n" | nc github.com 80 > /dev/null 2>&1
7+
if [ $? -eq 0 ]; then
8+
true
9+
else
10+
echo "Please connect to the internet"
11+
exit 1
12+
fi
713
;;
814
(Linux)
9-
true
15+
if wget -q --spider --timeout=5 --tries=1 http://github.com >/dev/null 2>&1; then
16+
true
17+
else
18+
echo "Please connect to the internet"
19+
exit 1
20+
fi
1021
;;
1122
(*)
1223
echo "This script is meant to be run only on Linux or macOS"
1324
exit 1
1425
;;
1526
esac
1627

17-
echo -e "GET http://github.com HTTP/1.0\n\n" | nc github.com 80 > /dev/null 2>&1
18-
19-
if [ $? -eq 0 ]; then
20-
true
21-
else
22-
echo "Please connect to the internet"
23-
exit 1
24-
fi
25-
2628
set -e
2729

2830
cd $HOME/Downloads

02_build_image.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ touch "${IMAGE_PATH}"/ubuntu
1818
cp -r "${ROOT_PATH}"/files/preseed "${IMAGE_PATH}"/preseed
1919
cp "${ROOT_PATH}/files/grub/grub.cfg" "${IMAGE_PATH}"/isolinux/grub.cfg
2020

21+
echo >&2 "===]> Info: Reset firmware flag for fresh boot... "
22+
rm -f "${CHROOT_PATH}/etc/get_apple_firmware_attempted" || true
2123

2224
echo >&2 "===]> Info: Compress the chroot... "
2325
cd "${WORKING_PATH}"

files/chroot_build.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ cat <<EOF | sudo tee /etc/NetworkManager/conf.d/99-network-t2-ncm.conf
6565
no-auto-default=t2_ncm
6666
EOF
6767

68+
echo >&2 "===]> Info: Setup auto-fetch firmware service... "
69+
70+
curl -s https://raw.githubusercontent.com/t2linux/wiki/refs/heads/master/docs/tools/get-apple-firmware.service -o /etc/systemd/system/get-apple-firmware.service
71+
72+
systemctl enable get-apple-firmware.service
73+
6874
echo >&2 "===]> Info: Cleanup the chroot environment... "
6975

7076
truncate -s 0 /etc/machine-id || true

0 commit comments

Comments
 (0)