ninxsoft / mist-cli

A Mac command-line tool that automatically downloads macOS Firmwares / Installers.
MIT License
620 stars 29 forks source link

Resume Capability for Connection Interruption #71

Closed brianhm closed 2 years ago

brianhm commented 2 years ago

MicrosoftTeams-image (14)

When the Internet connection of the downloading endpoint is interrupted, the binary just bombs out. Can resume capability be added either with a pause timeframe specified as an input switch?

ninxsoft commented 2 years ago

Sounds reasonable, let's look into this!

ninxsoft commented 2 years ago

I am proposing the following:

Here's sample output for a firmware download:

➜ mist download firmware "Monterey" --force --retries 3 --retry-delay 5 
┌──────────────────┐
│ INPUT VALIDATION │
└──────────────────┘
  ├─ Download search string will be 'Monterey'...
  ├─ Include betas in search results will be 'false'...
  ├─ Only include compatible firmwares will be 'false'...
  ├─ Output directory will be '/Users/Shared/Mist'...
  ├─ Temporary directory will be '/private/tmp/com.ninxsoft.mist'...
  ├─ Force flag set, existing files will be overwritten...
  ├─ Firmware name will be 'Install %NAME% %VERSION%-%BUILD%.ipsw'...
┌────────┐
│ SEARCH │
└────────┘
  ├─ Searching for macOS download 'Monterey'...
  ├─ Found macOS Monterey 12.4 (21F79) [2022-05-16]
┌───────┐
│ SETUP │
└───────┘
  ├─ Deleting old temporary directory '/private/tmp/com.ninxsoft.mist/com.ninxsoft.mist.12.4-21F79'...
  ├─ Creating new temporary directory '/private/tmp/com.ninxsoft.mist/com.ninxsoft.mist.12.4-21F79'...
┌──────────┐
│ DOWNLOAD │
└──────────┘
  ├─ UniversalMac_12.4_21F79_Restore.ipsw...... [ 31.80 MB / 13.84 GB (00.23%) ]
  ├─ The network connection was lost.
  ├─ Retrying attempt [ 1 / 3 ] in 5 seconds...
  ├─ UniversalMac_12.4_21F79_Restore.ipsw...... [ 31.80 MB / 13.84 GB (00.23%) ]
  ├─ The Internet connection appears to be offline.
  ├─ Retrying attempt [ 2 / 3 ] in 5 seconds...
  ├─ UniversalMac_12.4_21F79_Restore.ipsw...... [ 31.80 MB / 13.84 GB (00.23%) ]
  ├─ The Internet connection appears to be offline.
  ├─ Retrying attempt [ 3 / 3 ] in 5 seconds...
  ├─ UniversalMac_12.4_21F79_Restore.ipsw...... [ 13.83 GB / 13.83 GB (100.0%) ]
┌──────────┐
│ FIRMWARE │
└──────────┘
  ├─ Validating Shasum matches b5553b62da22e5fdbab2b56b6eb1fb74b58555ac...
  ├─ Moving '/private/tmp/com.ninxsoft.mist/com.ninxsoft.mist.12.4-21F79/UniversalMac_12.4_21F79_Restore.ipsw' to '/Users/Shared/Mist/Install macOS Monterey 12.4-21F79.ipsw'...
  ├─ Setting POSIX file permissions to '0644' for '/Users/Shared/Mist/Install macOS Monterey 12.4-21F79.ipsw'...
┌──────────┐
│ TEARDOWN │
└──────────┘
  └─ Deleting temporary directory '/private/tmp/com.ninxsoft.mist/com.ninxsoft.mist.12.4-21F79'...
ninxsoft commented 2 years ago

And here's sample output for an installer download:

sudo mist download installer "Monterey" application --force --retries 3 --retry-delay 5
┌──────────────────┐
│ INPUT VALIDATION │
└──────────────────┘
  ├─ User is 'root'...
  ├─ Download search string will be 'Monterey'...
  ├─ Include betas in search results will be 'false'...
  ├─ Only include compatible installers will be 'false'...
  ├─ Cache downloads will be 'false'...
  ├─ Output directory will be '/Users/Shared/Mist'...
  ├─ Temporary directory will be '/private/tmp/com.ninxsoft.mist'...
  ├─ Force flag set, existing files will be overwritten...
  ├─ Application name will be 'Install %NAME% %VERSION%-%BUILD%.app'...
┌────────┐
│ SEARCH │
└────────┘
  ├─ Searching for macOS download 'Monterey'...
  ├─ Found [012-06873] macOS Monterey 12.4 (21F79) [2022-05-25]
┌───────┐
│ SETUP │
└───────┘
  ├─ Deleting old temporary directory '/private/tmp/com.ninxsoft.mist/012-06873'...
  ├─ Creating new temporary directory '/private/tmp/com.ninxsoft.mist/012-06873'...
┌──────────┐
│ DOWNLOAD │
└──────────┘
  ├─ [ 1 / 7 ] 012-06873.English.dist.......... [ 07.83 KB / 07.83 KB (100.0%) ]
  │            Verifying... ✓✓✓
  ├─ [ 2 / 7 ] BuildManifest.plist............. [ 02.07 MB / 02.07 MB (100.0%) ]
  │            Verifying... ✓✓✓
  ├─ [ 3 / 7 ] Info.plist...................... [ 05.17 KB / 05.17 KB (100.0%) ]
  │            Verifying... ✓✓✓
  ├─ [ 4 / 7 ] InstallAssistant.pkg............ [ 10.17 MB / 12.10 GB (00.08%) ]
  ├─ The network connection was lost.
  ├─ Retrying attempt [ 1 / 3 ] in 5 seconds...
  ├─ [ 4 / 7 ] InstallAssistant.pkg............ [ 10.17 MB / 12.10 GB (00.08%) ]
  ├─ The Internet connection appears to be offline.
  ├─ Retrying attempt [ 2 / 3 ] in 5 seconds...
  ├─ [ 4 / 7 ] InstallAssistant.pkg............ [ 10.17 MB / 12.10 GB (00.08%) ]
  ├─ The Internet connection appears to be offline.
  ├─ Retrying attempt [ 3 / 3 ] in 5 seconds...
  ├─ [ 4 / 7 ] InstallAssistant.pkg............ [ 12.09 GB / 12.09 GB (100.0%) ]
  │            Verifying... ✓✓✓
  ├─ [ 5 / 7 ] InstallInfo.plist............... [  0188  B /  0188  B (100.0%) ]
  │            Verifying... ✓✓✓
  ├─ [ 6 / 7 ] MajorOSInfo.pkg................. [ 01.29 MB / 01.29 MB (100.0%) ]
  │            Verifying... ✓✓✓
  ├─ [ 7 / 7 ] UpdateBrain.zip................. [ 03.19 MB / 03.19 MB (100.0%) ]
  │            Verifying... ✓✓✓
┌─────────┐
│ INSTALL │
└─────────┘
  ├─ Creating new installer '/Applications/Install macOS Monterey.app'...
  ├─ Created new installer '/Applications/Install macOS Monterey.app'
┌─────────────┐
│ APPLICATION │
└─────────────┘
  ├─ Copying '/Applications/Install macOS Monterey.app' to '/Users/Shared/Mist/Install macOS Monterey 12.4-21F79.app'...
┌──────────┐
│ TEARDOWN │
└──────────┘
  ├─ Deleting temporary directory '/private/tmp/com.ninxsoft.mist/012-06873'...
  └─ Deleting installer '/Applications/Install macOS Monterey.app'...