Update mm-scripts.sh

This commit is contained in:
2023-07-10 23:09:44 -05:00
parent 3b0e120b8e
commit f635286b4a

View File

@@ -1083,27 +1083,7 @@ WantedBy=multi-user.target
SERVICEBACKUP(){
usrvc=${1}
if [ "${usrvc}" == "" ] || [ "${usrvc}" == "true" ]; then
echo
echo -e "[${idsCL[LightCyan]} 0${idsCL[Default]}]${idsCL[White]} All Services${idsCL[Default]}"
b=1; declare -a bsrvcs
for bsrvc in "${UPDATE_SERVICES[@]}"; do
if [ "${MM_UPDATE_REPO[${bsrvc}]}" != "" ] && [[ " ${SERVICES_CHECK[*]} " =~ " ${bsrvc} " ]]; then
bsrvcs[${b}]=${bsrvc}
bsrvcd=`echo -n "${bsrvc:0:1}" | tr "[:lower:]" "[:upper:]"`; bsrvcd="${bsrvcd}${bsrvc:1}"
bsrvcd=${bsrvcd/Qbittorrent/qBittorent}; bsrvcd=${bsrvcd/3d/3D}
[ $b -lt 10 ] && db=" $b" || db=$b
echo -e "[${idsCL[LightCyan]}${db}${idsCL[Default]}]${idsCL[White]} ${bsrvcd}${idsCL[Default]}"
b=$((b+1))
fi
done
echo
echo -en "${idsCL[LightCyan]}Select a service to backup: ${idsCL[White]}"
read selsrvc
echo
[ ${selsrvc} -eq 0 ] && usrvc=all || usrvc=${bsrvcs[${selsrvc}]}
fi
[ "${usrvc}" == "list" ] && SERVICERESTORE . list
if [ "${usrvc}" == "all" ]; then
for uasrvc in "${UPDATE_SERVICES[@]}"; do
@@ -1187,7 +1167,7 @@ SERVICEBACKUPSTART(){
SERVICERESTORE(){
srvc=${1}
if [ "${srvc}" == "" ]; then
if [ "${srvc}" == "" ] || [ "${2}" == "list" ]; then
echo
b=1; declare -a bsrvcs
for bsrvc in ${MM_BACKUP_FOLDER}/*/ ; do
@@ -1201,14 +1181,15 @@ SERVICERESTORE(){
b=$((b+1))
done
echo
echo -en "${idsCL[LightCyan]}Select a service to restore: ${idsCL[White]}"
[ "${2}" == "list" ] && msg='list backips for' || msg='restore'
echo -en "${idsCL[LightCyan]}Select a service to ${msg}: ${idsCL[White]}"
read selsrvc
echo
srvc=${bsrvcs[${selsrvc}]}
fi
if [ "${srvc}" != "" ]; then
echo -e "${idsCL[LightGreen]}Restoring ${srvc}${idsCL[Default]}\n"
[ "${2}" != "list" ] && echo -e "${idsCL[LightGreen]}Restoring ${srvc}${idsCL[Default]}\n"
BACKUPDIR=${MM_BACKUP_FOLDER}/${srvc}
[ -f ${BACKUPDIR}/app-full.tgz ] && fcheck=app || fcheck=cfg
@@ -1233,6 +1214,10 @@ SERVICERESTORE(){
f=$((f+1))
done
if [ "${2}" == "list" ]; then
echo
exit 0;
fi
echo -en "\n${idsCL[LightCyan]}Select a backup to restore: ${idsCL[White]}"
read restore
echo