Update mm-scripts.sh
This commit is contained in:
@@ -827,13 +827,14 @@ VPNSPEEDTEST(){
|
||||
}
|
||||
|
||||
UPDATESERVICE(){
|
||||
if [ "${1}" == "all" ]; then
|
||||
if [ "${1}" == "service" ]; then
|
||||
if [ "${2}" == "all" ]; then
|
||||
for usrvc in "${UPDATE_SERVICES[@]}"; do
|
||||
[ "${MM_UPDATE_REPO[${usrvc}]}" != "" ] && UPDATESERVICE ${usrvc} ${2}
|
||||
[ "${MM_UPDATE_REPO[${usrvc}]}" != "" ] && UPDATESERVICE service ${usrvc} ${3}
|
||||
done
|
||||
|
||||
elif [ "${1}" != "" ]; then
|
||||
usrvc=${1}
|
||||
elif [ "${2}" != "" ]; then
|
||||
usrvc=${2}
|
||||
echo "${usrvc} Update" > ${TMPFOLDER}/mm.update.stop
|
||||
echo "$(date) - Updating Service (${usrvc}) : Starting" >> $logfile
|
||||
echo
|
||||
@@ -844,8 +845,8 @@ UPDATESERVICE(){
|
||||
echo -en "${idsCL[White]}${msg}${spc} : ${idsCL[Default]}"
|
||||
|
||||
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
|
||||
[ "${2}" == "-f" ] && echo -e "${idsCL[LightCyan]}Update Not Needed, forcing anyway${idsCL[Default]}" || echo -e "${idsCL[Green]}Update Available${idsCL[Default]}"
|
||||
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
|
||||
[ "${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
|
||||
echo -en "${idsCL[White]}${msg}${spc} : ${idsCL[Default]}"
|
||||
/usr/bin/git stash >/dev/null 2>&1
|
||||
@@ -882,8 +883,8 @@ UPDATESERVICE(){
|
||||
latest_ver=`echo ${latest_release_url} | cut -d/ -f8`
|
||||
cver=${usrvc}_VER
|
||||
|
||||
if [ "${!cver}" != "${latest_ver}" ] || [ "${2}" == "-f" ]; then
|
||||
[ "${2}" == "-f" ] && echo -e "${idsCL[LightCyan]}Update Not Needed, forcing anyway${idsCL[Default]}" || echo -e "${idsCL[Green]}Update Available${idsCL[Default]}"
|
||||
if [ "${!cver}" != "${latest_ver}" ] || [ "${3}" == "-f" ]; then
|
||||
[ "${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}
|
||||
touch ${MMFOLDER}/logs/update.${usrvc}
|
||||
|
||||
@@ -966,6 +967,11 @@ UPDATESERVICE(){
|
||||
fi
|
||||
rm -f ${TMPFOLDER}/mm.update.stop
|
||||
|
||||
elif [ "${1}" == "list" ]; then
|
||||
SHOWSRVCUPDATES
|
||||
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
SERVICEBACKUP(){
|
||||
@@ -1348,7 +1354,7 @@ MMSETUP(){
|
||||
read -n 1 choice
|
||||
case "$choice" in
|
||||
[Yy]) for usrvc in "${UPDATE_SERVICES[@]}"; do
|
||||
[ "${MM_UPDATE_REPO[${usrvc}]}" != "" ] && UPDATESERVICE ${usrvc}
|
||||
[ "${MM_UPDATE_REPO[${usrvc}]}" != "" ] && UPDATESERVICE service ${usrvc}
|
||||
done;;
|
||||
* ) tmp='';;
|
||||
esac
|
||||
@@ -1482,7 +1488,7 @@ if [ ! -f ${TMPFOLDER}/mm.update.stop ]; then
|
||||
MMSTATUS ${2}
|
||||
;;
|
||||
|
||||
update);;
|
||||
update) UPDATESERVICE ${2} ${3};;
|
||||
update-list) SHOWSRVCUPDATES;;
|
||||
update-service) UPDATESERVICE ${2} ${3};;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user