Update mm-scripts.sh

This commit is contained in:
2023-04-29 20:17:27 -05:00
parent 69165b4f60
commit 365cb6d20b

View File

@@ -861,7 +861,7 @@ UPDATESERVICE(){
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}" ]; then
if [ "${!cver}" != "${installed_ver}" ] || [ "${2}" == "force" ]; then
tmpfile=/tmp/${usrvc}-update.tar.gz
bak=/opt/Backups/${usrvc}.opt.tgz
bakcfg=/opt/Backups/${usrvc}.cfg.tgz
@@ -885,26 +885,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]}"
@@ -935,11 +935,11 @@ UPDATESERVICE(){
fi
elif [ "${MM_UPDATE_REPO[${usrvc}]}" == "systemd" ]; then
if [ "$(apt-get -s upgrade | grep ${usrvc})" != "" ]; then
if [ "$(apt-get -s upgrade | grep ${usrvc})" != "" ] || [ "${2}" == "force" ]; then
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
/usr/bin/apt install ${usrvc} >/dev/null 2>&1
/bin/systemctl disable ${usrvc} >/dev/null 2>&1
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
@@ -1406,7 +1406,7 @@ if [ ! -f ${MMFOLDER}/mm.update.stop ]; then
update-allservices)
# for usrvc in "${SERVICES_CHECK[@]}"; do
for usrvc in "${UPDATE_SERVICES[@]}"; do
[ "${MM_UPDATE_REPO[${usrvc}]}" != "" ] && UPDATESERVICE ${usrvc}
[ "${MM_UPDATE_REPO[${usrvc}]}" != "" ] && UPDATESERVICE ${usrvc} ${2}
done
;;
update-list) SHOWSRVCUPDATES;;