Skip to content

Instantly share code, notes, and snippets.

@mhauri
Last active August 29, 2015 14:01
Show Gist options
  • Save mhauri/a4d9f1c32bbd90641076 to your computer and use it in GitHub Desktop.
Save mhauri/a4d9f1c32bbd90641076 to your computer and use it in GitHub Desktop.
CLI Magento downloader
#!/bin/bash
VERSION='1.0'
BASE_URL='http://www.magentocommerce.com/downloads/assets'
FILE="magento-$1.tar.gz"
DIRECTORY='magento'
if [[ -z "$1" ]]; then
echo "Please set a Magento CE version by using: mageload.sh 1.X.X.X"
exit
fi
if [ -d "$DIRECTORY" ]; then
echo "Magento directory exists, skip download!"
exit 0
fi
function download {
echo "_______________________________________________________________________________"
echo ""
echo " Mage Load, v$VERSION"
echo " Download: magento-$1.tar.gz"
echo "_______________________________________________________________________________"
echo ""
# http://www.magentocommerce.com/downloads/assets/1.8.1.0/magento-1.8.1.0.tar.gz
curl -O "$BASE_URL/$1/$FILE"
}
case "$1" in
"1.9.0.1" | \
"1.9.0.0" | \
"1.8.1.0" | \
"1.8.0.0" | \
"1.7.0.2" | \
"1.7.0.1" | \
"1.7.0.0" | \
"1.6.2.0" | \
"1.6.1.0" | \
"1.6.0.0" | \
"1.5.1.0" | \
"1.5.0.1" | \
"1.4.2.0" | \
"1.4.1.1" | \
"1.4.1.0" | \
"1.4.0.1" | \
"1.4.0.0")
download $1 || tar xfvz $FILE || rm -rf $FILE
;;
*)
echo "$1 is not a valid Magento CE version or lower than 1.4.0.0"
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment