Skip to content

Commit

Permalink
Merge pull request #50 from ViktorJp/develop
Browse files Browse the repository at this point in the history
Publish BACKUPMON v1.8.17
  • Loading branch information
ViktorJp authored Jul 19, 2024
2 parents 4ddcee1 + 5e8e69f commit bda2635
Show file tree
Hide file tree
Showing 8 changed files with 6,337 additions and 106 deletions.
72 changes: 50 additions & 22 deletions CustomMiscUtils/master/EMail/CustomEMailFunctions.lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
# email notifications using AMTM email configuration file.
#
# Creation Date: 2020-Jun-11 [Martinski W.]
# Last Modified: 2024-Jun-04 [Martinski W.]
# Emergency Mod: 2024-Jul-07 [ViktorJp] (Temp Host Repo/github issues)
# Last Modified: 2024-Jul-08 [Martinski W.]
######################################################################

if [ -z "${_LIB_CustomEMailFunctions_SHELL_:+xSETx}" ]
then _LIB_CustomEMailFunctions_SHELL_=0
else return 0
fi

CEM_LIB_VERSION="0.9.19"
CEM_LIB_VERSION="0.9.21"
CEM_TXT_VERFILE="cemVersion.txt"

CEM_LIB_SCRIPT_TAG="master"
CEM_LIB_SCRIPT_URL="https://raw.githubusercontent.com/ViktorJp/BACKUPMON/main/CustomMiscUtils/${CEM_LIB_SCRIPT_TAG}/EMail"
CEM_LIB_REPO_BRANCH="master"
CEM_LIB_SCRIPT_URL1="https://raw.githubusercontent.com/MartinSkyW/CustomMiscUtils/${CEM_LIB_REPO_BRANCH}/EMail"
CEM_LIB_SCRIPT_URL2="https://raw.githubusercontent.com/Martinski4GitHub/CustomMiscUtils/${CEM_LIB_REPO_BRANCH}/EMail"

if [ -z "${cemIsVerboseMode:+xSETx}" ]
then cemIsVerboseMode=true ; fi
Expand Down Expand Up @@ -100,6 +100,12 @@ _LogMsg_CEM_()
#-----------------------------------------------------------#
_CheckLibraryUpdates_CEM_()
{
if [ $# -eq 0 ] || [ -z "$1" ]
then
_PrintMsg_CEM_ "\n**ERROR**: NO parameter given for directory path.\n"
return 1
fi

_VersionStrToNum_()
{
if [ $# -eq 0 ] || [ -z "$1" ] ; then echo 0 ; return 1 ; fi
Expand All @@ -110,35 +116,57 @@ _CheckLibraryUpdates_CEM_()
verNum="$(echo "$verNum" | sed 's/^0*//')"
echo "$verNum" ; return 0
}
if [ $# -eq 0 ] || [ -z "$1" ]
then
_PrintMsg_CEM_ "\n**ERROR**: NO parameter given for directory path.\n"
return 1
fi

_DownloadLibVersionFile_()
{
if [ $# -lt 2 ] || [ -z "$1" ] || [ -z "$2" ] ; then return 1 ; fi

curl -LSs --retry 4 --retry-delay 5 --retry-connrefused \
"${1}/$CEM_TXT_VERFILE" -o "$theVersTextFile"

if [ ! -s "$theVersTextFile" ] || \
grep -Eiq "^404: Not Found" "$theVersTextFile"
then
[ -s "$theVersTextFile" ] && { echo ; cat "$theVersTextFile" ; }
rm -f "$theVersTextFile"
_PrintMsg_CEM_ "\n**WARNING**: Unable to download the version file [$CEM_TXT_VERFILE]\n"
[ "$2" -lt "$urlDLMax" ] && _PrintMsg_CEM_ "Trying again with a different URL...\n"
return 1
else
[ "$2" -gt 1 ] && echo
if [ "$2" -gt 1 ] || { "$cemIsVerboseMode" && "$showMsg" ; }
then
_PrintMsg_CEM_ "The library version file [$CEM_TXT_VERFILE] was downloaded.\n"
fi
return 0
fi
}

mkdir -m 755 -p "$1"
if [ ! -d "$1" ]
then
_PrintMsg_CEM_ "\n**ERROR**: Directory Path [$1] *NOT* FOUND.\n"
return 0
fi
local theVersTextFile="${1}/$CEM_TXT_VERFILE"
local libraryVerNum dlFileVersNum dlFileVersStr
local showMsg retCode
local showMsg retCode urlDLCount urlDLMax

if [ $# -gt 1 ] && echo "$2" | grep -qE "^[-]?quiet$"
then showMsg=false ; else showMsg=true ; fi

"$cemIsVerboseMode" && "$showMsg" && \
_PrintMsg_CEM_ "\nChecking for shared library script updates..."
_PrintMsg_CEM_ "\nChecking for shared email library script updates...\n"

curl -LSs --retry 4 --retry-delay 5 --retry-connrefused \
"${CEM_LIB_SCRIPT_URL}/$CEM_TXT_VERFILE" -o "$theVersTextFile"
retCode=1 ; urlDLCount=0 ; urlDLMax=2
for cemLibScriptURL in "$CEM_LIB_SCRIPT_URL1" "$CEM_LIB_SCRIPT_URL2"
do
urlDLCount="$((urlDLCount + 1))"
if _DownloadLibVersionFile_ "$cemLibScriptURL" "$urlDLCount"
then retCode=0 ; break ; fi
done
[ "$retCode" -ne 0 ] && return "$retCode"

if [ ! -s "$theVersTextFile" ] || grep -iq "404: Not Found" "$theVersTextFile"
then
rm -f "$theVersTextFile"
_PrintMsg_CEM_ "\n**ERROR**: Could not download the version file [$CEM_TXT_VERFILE]\n"
return 1
fi
chmod 666 "$theVersTextFile"
dlFileVersStr="$(cat "$theVersTextFile")"

Expand All @@ -149,12 +177,12 @@ _CheckLibraryUpdates_CEM_()
then
retCode=1
"$cemIsVerboseMode" && "$showMsg" && \
_PrintMsg_CEM_ "\nDone.\n"
_PrintMsg_CEM_ "Update check done.\n"
else
_DoReInit_CEM_
retCode=0
"$cemIsVerboseMode" && "$showMsg" && \
_PrintMsg_CEM_ "\nNew library version update [$dlFileVersStr] available.\n"
_PrintMsg_CEM_ "New email library script version [$dlFileVersStr] is available.\n"
fi

rm -f "$theVersTextFile"
Expand Down
2 changes: 1 addition & 1 deletion CustomMiscUtils/master/EMail/cemVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.19
0.9.21
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# BACKUPMON v1.8.15
# BACKUPMON v1.8.17
![image](https://github.com/ViktorJp/BACKUPMON/assets/97465574/653e9ce8-bf0a-4faf-a8f9-e60aa367328e)

**First off** -- HUGE thanks to @Jeffrey Young for sharing his original backup script. His script is the main engine of BACKUPMON, and all credit goes to him! BACKUPMON is simply a wrapper around Jeff's backup script functionality, adding easy-to-use menus, more status feedback, and the ability to launch a restore based on your previous backups. Also, big thanks to @Martinski for his many contributions as well as his extremely helpful AMTM email library script, and huge props to @visortgw for contributing to the backup methodologies thread with his scripts and wisdom!
Expand Down
File renamed without changes.
Loading

0 comments on commit bda2635

Please sign in to comment.