Last active
February 2, 2017 10:39
-
-
Save emtii/682dc3849a832f3ad6888b417bc9a5fd to your computer and use it in GitHub Desktop.
wget all shopware versions available as zip archives on github to local and unzip those.
This file contains hidden or 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/bash | |
# array of file names in github = shopware versions | |
ARRAY=( v5.2.16 v5.2.15 v5.2.14 v5.2.13 v5.2.12 v5.2.11 v5.2.10 v5.2.9 v5.2.8 v5.2.7 v5.2.6 v5.2.5 v5.2.4 v5.2.3 v5.2.2 v5.2.1 v5.2.0 v5.1.6 v5.1.5 v5.1.4 v5.1.3 v5.1.1 v5.1.0 v5.0.4 v5.0.3 v5.0.2 v5.0.1 v5.0.0 4.3.7 4.3.6 4.3.3 4.3.2 4.3.1 4.3.0 4.2.3 4.2.2 4.2.1 4.2.0 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 ) | |
# iterate filenames, wget files, unzip files | |
for (( i = 0; i < ${#ARRAY[@]}; ++i )); do | |
DIRNAME="shopware-${ARRAY[i]}" | |
FILENAME="${ARRAY[i]}.zip" | |
SWVERSION=${ARRAY[i]} | |
URL="https://github.com/shopware/shopware/archive/" | |
URL_FULL=$URL$FILENAME | |
# check for existing dir | |
if [ -d $DIRNAME ]; then | |
printf "folder $DIRNAME already exists \n" | |
else | |
# check for existing file | |
if [ -e $FILENAME ]; then | |
printf "file $FILENAME already exists, just unzip now \n" | |
unzip $FILENAME | |
else | |
# check for existing remote file | |
wget --spider -q $URL_FULL && EXIST=1 || EXIST=0 | |
if [ $EXIST = 1 ]; then | |
printf "wget shopware version $SWVERSION and unzip \n" | |
wget $URL_FULL | |
unzip $FILENAME | |
rm $FILENAME | |
else | |
printf "file $FILENAME does not exist on remote host url $URL_FULL \n" | |
fi | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment