feat: Add systemd service to auto-fetch Apple firmware and ensure its execution on first boot.

This commit is contained in:
Aditya Garg
2026-01-14 13:26:50 +05:30
parent 1119a5e240
commit e686944905
3 changed files with 21 additions and 11 deletions
+13 -11
View File
@@ -3,10 +3,21 @@
os=$(uname -s)
case "$os" in
(Darwin)
true
echo -e "GET http://github.com HTTP/1.0\n\n" | nc github.com 80 > /dev/null 2>&1
if [ $? -eq 0 ]; then
true
else
echo "Please connect to the internet"
exit 1
fi
;;
(Linux)
true
if wget -q --spider --timeout=5 --tries=1 http://github.com >/dev/null 2>&1; then
true
else
echo "Please connect to the internet"
exit 1
fi
;;
(*)
echo "This script is meant to be run only on Linux or macOS"
@@ -14,15 +25,6 @@ case "$os" in
;;
esac
echo -e "GET http://github.com HTTP/1.0\n\n" | nc github.com 80 > /dev/null 2>&1
if [ $? -eq 0 ]; then
true
else
echo "Please connect to the internet"
exit 1
fi
set -e
cd $HOME/Downloads
+2
View File
@@ -18,6 +18,8 @@ touch "${IMAGE_PATH}"/ubuntu
cp -r "${ROOT_PATH}"/files/preseed "${IMAGE_PATH}"/preseed
cp "${ROOT_PATH}/files/grub/grub.cfg" "${IMAGE_PATH}"/isolinux/grub.cfg
echo >&2 "===]> Info: Reset firmware flag for fresh boot... "
rm -f "${CHROOT_PATH}/etc/get_apple_firmware_attempted" || true
echo >&2 "===]> Info: Compress the chroot... "
cd "${WORKING_PATH}"
+6
View File
@@ -65,6 +65,12 @@ cat <<EOF | sudo tee /etc/NetworkManager/conf.d/99-network-t2-ncm.conf
no-auto-default=t2_ncm
EOF
echo >&2 "===]> Info: Setup auto-fetch firmware service... "
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
systemctl enable get-apple-firmware.service
echo >&2 "===]> Info: Cleanup the chroot environment... "
truncate -s 0 /etc/machine-id || true