Created
September 22, 2011 21:35
-
-
Save splittingred/1236123 to your computer and use it in GitHub Desktop.
Bash script to install a new MODX Revolution 2.2+ install via CLI
This file contains 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
Examples of above script: | |
# into a standard directory, where config.xml resides in the current working directory | |
sh install.sh /home/modx/public_html/ | |
# with a custom config.xml file | |
sh install.sh /home/modx/public_html/ /opt/local/modx/config.xml |
This file contains 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 | |
DIR="$( cd -P "$( dirname "$0" )" && pwd )/" | |
CONFIGFILE='chz' | |
if [ $# -lt 2 ] ; then | |
CONFIGFILE="${DIR}config.xml" | |
else | |
CONFIGFILE=$2 | |
fi | |
if [ ! -f ${CONFIGFILE} ]; then | |
echo "No config file found at ${CONFIGFILE}"; exit | |
fi | |
echo "Using config file at ${CONFIGFILE}" | |
if [ ! -d $1 ]; then | |
echo "Creating directory: $1" | |
mkdir $1 | |
fi | |
cd $1 | |
echo "Getting file from modx.com..." | |
wget -O modx.zip http://modx.com/download/latest/ | |
echo "Unzipping file..." | |
unzip "./modx.zip" -d ./ | |
ZDIR=`ls -F | grep "\/" | head -1` | |
if [ "${ZDIR}" = "/" ]; then | |
echo "Failed to find directory..."; exit | |
fi | |
if [ -d "${ZDIR}" ]; then | |
cd ${ZDIR} | |
echo "Moving out of temp dir..." | |
mv ./* ../ | |
cd ../ | |
rm -r "./${ZDIR}" | |
echo "Removing zip file..." | |
rm "./modx.zip" | |
cd "setup" | |
echo "Running setup..." | |
php ./index.php --installmode=new --config=${CONFIGFILE} | |
echo "Done!" | |
else | |
echo "Failed to find directory: ${ZDIR}" | |
exit | |
fi | |
cd ${DIR} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment