Update mm-scripts.sh

This commit is contained in:
2023-04-23 22:33:49 -05:00
parent 9d1accb747
commit fa12f7f72f

View File

@@ -807,11 +807,11 @@ UPDATESERVICE(){
echo -en "${idsCL[White]}${msg}${spc} : ${idsCL[Default]}"
if [[ $BETA_SERVICES == *${usrvc}* ]]; then
# latest_release_url=`curl -s https://api.github.com/repos/${MM_UPDATE_REPO[${usrvc}]}/${usrvc}/releases | jq -r '.[0].assets[].browser_download_url' | grep "${MM_UPDATE_REPO_GREP[${usrvc}]}" | cut -d '"' -f 4 | grep -i 'https://'`
latest_release_url=`curl -s https://api.github.com/repos/${MM_UPDATE_REPO[${usrvc}]}/${usrvc}/releases | jq -r '.[0].assets[].browser_download_url' | grep "${MM_UPDATE_REPO_GREP[${usrvc}]}" | cut -d '"' -f 4 | grep -i 'https://'`
echo "$(date) - Updating Service (${usrvc}) : BETA UPDATEURL = ${latest_release_url}" >> $logfile
beta="BETA "
else
# latest_release_url=`curl -s https://api.github.com/repos/${MM_UPDATE_REPO[${usrvc}]}/${usrvc}/releases/latest | jq -r '.assets[].browser_download_url' | grep "${MM_UPDATE_REPO_GREP[${usrvc}]}" | cut -d '"' -f 4 | grep -i 'https://'`
latest_release_url=`curl -s https://api.github.com/repos/${MM_UPDATE_REPO[${usrvc}]}/${usrvc}/releases/latest | jq -r '.assets[].browser_download_url' | grep "${MM_UPDATE_REPO_GREP[${usrvc}]}" | cut -d '"' -f 4 | grep -i 'https://'`
echo "$(date) - Updating Service (${usrvc}) : UPDATEURL = ${latest_release_url}" >> $logfile
beta=""
fi
@@ -828,26 +828,26 @@ UPDATESERVICE(){
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
echo -en "${idsCL[White]}${msg}${spc} : ${idsCL[Default]}"
# if curl --output /dev/null --silent --head --fail $latest_release_url; then
# wget -qO ${tmpfile} $latest_release_url >> ${MMFOLDER}/logs/update.${usrvc}
# if [[ ( $? -eq 0 ) && ( -f ${tmpfile} ) ]]; then
# if [ "${usrvc}" != "bazarr" ]; then
# rm -Rf /opt/${usrvc^} >> ${MMFOLDER}/logs/update.${usrvc}
# mkdir /opt/${usrvc^} >> ${MMFOLDER}/logs/update.${usrvc}
# fi
# /bin/tar -cpPf $bak /opt/${usrvc^} >> ${MMFOLDER}/logs/update.${usrvc}
# [ "${MM_SERVICE_CFG[${usrvc}]}" != "" ] && [ -d ${MM_SERVICE_CFG[${usrvc}]} ] && /bin/tar -cpPf $bakcfg ${MM_SERVICE_CFG[${usrvc}]} >> ${MMFOLDER}/logs/update.${usrvc}
#
# if [ "${usrvc}" == "ombi" ]; then
# /bin/tar xfP ${tmpfile} -C /opt/${usrvc^} >> ${MMFOLDER}/logs/update.${usrvc}
# elif [ "${usrvc}" == "bazarr" ]; then
# /usr/bin/unzip -oqq ${tmpfile} -d /opt/${usrvc^}
# else
# /bin/tar xfP ${tmpfile} -C /opt >> ${MMFOLDER}/logs/update.${usrvc}
# fi
# chown -R user:users /opt/${usrvc^} >> ${MMFOLDER}/logs/update.${usrvc}
# fi
# fi
if curl --output /dev/null --silent --head --fail $latest_release_url; then
wget -qO ${tmpfile} $latest_release_url >> ${MMFOLDER}/logs/update.${usrvc}
if [[ ( $? -eq 0 ) && ( -f ${tmpfile} ) ]]; then
if [ "${usrvc}" != "bazarr" ]; then
rm -Rf /opt/${usrvc^} >> ${MMFOLDER}/logs/update.${usrvc}
mkdir /opt/${usrvc^} >> ${MMFOLDER}/logs/update.${usrvc}
fi
/bin/tar -cpPf $bak /opt/${usrvc^} >> ${MMFOLDER}/logs/update.${usrvc}
[ "${MM_SERVICE_CFG[${usrvc}]}" != "" ] && [ -d ${MM_SERVICE_CFG[${usrvc}]} ] && /bin/tar -cpPf $bakcfg ${MM_SERVICE_CFG[${usrvc}]} >> ${MMFOLDER}/logs/update.${usrvc}
if [ "${usrvc}" == "ombi" ]; then
/bin/tar xfP ${tmpfile} -C /opt/${usrvc^} >> ${MMFOLDER}/logs/update.${usrvc}
elif [ "${usrvc}" == "bazarr" ]; then
/usr/bin/unzip -oqq ${tmpfile} -d /opt/${usrvc^}
else
/bin/tar xfP ${tmpfile} -C /opt >> ${MMFOLDER}/logs/update.${usrvc}
fi
chown -R user:users /opt/${usrvc^} >> ${MMFOLDER}/logs/update.${usrvc}
fi
fi
rm -f ${tmpfile} &>/dev/null
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
@@ -866,8 +866,8 @@ UPDATESERVICE(){
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
/usr/bin/apt install ${usrvc} >/dev/null 2>&1
/bin/systemctl disable ${usrvc} >/dev/null 2>&1
echo -e "${idsCL[Green]}Done${idsCL[Default]}"