eclipse/eclipse-reconciler.sh

69 lines
1.9 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}
r_exit_value=$?
if [ $# -ge 3 ] && [ $3 == "-clean" ]
then
echo "Running the initializer"
./eclipse --launcher.suppressErrors -cosolelog -nosplash -application org.eclipse.equinox.initializer.configInitializer -fileInitializer extract_patterns.txt
i_exit_value=$?
else
i_exit_value=0
fi
2011-09-23 14:56:22 +00:00
# Check exit value
if [ ! $i_exit_value -eq 0 ] || [ ! $r_exit_value -eq 0 ]
2011-09-23 14:56:22 +00:00
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> [-clean] [reconciler parameters]"
2011-09-23 14:56:22 +00:00
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 " If the -clean option is specified -clean is passed to the reoconciler, and the"
echo " And the initializer is rerun after reconcilation. Any parameters given after"
echo " the first three are passed directly to the reconciler"
2011-09-23 14:56:22 +00:00
exit 1;