From b2e43f290d4d862272851048483b563eeb5733fd Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 2 May 2023 18:35:19 -0500 Subject: [PATCH] update --- defaults.inc | 2 +- mm-scripts.sh | 24 +++++++----------------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/defaults.inc b/defaults.inc index 12d1ca3..2d1fac6 100755 --- a/defaults.inc +++ b/defaults.inc @@ -1,6 +1,6 @@ #!/usr/bin/env bash -VERS='3.8.200-04292023' +VERS='3.8.206-04292023' MMFOLDER="/opt/idssys/mediamanager" MMSRV=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) diff --git a/mm-scripts.sh b/mm-scripts.sh index 668c751..5af0ae7 100755 --- a/mm-scripts.sh +++ b/mm-scripts.sh @@ -859,9 +859,7 @@ UPDATESERVICE(){ if [[ " ${UPDATE_SERVICES[*]} " =~ " ${usrvc} " ]]; then if [ "${MM_UPDATE_REPO[${usrvc}]}" != "" ] && [ "${MM_UPDATE_REPO[${usrvc}]}" != "systemd" ]; then - msg="Finding latest update url" - c=0; spc=''; spc1=$((${cw_spc}-${#msg})) - until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done + msg="Checking for update"; c=0; spc=''; spc1=$((${cw_spc}-${#msg})); until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done echo -en "${idsCL[White]}${msg}${spc} : ${idsCL[Default]}" if [[ $BETA_SERVICES == *${usrvc}* ]]; then @@ -873,18 +871,11 @@ UPDATESERVICE(){ echo "$(date) - Updating Service (${usrvc}) : UPDATEURL = ${latest_release_url}" >> $logfile beta="" fi - installed_ver=`echo ${latest_release_url} | cut -d/ -f8` - echo -e "${idsCL[Green]}Done${idsCL[Default]}" - - msg="Latest Version"; c=0; spc=''; spc1=$((${cw_spc}-${#msg})); until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done - echo -e "${idsCL[White]}${msg}${spc} : ${idsCL[Green]}${installed_ver}${idsCL[Default]}" - + latest_ver=`echo ${latest_release_url} | cut -d/ -f8` cver=${usrvc}_VER - msg="Current Version"; c=0; spc=''; spc1=$((${cw_spc}-${#msg})); until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done - echo -e "${idsCL[White]}${msg}${spc} : ${idsCL[Green]}${!cver}${idsCL[Default]}" - - if [ "${!cver}" != "${installed_ver}" ] || [ "${2}" == "force" ]; then - echo -e "${idsCL[LightCyan]} Update Not Needed, but force option was chosen${idsCL[Default]}" + + if [ "${!cver}" != "${latest_ver}" ] || [ "${2}" == "force" ]; then + [ "${2}" == "force" ] && echo -e "${idsCL[LightCyan]} Update Not Needed, but forcing anyway${idsCL[Default]}" || echo -e "${idsCL[Green]}Done${idsCL[Default]}" tmpfile=/tmp/${usrvc}-update.tar.gz bak=/opt/Backups/${usrvc}.opt.tgz @@ -935,7 +926,7 @@ UPDATESERVICE(){ [ ! -f ${MMFOLDER}/vers.info ] && touch ${MMFOLDER}/vers.info /bin/sed -i /${usrvc}/d ${MMFOLDER}/vers.info - echo "${usrvc}_VER=\"${installed_ver}\"" >> ${MMFOLDER}/vers.info + echo "${usrvc}_VER=\"${latest_ver}\"" >> ${MMFOLDER}/vers.info msg="Starting service back up"; c=0; spc=''; spc1=$((${cw_spc}-${#msg})); until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done echo -en "${idsCL[White]}${msg}${spc} : ${idsCL[Default]}" @@ -954,7 +945,7 @@ UPDATESERVICE(){ echo -e "${idsCL[Green]}${usrvc^} Service has been updated${idsCL[Default]}" else - echo -e "${idsCL[LightCyan]} Update Not Needed ${idsCL[Default]}" + echo -e "${idsCL[LightCyan]}Update Not Needed${idsCL[Default]}" echo "$(date) - Updating Service (${usrvc}) : Update Not Needed" >> $logfile fi @@ -966,7 +957,6 @@ UPDATESERVICE(){ echo -e "${idsCL[Green]}Done${idsCL[Default]}" msg="Updating service"; c=0; spc=''; spc1=$((${cw_spc}-${#msg})); until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done echo -en "${idsCL[White]}${msg}${spc} : ${idsCL[Default]}" - installed_ver=`dpkg -s ${usrvc} | grep Version` /usr/bin/apt install ${usrvc} >/dev/null 2>&1 /bin/systemctl disable ${usrvc} >/dev/null 2>&1 echo -e "${idsCL[Green]}Done${idsCL[Default]}"