Last active
August 29, 2015 13:59
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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