Permalink
Browse files

Commit of version 0.2.

* Script can now both use wget or cURL to download Magento. wget is preferred. (thanks Rouven for the input)
* modman can be initialized from install script
* Introduce changelog to README.markdown
* Update documentation (README.markdown)
* Send error messages to standard error output
* Change mode of files in var/locks to 666 (later re-indexing was blocked for some users when they executed MageSpawner as "root")
  • Loading branch information...
1 parent 78ec17f commit 83ef7c7b477c0904974158ae2f1d7975acb58289 @mzeis committed Jul 14, 2012
Showing with 75 additions and 50 deletions.
  1. +23 −8 README.markdown
  2. +51 −41 install
  3. +1 −1 remove
View
@@ -14,12 +14,12 @@ The goal is to quickly create new (and remove) Magento installations for testing
* Needs to be run via sudo / as root (chown and chmod are used)
* These commands must be available:
* basename
+ * command
* mysql
* php
* sed
* tar
- * wget
- * which
+ * wget OR curl
## Installation
@@ -34,7 +34,7 @@ Run `sudo ./install` and follow the instructions. You have to be a superuser bec
This is how it looks like on my VM:
Welcome to MageSpawner.
-
+
Which version do you want to install?
1) None, abort installation
2) CE 1.5.0.1
@@ -51,16 +51,16 @@ This is how it looks like on my VM:
Thanks, the required information was provided. The installation will now begin.
Downloading Magento package...
- --2012-03-04 12:32:13-- http://www.magentocommerce.com/downloads/assets/1.7.0.2/magento-1.7.0.2.tar.gz
+ --2012-07-14 14:44:40-- http://www.magentocommerce.com/downloads/assets/1.7.0.2/magento-1.7.0.2.tar.gz
Auflösen des Hostnamen www.magentocommerce.com... 209.15.239.51
Verbindungsaufbau zu www.magentocommerce.com|209.15.239.51|:80... verbunden.
HTTP-Anforderung gesendet, warte auf Antwort... 200 OK
- Länge: 17653068 (17M) [application/x-gzip]
+ Länge: 17891797 (17M) [application/x-gzip]
In »magento-1.7.0.2.tar.gz« speichern.
- 100%[===================================================================================================================>] 17.653.068 1,75M/s in 15s
+ 100%[===================================================================================================================>] 17.891.797 932K/s in 22s
- 2012-03-04 12:32:28 (1,13 MB/s) - »magento-1.7.0.2.tar.gz« gespeichert [17653068/17653068]
+ 2012-07-14 14:45:03 (791 KB/s) - »magento-1.7.0.2.tar.gz« gespeichert [17891797/17891797]
Package downloaded.
@@ -71,7 +71,7 @@ This is how it looks like on my VM:
Database created.
Executing Magento setup script...
- SUCCESS: 9a96247823ea7c2cd8f3ebff7db0a544
+ SUCCESS: 01bf386fcd1c62c1624dd2f5682f6322
Setup script executed. Please write down the encryption key provided above.
Reindexing Magento indexes...
@@ -92,6 +92,9 @@ This is how it looks like on my VM:
Final permission settings...
Done.
+ Do you want to use modman? (y/n) y
+ Initialized Module Manager at /var/www/magento/shops/1702.magentoshops.vm
+
If you didn't see any error messages, everything went fine.
Set up your vhost config and host entries (if needed) and you are ready to go!
The frontend shop URL is http://1702.magentoshops.vm.
@@ -121,6 +124,18 @@ After the script has finished, you may be two steps away from using the new Mage
The VirtualDocumentRoot path /var/www/magento/shops/ has to match the MAGE_BASE_DIR setting in config.conf.
The script automatically edits Magentos .htaccess so that the RewriteBase is adjusted for this setup.
+## Changelog
+
+v0.2
+---
+* Script can now both use wget or cURL to download Magento. wget is preferred. (thanks Rouven for the input)
+* modman can be initialized from install script
+* Minor changes / fixes
+
+v0.1
+---
+* Initial commit
+
## License
Copyright 2011-2012 Matthias Zeis
View
@@ -18,9 +18,9 @@
# System Requirements:
# - bash
# - The following commands must be locatable in your $PATH
-# basename mysql php sed tar wget which
+# basename command mysql php sed tar wget (or curl)
-version="0.1"
+version="0.2"
usage="\
MageSpawner (v$version)
@@ -62,20 +62,25 @@ fi
echo -e 'Welcome to MageSpawner.\n'
if [[ ! -f ${0%/*}/config.conf ]]; then
- echo -e 'config.conf not found.\nPlease copy config.conf.sample to config.conf and adjust your settings.'
+ echo -e >&2 'config.conf not found.\nPlease copy config.conf.sample to config.conf and adjust your settings.'
exit 1
fi
. ${0%/*}/config.conf
if [[ $MAGE_BASE_DIR = "" || $MAGE_BASE_DIR = "/" ]]; then
- echo "Base directory '$MAGE_BASE_DIR' is not allowed. Please change in configuration."
+ echo >&2 "Base directory '$MAGE_BASE_DIR' is not allowed. Please change in configuration."
exit 1
fi
-MYSQL=$(which mysql) || { echo 'MySQL executable not found'; exit 1; }
-PHP=$(which php) || { echo 'PHP executable not found'; exit 1; }
-SED=$(which sed) || { echo 'sed command not found'; exit 1; }
-
+MYSQL=$(command -v mysql) || { echo >&2 'MySQL executable not found'; exit 1; }
+PHP=$(command -v php) || { echo >&2 'PHP executable not found'; exit 1; }
+SED=$(command -v sed) || { echo >&2 'sed command not found'; exit 1; }
+WGET=$(command -v wget)
+CURL=$(command -v curl)
+if [[ $WGET = "" && $CURL = "" ]]; then
+ echo >&2 'Neither wget nor curl command found. Please install wget or curl and re-run command.';
+ exit 1;
+fi
echo "Which version do you want to install?"
echo "1) None, abort installation"
@@ -147,40 +152,13 @@ echo -e "Thanks, the required information was provided. The installation will no
cd $MAGE_BASE_DIR
-echo "How do you want to download the Magento package?"
-echo "1) None, abort installation"
-echo "2) wget"
-echo "3) curl"
-
-while true; do
- read -p "Enter the number (e.g. 2): " DOWNLOAD_METHOD
-
- case "$DOWNLOAD_METHOD" in
- 1)
- echo "Aborting installation."
- exit;
- ;;
- 2)
- echo " "
- echo "Downloading Magento package..."
- echo " "
- wget $MAGE_DOWNLOAD_URL
- break
- ;;
- 3)
- echo " "
- echo "Downloading Magento package..."
- echo " "
- curl -O $MAGE_DOWNLOAD_URL
- break
- ;;
- *)
- echo -e "Invalid option, please try again.\n"
- ;;
- esac
-done
-
+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"
@@ -203,6 +181,7 @@ echo -e "Setup script executed. Please write down the encryption key provided ab
echo "Reindexing Magento indexes..."
$PHP -f shell/indexer.php reindexall
+chmod 666 var/locks/*
echo -e "Indexes reindexed.\n"
echo "Editing .htaccess for VirtualDocumentRoot configuration (setting RewriteBase)..."
@@ -217,6 +196,37 @@ chmod 644 app/etc/local.xml
chown ${LINUX_USER}:${LINUX_GROUP} app/etc/local.xml
echo -e "Done.\n"
+while true; do
+ read -p "Do you want to use modman? (y/n) " MODMAN_USE
+
+ case "$MODMAN_USE" in
+ y)
+ MODMAN_BIN=$(command -v modman)
+
+ if [[ $MODMAN_BIN != "" ]]; then
+ modman init
+ echo ""
+ else
+ # if [[ $WGET != "" ]]; then
+ # bash < <(wget -O - https://raw.github.com/colinmollenhour/modman/master/modman-installer)
+ # elif [[ $CURL != "" ]]; then
+ # bash < <(curl -s https://raw.github.com/colinmollenhour/modman/master/modman-installer)
+ # fi
+ # source ~/.profile
+ echo 'Please install modman first: https://github.com/colinmollenhour/modman';
+ echo 'Then call "modman init" from the Magento root directory as this will not be executed now.';
+ fi
+ break;
+ ;;
+ n)
+ break;
+ ;;
+ *)
+ echo -e "Invalid command, please enter 'y' or 'n' (without quotes).\n"
+ ;;
+ esac
+done
+
echo "If you didn't see any error messages, everything went fine."
echo "Set up your vhost config and host entries (if needed) and you are ready to go!"
echo "The frontend shop URL is ${MAGE_UNSECURE_URL}."
View
@@ -69,7 +69,7 @@ if [[ ! -f ${0%/*}/config.conf ]]; then
fi
. ${0%/*}/config.conf
-MYSQL=$(which mysql) || { echo 'MySQL executable not found'; exit 1; }
+MYSQL=$(which mysql) || { echo >&2 'MySQL executable not found'; exit 1; }
echo "Which shop do you want to uninstall? Provide only the subdomain part of the domains provided."
ls -1 ${MAGE_BASE_DIR}

0 comments on commit 83ef7c7

Please sign in to comment.