Skip to content

Instantly share code, notes, and snippets.

@kirkegaard
Created March 16, 2010 10:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kirkegaard/333838 to your computer and use it in GitHub Desktop.
Save kirkegaard/333838 to your computer and use it in GitHub Desktop.
install wordpress from a selected source
#!/bin/bash
CURRENT_PATH=`pwd`
INSTALL_FOLDER="public_html"
METHOD="HTTP"
HTTP_SOURCE="http://wordpress.org/latest.tar.gz"
SVN_SOURCE=""
SVN_SOURCE_BASE="http://core.svn.wordpress.org"
SVN_SOURCE_STABLE="/tags/2.9.2/"
SVN_SOURCE_TRUNK="/trunk/"
trap cleanup INT
function cleanup() {
echo ""
echo ""
echo "Cleaning up"
echo "==========="
echo "Removing: ${INSTALL_FOLDER}"
rm -rf "${CURRENT_PATH}/${INSTALL_FOLDER}"
}
function showOptions() {
echo ""
echo "Please select install method:"
echo "1) SVN"
echo "2) HTTP"
read opt;
case ${opt} in
1) METHOD="SVN";;
2) METHOD="HTTP";;
*) showOptions;;
esac
echo ""
}
function showSvnOptions() {
echo ""
echo "Please select svn source:"
echo "1) Stable (2.9.2)"
echo "2) Trunk (3.0)"
read opt;
case ${opt} in
1) SVN_SOURCE=${SVN_SOURCE_BASE}${SVN_SOURCE_STABLE};;
2) SVN_SOURCE=${SVN_SOURCE_BASE}${SVN_SOURCE_TRUNK};;
*) showSvnOptions;;
esac
echo ""
}
function install_http() {
echo "Installing using http"
echo "====================="
mkdir ${INSTALL_FOLDER}
curl -Lsf ${HTTP_SOURCE} | tar xvz --strip 1 -C${INSTALL_FOLDER}
}
function install_svn() {
echo "Installing using svn"
echo "===================="
svn co ${SVN_SOURCE} ${INSTALL_FOLDER}
}
showOptions
if [ "$METHOD" = "HTTP" ] ; then
install_http
elif [ "$METHOD" = "SVN" ] ; then
showSvnOptions
install_svn
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment