67ffc326a6
- Change eclipse-reconciler script to run with no arguments. - Use initscripts to create run directory. - Run reconciler only once per install transaction.
72 lines
1.7 KiB
Bash
Executable File
72 lines
1.7 KiB
Bash
Executable File
#!/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 [ ! -e /var/run/eclipse/run-reconciler ]
|
|
then
|
|
echo "run-reconciler file not present. No need to run the reconciler"
|
|
exit 0
|
|
fi
|
|
|
|
tmp_dir=/var/run/eclipse
|
|
|
|
if [ -e /usr/lib64/eclipse ]
|
|
then
|
|
eclipse_dir=/usr/lib64/eclipse
|
|
else
|
|
eclipse_dir=/usr/lib/eclipse
|
|
fi
|
|
|
|
echo "Removing run-reconciler file"
|
|
rm -f /var/run/eclipse/run-reconciler
|
|
|
|
echo "backing up configuration files"
|
|
for file in ${config_files[@]}
|
|
do
|
|
echo $file
|
|
cp -rp $eclipse_dir/$file $tmp_dir/$file
|
|
done
|
|
|
|
echo "Running eclipse reconciler"
|
|
pushd $eclipse_dir
|
|
./eclipse --launcher.suppressErrors -nosplash -consolelog -application org.eclipse.equinox.p2.reconciler.application "$@"
|
|
r_exit_value=$?
|
|
|
|
# If the reconciler was run with the -clean options rerun the initializer.
|
|
if [[ "$@" == *-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
|
|
|
|
# Check exit value
|
|
if [ ! $i_exit_value -eq 0 ] || [ ! $r_exit_value -eq 0 ]
|
|
then
|
|
# Restore files
|
|
echo "Reconciler failed. Restoring files"
|
|
for file in ${config_files[@]}
|
|
do
|
|
echo $file
|
|
cp --remove-destination -Trp $tmp_dir/$file $eclipse_dir/$file
|
|
done
|
|
fi
|
|
popd
|
|
|
|
# delete the backup files
|
|
for file in ${config_files[@]}
|
|
do
|
|
rm -rf $tmp_dir/$file
|
|
done
|
|
|
|
exit $r_exit_value
|