I don’t like the automated updater. I don’t know why, I just don’t. I have this stupid simple script I use instead. I cleaned it up before posting here. But this is what I use when I want to upgrade my various installs to the latest version, or the nightly build. I didn’t bother to put the svn stuff in here, since the script I use for that is fairly weird and particular to me.
#!/bin/bash
####################################################################
# WORDPRESS.SH - WordPress Upgrade Script for BASH SHELL #
# #
# This script will download and copy up WordPress to the account. #
# It's pretty simple, with the bare minimum of error checking. So #
# be careful. #
# #
# Author: Mika Epstein #
# URL: https://halfelf.org/hacks/wordpress-upgrade-script/ #
# #
# Usage: ./wordpress.sh version #
# #
# #
# This program is free software; you can redistribute it and/or #
# modify it under the terms of the GNU General Public License as #
# published by the Free Software Foundation; either version 2 of #
# the License, or (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
####################################################################
if [ "$1" = "" ]
then
echo "EXIT: FAILURE! Call this as './wordpress.sh VERSION', you nut!"
exit
fi
# Quick check if someone wants the nightly build with a 'You sure?'
# double check.
# This sets the URL, as it's different for the nightly builds.
if [ "$1" = "nightly" ]
then
DOMAIN=wordpress.org/nightly-builds
VERSION=wordpress-latest
read -p "Are you sure you want to install the NIGHTLY build? (y/n) " -n 1
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo
echo "You have opted NOT to install the nightly build of WordPress."
exit 1
else
echo
fi
else
DOMAIN=wordpress.org
if [ "$1" = "latest" ]
then
VERSION=latest
else
VERSION=wordpress-$1
fi
fi
# Download WordPress
wget -q http://$DOMAIN/$VERSION.zip
# If the file didn't download, then you probably got the URL wrong. Fail.
if ! [ -f $VERSION.zip ]
then
echo "EXIT: FAILURE! Could not download $VERSION.zip - Did you get the version right?"
exit
else
echo
unzip -q $VERSION.zip
fi
# This is ONE LAST CHANCE. If you say anything other than yes, then it cleans up.
read -p "Last chance. You sure you want to install WordPress $1 for $USER? (y/n) " -n 1
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
rm -rf wordpress/
rm $VERSION.zip
echo
echo "EXIT: You have chosen NOT to install WordPress $1 at this time."
exit 1
else
echo
fi
# Get rid of hello dolly and akismet
rm -rf wordpress/wp-content/plugins/akismet
rm wordpress/wp-content/plugins/hello.php
# Copy the files up to root public_html
# Change this if you want to install to a subfolder or whatever.
cp -r wordpress/* public_html/
# Post install clean up with a 'I don't know what you did!' error.
if [ -f $VERSION.zip ]
then
rm -rf wordpress/
rm $VERSION.zip
echo "SUCCESS! You're on WordPress $1."
else
echo "POSSIBLE FAILURE. Could not clean up the files, so there's a chance everything went pear shaped."
echo "Please review your WordPress install and remember: Blame Nacin."
fi
exit
The fix to ‘Oh shit, I installed WordPress 2.1 instead of 3.1!’ is to re-run it correctly, by the way. So long as you haven’t logged in to your site, you won’t update the database, so a backout is always a re-run, even in the real world.
