A Bash script to download the latest Arch Linux ISO, verify its integrity, and optionally write it to a USB flash drive. Designed for both macOS and Linux, with robust error handling and debug support.
- Automatic Download: Fetches the latest Arch Linux ISO via torrent using
aria2c. - Integrity Verification: Checks the ISO’s SHA256 checksum and GPG signature.
- USB Writing: Detects removable/external drives and writes the ISO with
dd. - Cross-Platform: Works on macOS and Linux with platform-specific drive detection.
- Debug Mode: Enable detailed logging with
DEBUG=trueorDEBUG=1.
- Core Tools:
curl: For downloading torrent and verification files.aria2c: For torrent-based ISO download.sha256sum: For checksum verification.gpg: For signature verification.mktemp: For temporary directory creation.dd: For writing the ISO to a USB drive.
- Optional:
tput: For colored terminal output (falls back to plain text if unavailable).
- Platform-Specific:
- macOS:
diskutil(pre-installed). - Linux:
lsblk(typically pre-installed).
- macOS:
Install missing tools with your package manager (e.g., brew on macOS, pacman on Arch Linux).
- Clone the Repository:
git clone https://github.com/cleanhands/getarch.sh.git cd arch-iso-script - Make Executable:
chmod +x getarch.sh
- Run the Script:
- Basic run:
./getarch.sh
- With debug output:
DEBUG=1 ./getarch.sh
- Basic run:
- Follow Prompts:
- The script downloads and verifies the ISO.
- If run interactively, it asks to write the ISO to a USB drive, listing detected devices.
- Downloads the ISO to
~/Downloads(or$XDG_DOWNLOAD_DIRif set). - Caches the ISO in
~/.cache/archlinux(or$XDG_CACHE_HOME/archlinux). - Optionally writes to a selected USB drive with progress feedback.
$ DEBUG=1 ./getarch.sh
Starting script...
Initializing...
[DEBUG] Starting main function
[DEBUG] Commands checked
[DEBUG] Creating temporary directory
[DEBUG] Changed to temp directory: /tmp/tmp.abc123
[DEBUG] Fetching version from https://archlinux.org/releng/releases/
[DEBUG] Determined version: 2025.03.01
...
Successfully downloaded and verified archlinux-2025.03.01-x86_64.iso
Would you like to write the ISO to a flash drive? (y/N): y
[DEBUG] Detected 1 USB drives
Available USB drives:
1) disk4
Select a drive (1-1, or 0 to skip): 1
...
Successfully wrote ISO to disk4- macOS Detection: Detects USB drives based on "Removable Media: Removable" or "Device Location: External" from
diskutil. - Linux Detection: Uses
lsblkto find removable block devices.
Feel free to open issues or submit pull requests for improvements, especially for edge cases in drive detection or additional features.
MIT License - feel free to use, modify, and distribute.