Linux installer (issue #300): Install/Uninstall scripts updated

to handle the case where another systemwide installation is deployed to a different directory than the one that we are trying to install/uninstall.
master
KonstantinosSykas 2018-07-10 18:24:08 +03:00
parent 2de1aea173
commit 6174e69955
2 changed files with 31 additions and 4 deletions

View File

@ -114,11 +114,21 @@ SELF_FILENAME=$(basename $0)
# if there is an Oolite installation in any
# user home directory.
# Uninstall if possible the system-wide installation
${INSTALL_ROOT_SYSTEMWIDE}/${OOLITE_ROOT_NAME}/uninstall 2> /dev/null
if [ $? -eq ${ERROR_CODE_UNINSTALL_FAILED} ]
# Uninstall, if possible, the current active system-wide installation
if [ ${USER_IS_ROOT} ]
then
exit ${ERROR_CODE_UNINSTALL_FAILED}
OOLITE_SHORTCUT=${STARTUP_SCRIPTS_PATH}/oolite${TRUNK}
if [ -e ${OOLITE_SHORTCUT} ]
then
INSTALL_ROOT_SYSTEMWIDE_ACTIVE=`cat ${OOLITE_SHORTCUT} | head -2 | tail -1`
INSTALL_ROOT_SYSTEMWIDE_ACTIVE=${INSTALL_ROOT_SYSTEMWIDE_ACTIVE%%/Oolite*}
${INSTALL_ROOT_SYSTEMWIDE_ACTIVE}/${OOLITE_ROOT_NAME}/uninstall 2> /dev/null
if [ $? -eq ${ERROR_CODE_UNINSTALL_FAILED} ]
then
exit ${ERROR_CODE_UNINSTALL_FAILED}
fi
fi
fi
# Uninstall user's instalation

View File

@ -74,6 +74,23 @@ else
fi
fi
# Check if this is not the active Oolite systemwide installation
if [ ${USER_IS_ROOT} ]
then
OOLITE_SHORTCUT=${STARTUP_SCRIPTS_PATH}/oolite${TRUNK}
if [ -e ${OOLITE_SHORTCUT} ]
then
INSTALL_ROOT_SYSTEMWIDE_ACTIVE=`cat ${OOLITE_SHORTCUT} | head -2 | tail -1`
INSTALL_ROOT_SYSTEMWIDE_ACTIVE=${INSTALL_ROOT_SYSTEMWIDE_ACTIVE%%/Oolite*}
if [ "${INSTALL_ROOT_SYSTEMWIDE}" != "${INSTALL_ROOT_SYSTEMWIDE_ACTIVE}" ]
then
echo
echo "Error: The Oolite${TRUNK} startup scripts indicate another systemwide installation is active. Automatic uninstall will now exit to avoid impairing the active installation."
exit ${ERROR_CODE_UNINSTALL_FAILED}
fi
fi
fi
# Remove Oolite