fix: prevent stalled downloads by adding curl timeout and retries

This commit is contained in:
Tieu Long authored and GitHub committed 2025-12-15 23:04:08 +07:00
1 parent 828b53128d
commit a18fab6079
2 files changed
+10 -8

No files matched your search

+5 -5
View File
@@ -1,4 +1,4 @@
## Build macOS Installer ISO and DMG image via Github Action – No Mac Required
## Build macOS Installer image via Github Action – No Mac Required
* Support **macOS 10.7 Lion** through **macOS 26 Tahoe** installers.
* Download macOS installers exclusively from official Apple sources.
@@ -15,10 +15,10 @@
> [!IMPORTANT]
> * Use the **"Build macOS Recovery ISO image"** workflow unless you really need an offline installer.
> * GitHub-hosted runners are a free public resource — please use them responsibly.
> * Already have macOS? Build macOS installer ISO/DMG image with this command (replace tahoe with the desired version):
> ```
> curl -L https://raw.githubusercontent.com/LongQT-sea/macos-iso-builder/main/mkmaciso | bash -s tahoe
> ```
> * Already have macOS? Build macOS installer ISO/DMG image with this command (replace `tahoe` with the desired version):
```
curl -L https://raw.githubusercontent.com/LongQT-sea/macos-iso-builder/main/mkmaciso | bash -s tahoe
```
---
+5 -3
View File
@@ -542,7 +542,8 @@ download_legacy_macos() {
esac
log_info "Downloading macOS $(get_codename $version_num)..."
curl --progress-bar -L "$download_url" -o "$WORK_DIR/InstallMacOSX.dmg"
# If download does not finish within 20 minutes (--max-time 1200), redownload to establish a new connection, which may result in faster speeds.
curl --retry 5 --retry-all-errors --max-time 1200 --connect-timeout 10 --progress-bar -L "$download_url" -o "$WORK_DIR/InstallMacOSX.dmg"
}
# macOS 10.9 Mavericks requires special handling:
@@ -594,8 +595,9 @@ k=$key")
log_info "Downloading macOS Mavericks using special method..."
# Download Mavericks InstallESD.dmg and cache it in /Applications to avoid redownload in the future
curl --progress-bar "$mavericks_url" -H "Cookie: AssetToken=$token" > "$WORK_DIR/InstallESD.dmg" && mkdir -p "/Applications/Install OS X Mavericks.app/Contents/SharedSupport"
# If download does not finish within 20 minutes (--max-time 1200), redownload to establish a new connection, which may result in faster speeds.
curl --retry 5 --retry-all-errors --max-time 1200 --connect-timeout 10 --progress-bar "$mavericks_url" -H "Cookie: AssetToken=$token" -o "$WORK_DIR/InstallESD.dmg" && mkdir -p "/Applications/Install OS X Mavericks.app/Contents/SharedSupport"
if [ -d "/Applications/Install OS X Mavericks.app/Contents/SharedSupport" ]; then
mv -f "$WORK_DIR/InstallESD.dmg" "/Applications/Install OS X Mavericks.app/Contents/SharedSupport/InstallESD.dmg"
fi