Nightly Automation

Because I am lazy and because I like testing new features and because this blog has few visitors I am now running on the current nightly build and I made a script that updates to the latest nightly build in about 10 seconds. Take care: I tested it and it works for me, but neither can I guarantee this is not breaking anything nor can the wordpress people guarantee what happens to your blog when you are running on alpha version …. which reminds me to get myself a backup of the blog along with each update 😉

Here is the script.

#!/bin/sh
export BLOG_URL=http://daily.delusions.de
export CHANGE_TAG="sonja added"
export BACKUP=backup
export RESOURCES=resources
export FRESH=wordpress
export PROD=documents

echo "--------------------------------------------"
echo "Preparing install fresh wordpress nightly build"
rm -r $BACKUP

export TODAY=`date +%Y-%m-%d`
export NIGHTLY=wordpress-$TODAY.tar.gz
echo "Fetching latest Nightly Build: $NIGHTLY"
wget http://wordpress.org/nightly/$NIGHTLY >&/dev/null

echo "Unpacking $NIGHTLY to $FRESH/"

tar xvfz $NIGHTLY > /dev/null

rm $NIGHTLY

echo "Linking image directory to $FRESH/"
ln -s $RESOURCES/images $FRESH/images

echo "Creating some directories"
mkdir $FRESH/wp-content/themes
mkdir $FRESH/wp-style

echo "Copying files to $FRESH"
cp -R $RESOURCES/wp-style/* $FRESH
cp -R $RESOURCES/wp-themes/* $FRESH/wp-content/themes
cp $RESOURCES/.htaccess $FRESH
cp $RESOURCES/wp-config.php $FRESH
cp $RESOURCES/wp-plugins/* $FRESH/wp-content/plugins

echo "Making backup and moving directories"
mv $PROD $BACKUP
mv $FRESH $PROD

export UPGRADE=upgrade.php
export UPGRADE_STEP1=upgrade.php?step=1

echo "Calling wordpress upgrade page"
wget $BLOG_URL/wp-admin/$UPGRADE >&/dev/null
html2text $UPGRADE
rm $UPGRADE
wget $BLOG_URL/wp-admin/$UPGRADE_STEP1 >&/dev/null
html2text $UPGRADE_STEP1
rm $UPGRADE_STEP1

echo "Please edit files and activate relevant plugins"
grep --recursive "$CHANGE_TAG" $BACKUP/*
echo "Done"
echo "--------------------------------------------"

update and I got myself this really nice theme (yes new feature of wordpress 1.3.x) by Michael Heilemann.. I hope there are more out there and I will soon make my own, but in the meantime you’re stuck with this.

One Reply to “Nightly Automation”

Comments are closed.