Skip to content

Instantly share code, notes, and snippets.

@iki
Last active August 29, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iki/10985926 to your computer and use it in GitHub Desktop.
Save iki/10985926 to your computer and use it in GitHub Desktop.
shell script to download [kxl]ubuntu release iso ... just rename the script to requested edition-release-type-platform
#!/bin/sh
name="${0##*/}"
name="${name%.sh}"
edition="${name%%-*}"
version="${name#*-}"
version="${version%%-*}"
# use main ubuntu cdimage server
if [ "$edition" = 'ubuntu' ]; then
# use the main ubuntu releases server
root="http://releases.ubuntu.com/$version"
# or use an ubuntu releases mirror
root="http://www.mirrorservice.org/sites/releases.ubuntu.com/$version"
# or use a local ubuntu releases mirror
root="http://releases.ubuntu.cz/$version"
else
# use the main ubuntu cdimage server
root="http://cdimage.ubuntu.com/$edition/releases/$version/release"
# or use an ubuntu cdimage mirror
root="http://www.mirrorservice.org/sites/cdimage.ubuntu.com/cdimage/$edition/releases/$version/release"
fi
echo "get $edition $version from $root" >&2
[ -f "$name.md5" ] || wget "$root/MD5SUMS" -O - | grep "$name.iso" > "$name.md5" || { rm "$name.md5"; exit 1; }
wget -c "$root/$name.iso" || exit $?
md5sum -c "$name.md5"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment