#!/bin/bash # Make sure we're running through sudo export me=`whoami` if [ "$me" != 'root' ]; then echo "I don't like $me very much. Please run me via sudo."; exit -1; fi #Make sure we've passed in a version if [ "$1" == '' ]; then echo "If you don't tell me what to do, then I can't do it. Please provide a WPMU version number."; exit -2; else echo "We'll be working with WPMU $1 today..."; fi # And make sure that the necessary WP download exists if [ -a ./wordpress-mu-$1.zip ]; then echo "... and I see that you were smart enough to download it."; else echo "... and it is nowhere to be seen! I cannot work under these conditions!"; exit -3; fi # Save some paths for reference export wpmu_base='/path/to/WPMU' export const="$wpmu_base/const" export latest="$wpmu_base/wordpress-mu-$1" # Expand latest WPMU version, version passed as command argument (eg $1) unzip ./wordpress-mu-$1.zip -d $wpmu_base/ # Remove WPMU archive rm ./wordpress-mu-$1.zip # Link wp-config file ln -fhs $const/wp-config.php $latest/wp-config.php # Link .htaccess file ln -fhs $const/.htaccess $latest/.htaccess # Link mu-plugins directory rm -R $latest/wp-content/mu-plugins ln -fhs $const/wp-content/mu-plugins $latest/wp-content/mu-plugins # Link plugins directory rm -R $latest/wp-content/plugins ln -fhs $const/wp-content/plugins $latest/wp-content/plugins # Link blogs.dir directory ln -fhs $const/wp-content/blogs.dir $latest/wp-content/blogs.dir # Link sunrise file ln -fhs $const/wp-content/sunrise.php $latest/wp-content/sunrise.php # Link each theme in themes folder for theme in `ls -d $const/wp-content/themes/*`; do echo "*** Copying theme from $theme" ln -fhs $theme $latest/wp-content/themes/ done # Link WPMU version to current folder ln -fhs $latest/ $wpmu_base/current