Skip to content

Instantly share code, notes, and snippets.

@JeffCarpenter
Created July 19, 2025 06:03
Show Gist options
  • Save JeffCarpenter/2f533b2364c8cc71004ed12d1097e6c5 to your computer and use it in GitHub Desktop.
Save JeffCarpenter/2f533b2364c8cc71004ed12d1097e6c5 to your computer and use it in GitHub Desktop.
download cachyos with aria2
#!/usr/bin/env bash
# CachyOS ISO Downloader - Max Concision
set -euo pipefail
# --- Config ---
readonly I="cachyos-desktop-linux-250713.iso" # ISO filename
readonly M_ESC="magnet:?xt=urn:btih:f4e9c04ba9706d03ebaf43b1b031da6e59173af9&dn=cachyos-desktop-linux-250713.iso&tr=udp%3A%2F%2Ffosstorrents.com%3A6969%2Fannounce&tr=http%3A%2F%2Ffosstorrents.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.torrent.eu.org%3A451%2Fannounce&tr=udp%3A%2F%2Ftracker-udp.gbitt.info%3A80%2Fannounce&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Fexodus.desync.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.theoks.net%3A6969%2Fannounce&tr=udp%3A%2F%2Fopentracker.io%3A6969%2Fannounce&ws=https%3A%2F%2Fcdn77.cachyos.org%2FISO%2Fdesktop%2F250713%2Fcachyos-desktop-linux-250713.iso&ws=https%3A%2F%2Fcdn.cachyos.org%2FISO%2Fdesktop%2F250713%2Fcachyos-desktop-linux-250713.iso&ws=https%3A%2F%2Faur.cachyos.org%2FISO%2Fdesktop%2F250713%2Fcachyos-desktop-linux-250713.iso&ws=https%3A%2F%2Fmirror.cachyos.org%2FISO%2Fdesktop%2F250713%2Fcachyos-desktop-linux-250713.iso&ws=https%3A%2F%2Fus.cachyos.org%2FISO%2Fdesktop%2F250713%2Fcachyos-desktop-linux-250713.iso&ws=https%3A%2F%2Fmirror.lesviallon.fr%2Fcachy%2FISO%2Fdesktop%2F250713%2Fcachyos-desktop-linux-250713.iso&ws=https%3A%2F%2Fmirror.fast0ne.com%2FISO%2Fdesktop%2F250713%2Fcachyos-desktop-linux-250713.iso&ws=https%3A%2F%2Fno.mirror.cx%2Fcachyos%2FISO%2Fdesktop%2F250713%2Fcachyos-desktop-linux-250713.iso&ws=https%3A%2F%2Fmirror.funami.tech%2Fcachy%2FISO%2Fdesktop%2F250713%2Fcachyos-desktop-linux-250713.iso&ws=https%3A%2F%2Fat.cachyos.org%2FISO%2Fdesktop%2F250713%2Fcachyos-desktop-linux-250713.iso&ws=https%3A%2F%2Fde-nue.soulharsh007.dev%2Fcachyos%2FISO%2Fdesktop%2F250713%2Fcachyos-desktop-linux-250713.iso&ws=https%3A%2F%2Fmirror.nju.edu.cn%2Fcachyos%2FISO%2Fdesktop%2F250713%2Fcachyos-desktop-linux-250713.iso&ws=https%3A%2F%2Fmirrors.ustc.edu.cn%2Fcachyos%2FISO%2Fdesktop%2F250713%2Fcachyos-desktop-linux-250713.iso&ws=https%3A%2F%2Fmirror.scholarshub.world%2FISO%2Fdesktop%2F250713%2Fcachyos-desktop-linux-250713.iso&ws=https%3A%2F%2Fcachyos.next-works.it%2FISO%2Fdesktop%2F250713%2Fcachyos-desktop-linux-250713.iso&ws=https%3A%2F%2Fmirror.limda.net%2Fcachy%2FISO%2Fdesktop%2F250713%2Fcachyos-desktop-linux-250713.iso&ws=https%3A%2F%2Fcachyos.doridian.net%2FISO%2Fdesktop%2F250713%2Fcachyos-desktop-linux-250713.iso"
# --- Main Logic (inlined into wrapper) ---
download_cachyos_iso() {
# Logging helper
_log() { printf '\033[0;%sm==>\033[0m %s\n' "$1" "$2"; }
# Prereqs
for c in aria2c curl awk; do command -v "$c" &>/dev/null || _log 31 "FATAL: '$c' missing."; done
# Checksum
local r_id="${I//[!0-9]/}" c_url="https://cdn77.cachyos.org/ISO/desktop/${r_id}/${I}.sha256"
local h=$(curl -sSfL "$c_url" | awk '{print $1}') || _log 31 "FATAL: Checksum failed: $c_url."
[[ "$h" =~ ^[0-9a-fA-F]{64}$ ]] || _log 31 "FATAL: Invalid SHA256."
# Sources (Magnet + Web Seeds)
local unesc_m="${M_ESC//&/&}"
local -a s
readarray -t s < <( { echo "$unesc_m"; printf '%s\n' "$unesc_m" | tr '&' '\n' | grep '^ws=' | sed 's/^ws=//; s/%/\\x/g'; } | sort -u )
# Download
aria2c --checksum="sha-256=$h" --out="$I" --continue=true --max-connection-per-server=16 --split=16 --min-split-size=1M --dir=. "${s[@]}" || _log 31 "FATAL: Download failed."
_log 32 "SUCCESS: '$I' downloaded & verified!"
}
# Run
[[ "${BASH_SOURCE[0]}" == "${0}" ]] && download_cachyos_iso
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment