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")
|
|
|
|
|
2011-11-29 19:08:58 +00:00
|
|
|
# If the reconciler was run with the -clean options rerun the initializer.
|
|
|
|
if [[ "$@" == *-clean* ]]
|
|
|
|
then
|
|
|
|
echo "Do not run the reconciler with -clean option use -vmargs -Dosgi.checkConfiguration=true instead"
|
|
|
|
exit 0;
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -e /var/run/eclipse/run-reconciler ] && [[ "$@" != *-Dosgi.checkConfiguration=true* ]]
|
2011-09-23 14:56:22 +00:00
|
|
|
then
|
2011-10-14 13:32:19 +00:00
|
|
|
echo "run-reconciler file not present. No need to run the reconciler"
|
|
|
|
exit 0
|
|
|
|
fi
|
2011-09-23 14:56:22 +00:00
|
|
|
|
2011-10-14 13:32:19 +00:00
|
|
|
tmp_dir=/var/run/eclipse
|
2011-10-03 18:45:32 +00:00
|
|
|
|
2011-10-14 13:32:19 +00:00
|
|
|
if [ -e /usr/lib64/eclipse ]
|
|
|
|
then
|
|
|
|
eclipse_dir=/usr/lib64/eclipse
|
|
|
|
else
|
|
|
|
eclipse_dir=/usr/lib/eclipse
|
|
|
|
fi
|
2011-09-23 14:56:22 +00:00
|
|
|
|
2011-10-14 13:32:19 +00:00
|
|
|
echo "Removing run-reconciler file"
|
|
|
|
rm -f /var/run/eclipse/run-reconciler
|
|
|
|
|
2011-11-29 19:08:58 +00:00
|
|
|
# if we are running the reconciler with -Dosgi.checkConfiguration=true
|
|
|
|
# probably doing an upgrade remove time stamp file(s).
|
|
|
|
if [[ "$@" == *-Dosgi.checkConfiguration=true* ]]
|
|
|
|
then
|
|
|
|
find $eclipse_dir -name cache.timestamps -delete
|
|
|
|
find $eclipse_dir -name .bundledata* -delete
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
2011-10-14 13:32:19 +00:00
|
|
|
echo "backing up configuration files"
|
|
|
|
for file in ${config_files[@]}
|
|
|
|
do
|
|
|
|
echo $file
|
|
|
|
cp -rp $eclipse_dir/$file $tmp_dir/$file
|
|
|
|
done
|
2011-09-23 14:56:22 +00:00
|
|
|
|
2011-10-14 13:32:19 +00:00
|
|
|
echo "Running eclipse reconciler"
|
|
|
|
pushd $eclipse_dir
|
|
|
|
./eclipse --launcher.suppressErrors -nosplash -consolelog -application org.eclipse.equinox.p2.reconciler.application "$@"
|
|
|
|
r_exit_value=$?
|
|
|
|
|
2011-11-29 19:08:58 +00:00
|
|
|
# Check exit value
|
|
|
|
if [ ! $r_exit_value -eq 0 ]
|
2011-10-14 13:32:19 +00:00
|
|
|
then
|
|
|
|
# Restore files
|
|
|
|
echo "Reconciler failed. Restoring files"
|
|
|
|
for file in ${config_files[@]}
|
2011-09-23 14:56:22 +00:00
|
|
|
do
|
2011-10-14 13:32:19 +00:00
|
|
|
echo $file
|
|
|
|
cp --remove-destination -Trp $tmp_dir/$file $eclipse_dir/$file
|
2011-09-23 14:56:22 +00:00
|
|
|
done
|
|
|
|
fi
|
2011-10-14 13:32:19 +00:00
|
|
|
popd
|
2011-09-23 14:56:22 +00:00
|
|
|
|
2011-10-14 13:32:19 +00:00
|
|
|
# delete the backup files
|
|
|
|
for file in ${config_files[@]}
|
|
|
|
do
|
|
|
|
rm -rf $tmp_dir/$file
|
|
|
|
done
|
2011-09-23 14:56:22 +00:00
|
|
|
|
2011-10-14 13:32:19 +00:00
|
|
|
exit $r_exit_value
|