Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 50 lines (39 sloc) 1.531 kb
#!/bin/bash
# To force a specific version of WordPress, set this variable:
#
# install_version="4.1"
# Used in this script only
#
current_version_dir=${OPENSHIFT_DATA_DIR}current
#
# If WordPress is already installed in the current gear, there
# is nothing to build :-)
#
[ -d "${current_version_dir}" ] && exit 0
#
# Download the latest stable version if no install_version specified,
# as long as the latest version is upgrade-compatible:
#
if [ -z "$install_version" ]; then
install_version=$(curl -s "https://api.wordpress.org/core/version-check/1.7/?version=4.1" | python -c 'import sys, json; latest = json.load(sys.stdin)["offers"][0]; print latest["version"] if latest["response"] == "upgrade" else "4.1"')
fi
# Download and install WordPress
#
install_dir=${OPENSHIFT_BUILD_DEPENDENCIES_DIR}${install_version}
mkdir -p $install_dir
pushd ${install_dir} >/dev/null
curl -Ls http://wordpress.org/wordpress-${install_version}.tar.gz > wordpress-${install_version}.tar.gz
# Verify the sources
#
tarball_md5=$(md5sum wordpress-${install_version}.tar.gz | cut -d ' ' -f 1)
wordpress_md5=$(curl -Ls http://wordpress.org/wordpress-${install_version}.tar.gz.md5)
if [ "${tarball_md5}" != "${wordpress_md5}" ]; then
echo "ERROR: WordPress ${install_version} MD5 checksum mismatch."
exit 1;
fi
# Install WordPress
#
tar --strip-components=1 -xzf wordpress-${install_version}.tar.gz
rm -rf wordpress-${install_version}.tar.gz
echo $install_version > ${OPENSHIFT_BUILD_DEPENDENCIES_DIR}.current_version
popd >/dev/null
Jump to Line
Something went wrong with that request. Please try again.