Skip to content

Instantly share code, notes, and snippets.

@pjbriggs
Created August 27, 2015 12:55
Show Gist options
  • Save pjbriggs/3689a4b1112644673363 to your computer and use it in GitHub Desktop.
Save pjbriggs/3689a4b1112644673363 to your computer and use it in GitHub Desktop.
Script to move config (.ini and .xml) files from "legacy" Galaxy dist into 'config' dir
#!/bin/bash -e
#
# Migrate "legacy" config files in Galaxy distribution
#
# Check nothing is running
if [ ! -z "$(ls *.pid 2>/dev/null)" ] ; then
echo ERROR check you have stopped all Galaxy processes >&2
exit 1
fi
#
function update_config() {
local legacy_conf_file=$1
echo "==== $legacy_conf_file ===="
if [ ! -z "$2" ] ; then
local config_conf_file=config/$2
else
local config_conf_file=config/$legacy_conf_file
fi
if [ -f $config_conf_file ] ; then
echo "- moving existing $config_conf_file out of the way"
/bin/mv $config_conf_file ${config_conf_file}.migration.bak
fi
echo "- copying $legacy_conf_file to $config_conf_file"
/bin/cp -a $legacy_conf_file $config_conf_file
echo "- moving $legacy_conf_file to ${legacy_conf_file}.migration.bak"
/bin/mv $legacy_conf_file ${legacy_conf_file}.migration.bak
}
#
# Core configuration files
if [ -f universe_wsgi.ini ] ; then
update_config universe_wsgi.ini galaxy.ini
fi
if [ -f reports_wsgi.ini ] ; then
update_config reports_wsgi.ini
fi
if [ -f tool_shed_wsgi.ini ] ; then
update_config tool_shed_wsgi.ini tool_shed.ini
fi
# XML config files
for f in $(ls *.xml 2>/dev/null) ; do
update_config $f
done
##
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment