Update mm-scripts.sh

This commit is contained in:
2023-05-18 21:51:01 -05:00
parent dfad92b0be
commit 22f48828a0

View File

@@ -827,13 +827,14 @@ VPNSPEEDTEST(){
} }
UPDATESERVICE(){ UPDATESERVICE(){
if [ "${1}" == "all" ]; then if [ "${1}" == "service" ]; then
if [ "${2}" == "all" ]; then
for usrvc in "${UPDATE_SERVICES[@]}"; do for usrvc in "${UPDATE_SERVICES[@]}"; do
[ "${MM_UPDATE_REPO[${usrvc}]}" != "" ] && UPDATESERVICE ${usrvc} ${2} [ "${MM_UPDATE_REPO[${usrvc}]}" != "" ] && UPDATESERVICE service ${usrvc} ${3}
done done
elif [ "${1}" != "" ]; then elif [ "${2}" != "" ]; then
usrvc=${1} usrvc=${2}
echo "${usrvc} Update" > ${TMPFOLDER}/mm.update.stop echo "${usrvc} Update" > ${TMPFOLDER}/mm.update.stop
echo "$(date) - Updating Service (${usrvc}) : Starting" >> $logfile echo "$(date) - Updating Service (${usrvc}) : Starting" >> $logfile
echo echo
@@ -844,8 +845,8 @@ UPDATESERVICE(){
echo -en "${idsCL[White]}${msg}${spc} : ${idsCL[Default]}" echo -en "${idsCL[White]}${msg}${spc} : ${idsCL[Default]}"
cd /var/www/media.scity.us/html >/dev/null 2>&1 cd /var/www/media.scity.us/html >/dev/null 2>&1
if [ "`git log --pretty=%H ...refs/heads/v2-master^ | head -n 1`" != "`git ls-remote origin -h refs/heads/v2-master |cut -f1`" ] || [ "${2}" == "-f" ]; then if [ "`git log --pretty=%H ...refs/heads/v2-master^ | head -n 1`" != "`git ls-remote origin -h refs/heads/v2-master |cut -f1`" ] || [ "${3}" == "-f" ]; then
[ "${2}" == "-f" ] && echo -e "${idsCL[LightCyan]}Update Not Needed, forcing anyway${idsCL[Default]}" || echo -e "${idsCL[Green]}Update Available${idsCL[Default]}" [ "${3}" == "-f" ] && echo -e "${idsCL[LightCyan]}Update Not Needed, forcing anyway${idsCL[Default]}" || echo -e "${idsCL[Green]}Update Available${idsCL[Default]}"
msg="Updating service"; c=0; spc=''; spc1=$((${cw_spc}-${#msg})); until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done 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]}" echo -en "${idsCL[White]}${msg}${spc} : ${idsCL[Default]}"
/usr/bin/git stash >/dev/null 2>&1 /usr/bin/git stash >/dev/null 2>&1
@@ -882,8 +883,8 @@ UPDATESERVICE(){
latest_ver=`echo ${latest_release_url} | cut -d/ -f8` latest_ver=`echo ${latest_release_url} | cut -d/ -f8`
cver=${usrvc}_VER cver=${usrvc}_VER
if [ "${!cver}" != "${latest_ver}" ] || [ "${2}" == "-f" ]; then if [ "${!cver}" != "${latest_ver}" ] || [ "${3}" == "-f" ]; then
[ "${2}" == "-f" ] && echo -e "${idsCL[LightCyan]}Update Not Needed, forcing anyway${idsCL[Default]}" || echo -e "${idsCL[Green]}Update Available${idsCL[Default]}" [ "${3}" == "-f" ] && echo -e "${idsCL[LightCyan]}Update Not Needed, forcing anyway${idsCL[Default]}" || echo -e "${idsCL[Green]}Update Available${idsCL[Default]}"
# rm -f ${MMFOLDER}/logs/update.${usrvc} # rm -f ${MMFOLDER}/logs/update.${usrvc}
touch ${MMFOLDER}/logs/update.${usrvc} touch ${MMFOLDER}/logs/update.${usrvc}
@@ -966,6 +967,11 @@ UPDATESERVICE(){
fi fi
rm -f ${TMPFOLDER}/mm.update.stop rm -f ${TMPFOLDER}/mm.update.stop
elif [ "${1}" == "list" ]; then
SHOWSRVCUPDATES
fi
} }
SERVICEBACKUP(){ SERVICEBACKUP(){
@@ -1348,7 +1354,7 @@ MMSETUP(){
read -n 1 choice read -n 1 choice
case "$choice" in case "$choice" in
[Yy]) for usrvc in "${UPDATE_SERVICES[@]}"; do [Yy]) for usrvc in "${UPDATE_SERVICES[@]}"; do
[ "${MM_UPDATE_REPO[${usrvc}]}" != "" ] && UPDATESERVICE ${usrvc} [ "${MM_UPDATE_REPO[${usrvc}]}" != "" ] && UPDATESERVICE service ${usrvc}
done;; done;;
* ) tmp='';; * ) tmp='';;
esac esac
@@ -1482,7 +1488,7 @@ if [ ! -f ${TMPFOLDER}/mm.update.stop ]; then
MMSTATUS ${2} MMSTATUS ${2}
;; ;;
update);; update) UPDATESERVICE ${2} ${3};;
update-list) SHOWSRVCUPDATES;; update-list) SHOWSRVCUPDATES;;
update-service) UPDATESERVICE ${2} ${3};; update-service) UPDATESERVICE ${2} ${3};;