Permalink
Browse files

Version v0.3.1

Changelog
* Cache downloaded archive files for faster creation of a new shop (directory configurable via MAGE_DOWNLOAD_DIR)
  • Loading branch information...
1 parent dd270f3 commit c9481735eeb40c7b9e28d31193083bde86395054 @mzeis committed Mar 24, 2013
Showing with 26 additions and 12 deletions.
  1. +3 −0 README.markdown
  2. +1 −0 config.conf.sample
  3. +22 −12 install
View
@@ -190,6 +190,9 @@ This is how it looks on my VM:
## Changelog
+### v0.3.1
+* Cache downloaded archive files for faster creation of a new shop (directory configurable via MAGE_DOWNLOAD_DIR)
+
### v0.3
* Added command line parameters for automatic installation
View
@@ -1,3 +1,4 @@
+MAGE_DOWNLOAD_DIR="/tmp/MageSpawner/" # Directory in which downloaded Magento files can be stored
MAGE_DOMAIN="magentoshops.vm" # The shops will be created under this subdomain
MAGE_DEFAULT_NAME="shop" # Preset for the shop name. The shop name is used
# as part of the domain, directory and database name.
View
34 install
@@ -20,7 +20,7 @@
# - The following commands must be locatable in your $PATH
# basename command mysql php sed tar wget (or curl)
-version="0.3"
+version="0.3.1"
usage="\
MageSpawner (v$version)
@@ -137,6 +137,24 @@ init_spawner ()
}
###########################
+## Get Magento archive file
+
+get_magento_archive_file ()
+{
+ if [[ ! -f $MAGE_DOWNLOAD_PATH ]]; then
+ mkdir -p ${MAGE_DOWNLOAD_DIR}
+ echo -e "Downloading Magento package..."
+ if [[ $WGET != "" ]]; then
+ wget -O $MAGE_DOWNLOAD_PATH $MAGE_DOWNLOAD_URL
+ elif [[ $CURL != "" ]]; then
+ curl $MAGE_DOWNLOAD_URL -o $MAGE_DOWNLOAD_PATH
+ fi
+ echo -e "Package downloaded.\n"
+ fi
+ return 0;
+}
+
+###########################
## Get Magento download URL
get_magento_download_url ()
@@ -332,25 +350,17 @@ MAGE_SECURE_URL="http://${MAGE_SHOPDOMAIN}"
MAGE_DOWNLOAD_FILENAME=$(basename $MAGE_DOWNLOAD_URL)
DB_NAME="${DB_NAMEPREFIX}${MAGE_NAME}"
DB_SQL="CREATE DATABASE IF NOT EXISTS ${DB_NAME} CHARACTER SET utf8 COLLATE utf8_general_ci;"
+MAGE_DOWNLOAD_PATH="${MAGE_DOWNLOAD_DIR}${MAGE_DOWNLOAD_FILENAME}"
echo -e "Thanks, the required information was provided. The installation will now begin.\n"
cd $MAGE_BASE_DIR
-echo -e "Downloading Magento package..."
-
-if [[ $WGET != "" ]]; then
- wget $MAGE_DOWNLOAD_URL
-elif [[ $CURL != "" ]]; then
- curl -O $MAGE_DOWNLOAD_URL
-fi
-
-echo -e "Package downloaded.\n"
+get_magento_archive_file
echo "Unpacking package and setting permissions."
-tar -zxf $MAGE_DOWNLOAD_FILENAME
+tar -zxf $MAGE_DOWNLOAD_PATH
mv magento/ "$MAGE_SHOPDOMAIN"/
-rm -f $MAGE_DOWNLOAD_FILENAME
cd "$MAGE_SHOPDOMAIN"/
$CMDCHMOD $LINUX_PERM_WRITABLE_FOLDERS . app/etc var/ media/
echo -e "Package unpacked and permssions set.\n"

0 comments on commit c948173

Please sign in to comment.