Fix the algorithm-updater script behaviour when the file that contains the installed algorithms does not exist.

This commit is contained in:
Andrea Dell'Amico 2019-02-06 17:17:09 +01:00
parent dd6442e8dd
commit 810c5c09ac
1 changed files with 11 additions and 9 deletions

View File

@ -208,18 +208,20 @@ update_svn_repo() {
create_log_dir create_log_dir
check_lock_file check_lock_file
update_svn_repo update_svn_repo
SVN_ALGORITHMS_NUM=$( wc -l "$ALGORITHMS_FILE" | awk '{print $1}' )
INSTALLED_ALGORITHMS_NUM=$( wc -l "$ALGORITHMS_INSTALLED_FILE" | awk '{print $1}' )
if [ $SVN_UPDATE_STATUS -ne 0 ] ; then if [ $SVN_UPDATE_STATUS -ne 0 ] ; then
if [ -d "${LOG_DIR}" ] ; then if [ -d "${LOG_DIR}" ] ; then
if [ ! -f "$ALGORITHMS_INSTALLED_FILE" ] || [ ! -s "$ALGORITHMS_INSTALLED_FILE" ] ; then if [ -f "$ALGORITHMS_INSTALLED_FILE" ] ; then
logger "algorithms-updater: nothing new to from SVN but the file that lists the installed algorithms does not exist or is empty. We are going to reinstall all the algorithms." SVN_ALGORITHMS_NUM=$( wc -l "$ALGORITHMS_FILE" | awk '{print $1}' )
elif [ $SVN_ALGORITHMS_NUM -gt $INSTALLED_ALGORITHMS_NUM ] ; then INSTALLED_ALGORITHMS_NUM=$( wc -l "$ALGORITHMS_INSTALLED_FILE" | awk '{print $1}' )
logger "algorithms-updater: nothing new to from SVN but the installed algorithms are less than the expected number. We are going to run the installer." if [ $SVN_ALGORITHMS_NUM -gt $INSTALLED_ALGORITHMS_NUM ] ; then
logger "algorithms-updater: nothing new from SVN but the installed algorithms are less than the expected number. We are going to run the installer."
else else
logger "algorithms-updater: nothing new to from SVN and all the algorithms are installed, exiting." logger "algorithms-updater: nothing new from SVN and all the algorithms are installed, exiting."
cleanup 0 cleanup 0
fi fi
else
logger "algorithms-updater: nothing new from SVN but the file that lists the installed algorithms does not exist. We are going to reinstall all the algorithms."
fi
fi fi
fi fi
sort_installed_algo_file sort_installed_algo_file