Skip to content

Instantly share code, notes, and snippets.

@flohei
Created September 18, 2012 14:06
Show Gist options
  • Save flohei/3743327 to your computer and use it in GitHub Desktop.
Save flohei/3743327 to your computer and use it in GitHub Desktop.
Upgrading Redmine, quick and dirty: To use it append the download path for the Redmine zip file and the name of the current version (e.g. redmine-2.0.3) as parameters. You will probably need to adjust the BASE_PATH to reflect the path to the directory whe
#!/bin/sh
# rootof.net
# Florian Heiber [email protected]
# 2012-07-30
if [ -z "$1" ] || [ -z "$2" ]
then
echo "Two parameters are needed"
exit
fi
BASE_PATH="/usr/local/lib/"
DOWNLOAD=$1
PREVIOUS_VERSION=$2
ZIP_FILE=$(basename "$DOWNLOAD")
NEXT_VERSION=${ZIP_FILE%.*}
prev_version_path=$BASE_PATH$PREVIOUS_VERSION
next_version_path=$BASE_PATH$NEXT_VERSION
# check if the version to update exists
if [ -d $prev_version_path ]; then
echo "Version to update exists"
else
echo "Version to update does not exists"
exit
fi
# download redmine (the zip version)
wget $DOWNLOAD
# unzip the downloaded file
unzip $BASE_PATH$ZIP_FILE
# remove the downloaded file
rm $BASE_PATH$ZIP_FILE
# copy the files, configuration.yml and database.yml
cp -r $prev_version_path/files/* $next_version_path/files/
cp $prev_version_path/config/configuration.yml $next_version_path/config/configuration.yml
cp $prev_version_path/config/database.yml $next_version_path/config/database.yml
# copy the theme
mkdir $next_version_path/public/themes/a1
cp -r $prev_version_path/public/themes/a1/* $next_version_path/public/themes/a1/
# cd to new version
cd $next_version_path
# generate session token
rake generate_secret_token
# adjust permissions
sudo chown -R www-data:www-data files log tmp public/plugin_assets
sudo chmod -R 755 files log tmp public/plugin_assets
# change the link to point to the new version
rm ${BASE_PATH}redmine
ln -s $next_version_path/ ${BASE_PATH}redmine
echo "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment