eclipse/eclipse-reconciler.sh

58 lines
1.4 KiB
Bash
Raw Normal View History

2011-09-23 14:56:22 +00:00
#!/bin/bash
# This script runs the eclipse can do the following:
# - backup configuration files
# - restore configuration files from backup loation
# - run the eclipse reconciler
# - delete the backup files.
# A list of the files of directory that are to be backed up
config_files=("artifacts.xml" "eclipse.ini" "p2" "configuration")
if [ $# -ge 2 ]
then
echo "backing up configuration files"
for file in ${config_files[@]}
do
echo $file
cp -r $1/$file $2/$file
done
echo "Running eclipse reconciler"
pushd $1
./eclipse --launcher.suppressErrors -nosplash -consolelog -application org.eclipse.equinox.p2.reconciler.application ${@:3}
exit_value=$?
# Check exit value
if [ ! $exit_value -eq 0 ]
then
# Restore files
echo "Reconciler failed. Restoring files"
for file in ${config_files[@]}
do
echo $file
cp --remove-destination -Tr $2/$file $1/$file
done
fi
popd
#delete the backup files
for file in ${config_files[@]}
do
rm -rf $2/$file
done
exit $exit_value
fi
echo "Invalid options"
echo ""
echo "Usage:"
echo ""
echo " eclipse-reconciler <eclipse dir> <backup location> [reconciler parameters]"
echo " Backsup configuration files in the given location, run the reconciler"
echo " and restore the files if there is a problem at the end delete backup files."
echo " Any parameters given after the first two are passed directly to the reconciler"
exit 1;