| ... | ... |
@@ -2,12 +2,48 @@ |
| 2 | 2 |
|
| 3 | 3 |
Print [Linux][] [distro][] [image][] [URL][]s. |
| 4 | 4 |
|
| 5 |
+Note that the latest versions are hard coded, which means they will need to be |
|
| 6 |
+manually updated, which means they may be out of date. |
|
| 7 |
+ |
|
| 5 | 8 |
[`distro-url`]: https://git.rcrnstn.net/rcrnstn/distro-url |
| 6 | 9 |
[Linux]: https://en.wikipedia.org/wiki/Linux |
| 7 | 10 |
[distro]: https://en.wikipedia.org/wiki/Linux_distribution |
| 8 | 11 |
[image]: https://en.wikipedia.org/wiki/Optical_disc_image |
| 9 | 12 |
[URL]: https://en.wikipedia.org/wiki/URL |
| 10 | 13 |
|
| 14 |
+## Usage |
|
| 15 |
+ |
|
| 16 |
+``` |
|
| 17 |
+distro-url [<distro> [<variant> [<arch> [<codename> [<version> [<mirror>]]]]]] |
|
| 18 |
+``` |
|
| 19 |
+ |
|
| 20 |
+- `<distro>`: The [distro][] to print the [URL][] for. |
|
| 21 |
+- `<variant>`, `<arch>`, `<codename>`, `<version>`: Optional parameters to |
|
| 22 |
+ select a different [image][] than the default. |
|
| 23 |
+- `<mirror>`: Optional override of the default [mirror][]. |
|
| 24 |
+ |
|
| 25 |
+[mirror]: https://en.wikipedia.org/wiki/Mirror_site |
|
| 26 |
+ |
|
| 27 |
+## Dependencies |
|
| 28 |
+ |
|
| 29 |
+- [POSIX][] [shell][]. |
|
| 30 |
+ |
|
| 31 |
+[POSIX]: https://en.wikipedia.org/wiki/POSIX |
|
| 32 |
+[shell]: https://en.wikipedia.org/wiki/Unix_shell |
|
| 33 |
+ |
|
| 34 |
+## Examples |
|
| 35 |
+ |
|
| 36 |
+```sh |
|
| 37 |
+$ distro-url debian |
|
| 38 |
+https://cdimage.debian.org/debian-cd/13.5.0-live/amd64/iso-hybrid/debian-live-13.5.0-amd64-gnome.iso |
|
| 39 |
+ |
|
| 40 |
+$ distro-url debian netinst |
|
| 41 |
+https://cdimage.debian.org/debian-cd/13.5.0/amd64/iso-cd/debian-13.5.0-amd64-netinst.iso |
|
| 42 |
+ |
|
| 43 |
+$ distro-url debian inst arm64 unknown 99.0.0 |
|
| 44 |
+https://cdimage.debian.org/debian-cd/99.0.0/arm64/iso-dvd/debian-99.0.0-arm64-DVD-1.iso |
|
| 45 |
+``` |
|
| 46 |
+ |
|
| 11 | 47 |
## License |
| 12 | 48 |
|
| 13 | 49 |
Licensed under the [ISC License][] unless otherwise noted, see the |
| 14 | 50 |
new file mode 100755 |
| ... | ... |
@@ -0,0 +1,121 @@ |
| 1 |
+#!/bin/sh |
|
| 2 |
+set -euC |
|
| 3 |
+ |
|
| 4 |
+# usage: distro-url [<distro> [<variant> [<arch> [<codename> [<version> [<mirror>]]]]]] |
|
| 5 |
+ |
|
| 6 |
+main() |
|
| 7 |
+{
|
|
| 8 |
+ guess "$@" |
|
| 9 |
+} |
|
| 10 |
+ |
|
| 11 |
+guess() |
|
| 12 |
+( |
|
| 13 |
+ distro="${1:-}"
|
|
| 14 |
+ variant="${2:-}"
|
|
| 15 |
+ arch="${3:-}"
|
|
| 16 |
+ codename="${4:-}"
|
|
| 17 |
+ version="${5:-}"
|
|
| 18 |
+ lower() { printf '%s\n' "$1" | tr 'A-Z' 'a-z'; }
|
|
| 19 |
+ upper() { printf '%s\n' "$1" | tr 'a-z' 'A-Z'; }
|
|
| 20 |
+ case "$distro/$variant" in |
|
| 21 |
+ *raspi*) : ${arch:="arm64"}; ext='img.xz'; ;;
|
|
| 22 |
+ *) : ${arch:="amd64"}; ext='iso'; ;;
|
|
| 23 |
+ esac |
|
| 24 |
+ case "$distro" in |
|
| 25 |
+ debian) |
|
| 26 |
+ : ${variant:="gnome"}
|
|
| 27 |
+ : ${codename:="trixie"}
|
|
| 28 |
+ : ${version:="13.5.0"}
|
|
| 29 |
+ case "$variant" in |
|
| 30 |
+ raspi) |
|
| 31 |
+ # : ${mirror:="https://get.debian.org/images/cloud"}
|
|
| 32 |
+ # : ${mirror:="https://cdimage.debian.org/images/cloud"}
|
|
| 33 |
+ : ${mirror:="https://cloud.debian.org/images/cloud"}
|
|
| 34 |
+ major="${version%%.*}"
|
|
| 35 |
+ ext='tar.xz' |
|
| 36 |
+ # dir="$codename/latest" |
|
| 37 |
+ # echo "$mirror/$dir/$distro-$major-$variant-$arch.$ext" |
|
| 38 |
+ dir="$codename/daily/latest" |
|
| 39 |
+ echo "$mirror/$dir/$distro-$major-$variant-$arch-daily.$ext" |
|
| 40 |
+ ;; |
|
| 41 |
+ *) |
|
| 42 |
+ # : ${mirror:="https://get.debian.org/images/release"}
|
|
| 43 |
+ # : ${mirror:="https://cdimage.debian.org/images/release"}
|
|
| 44 |
+ # : ${mirror:="https://cloud.debian.org/images/release"}
|
|
| 45 |
+ : ${mirror:="https://cdimage.debian.org/debian-cd"}
|
|
| 46 |
+ case "$variant" in |
|
| 47 |
+ netinst) media='iso-cd'; suffix=''; ;; |
|
| 48 |
+ inst) media='iso-dvd'; suffix=''; variant='DVD-1'; ;; |
|
| 49 |
+ *) media='iso-hybrid'; suffix='-live'; ;; |
|
| 50 |
+ esac |
|
| 51 |
+ dir="$version$suffix/$arch/$media" |
|
| 52 |
+ echo "$mirror/$dir/$distro$suffix-$version-$arch-$variant.$ext" |
|
| 53 |
+ ;; |
|
| 54 |
+ esac |
|
| 55 |
+ ;; |
|
| 56 |
+ raspios) |
|
| 57 |
+ : ${variant:="default"}
|
|
| 58 |
+ : ${codename:="trixie"}
|
|
| 59 |
+ : ${version:="2026-04-21"}
|
|
| 60 |
+ : ${mirror:="https://downloads.raspberrypi.com"}
|
|
| 61 |
+ case "$variant" in |
|
| 62 |
+ default) name="${distro}_${arch}"; suffix=''; ;;
|
|
| 63 |
+ *) name="${distro}_${variant}_${arch}"; suffix="-$variant"; ;;
|
|
| 64 |
+ esac |
|
| 65 |
+ dir="$name/images/$name-$version" |
|
| 66 |
+ echo "$mirror/$dir/$version-$distro-$codename-$arch$suffix.$ext" |
|
| 67 |
+ ;; |
|
| 68 |
+ ubuntu|\ |
|
| 69 |
+ edubuntu|\ |
|
| 70 |
+ kubuntu|lubuntu|xubuntu|\ |
|
| 71 |
+ ubuntucinnamon|ubuntu-mate|ubuntu-budgie|ubuntu-unity|\ |
|
| 72 |
+ ubuntustudio|ubuntukylin) |
|
| 73 |
+ : ${variant:="desktop"}
|
|
| 74 |
+ : ${codename:="resolute"}
|
|
| 75 |
+ : ${version:="26.04"}
|
|
| 76 |
+ if [ "$distro/$arch" = 'ubuntu/amd64' ] |
|
| 77 |
+ then : ${mirror:="https://releases.ubuntu.com"}; dir="$codename";
|
|
| 78 |
+ else : ${mirror:="https://cdimage.ubuntu.com/$distro/releases"}; dir="$codename/release";
|
|
| 79 |
+ fi |
|
| 80 |
+ case "$variant" in |
|
| 81 |
+ server) suffix='-live'; ;; |
|
| 82 |
+ *-raspi) suffix='-preinstalled'; variant="${variant%%-raspi}"; arch="$arch+raspi"; ;;
|
|
| 83 |
+ *) suffix=''; ;; |
|
| 84 |
+ esac |
|
| 85 |
+ echo "$mirror/$dir/$distro-$version$suffix-$variant-$arch.$ext" |
|
| 86 |
+ ;; |
|
| 87 |
+ linuxmint) |
|
| 88 |
+ : ${variant:="cinnamon"}
|
|
| 89 |
+ : ${codename:="zena"}
|
|
| 90 |
+ : ${version:="22.3"}
|
|
| 91 |
+ : ${mirror:="https://pub.linuxmint.io"}
|
|
| 92 |
+ case "$arch" in |
|
| 93 |
+ amd64) arch='64bit' ;; |
|
| 94 |
+ esac |
|
| 95 |
+ dir="stable/$version" |
|
| 96 |
+ echo "$mirror/$dir/$distro-$version-$variant-$arch.$ext" |
|
| 97 |
+ ;; |
|
| 98 |
+ opensuse) |
|
| 99 |
+ : ${variant:="gnome"}
|
|
| 100 |
+ : ${codename:="tumbleweed"}
|
|
| 101 |
+ : ${version:="-"}
|
|
| 102 |
+ : ${mirror:="https://download.opensuse.org"}
|
|
| 103 |
+ distro='openSUSE' |
|
| 104 |
+ case "$codename" in |
|
| 105 |
+ tumbleweed) codename='Tumbleweed' ;; |
|
| 106 |
+ esac |
|
| 107 |
+ case "$variant" in |
|
| 108 |
+ inst) suffix=''; variant='DVD'; ;; |
|
| 109 |
+ netinst) suffix=''; variant='NET'; ;; |
|
| 110 |
+ *) suffix='-Live'; variant="$(upper "$variant")"; ;; |
|
| 111 |
+ esac |
|
| 112 |
+ case "$arch" in |
|
| 113 |
+ amd64) arch='x86_64' |
|
| 114 |
+ esac |
|
| 115 |
+ dir="$codename/iso"; dir="$(lower "$dir")"; |
|
| 116 |
+ echo "$mirror/$dir/$distro-$codename-$variant$suffix-$arch-Current.$ext" |
|
| 117 |
+ ;; |
|
| 118 |
+ esac |
|
| 119 |
+) |
|
| 120 |
+ |
|
| 121 |
+main "$@" |