30 lines
730 B
Bash
30 lines
730 B
Bash
#!/usr/bin/env bash
|
|
|
|
cwd="$(pwd)"
|
|
|
|
function install() {
|
|
product="$1"
|
|
version="$(curl -Ls "https://www.mkgmap.org.uk/download/$product.html" | grep "text: current().version" | sed -e "s/^[^=]*<span data-bind=\"text: current().version\">//g" | sed -e "s/<\/span>//g")"
|
|
|
|
cd "/tmp"
|
|
|
|
curl -Ls "https://www.mkgmap.org.uk/download/$product-r$version.zip" -o "$product.zip"
|
|
|
|
if [[ $? == 0 ]] && [[ -f "$product.zip" ]]; then
|
|
unzip "$product.zip"
|
|
|
|
if [[ -d "$product-r$version" ]]; then
|
|
mv "$product-r$version" "/opt/$product"
|
|
rm -f "$product.zip"
|
|
else
|
|
exit 255
|
|
fi
|
|
else
|
|
exit 255
|
|
fi
|
|
|
|
cd "$cwd"
|
|
}
|
|
|
|
install "mkgmap"
|
|
install "splitter" |