Compare commits

...

6 Commits

Author SHA1 Message Date
Asif Bacchus
a8f70e892c update checksums 2020-09-15 23:20:45 -06:00
Asif Bacchus
65cebd4845 display failures iff greater than 0 2020-09-15 23:20:05 -06:00
Asif Bacchus
d3eab06714 remove extraneous linebreaks 2020-09-15 23:11:52 -06:00
Asif Bacchus
ca82b501cb update checksums 2020-09-15 00:42:18 -06:00
Asif Bacchus
c80374f971 unquote dummy var to allow splitting 2020-09-15 00:40:55 -06:00
Asif Bacchus
b81619376a add extra linebreak after results 2020-09-15 00:39:24 -06:00
2 changed files with 21 additions and 10 deletions

View File

@ -115,10 +115,11 @@ else
fi fi
## update files ## update files
set -- dummy "$updateFiles" # remember: do NOT quote dummy var!
set -- dummy $updateFiles
shift shift
for file; do for file; do
printf "\nchecking '%s' for updates... " "$file" printf "checking '%s' for updates... " "$file"
repoFileChecksum=$( grep "$file" "$checksumFilename" | grep -o '^\S*' ) repoFileChecksum=$( grep "$file" "$checksumFilename" | grep -o '^\S*' )
if [ -f "$file" ]; then if [ -f "$file" ]; then
localFileChecksum=$( sha256sum "$file" | grep -o '^\S*' ) localFileChecksum=$( sha256sum "$file" | grep -o '^\S*' )
@ -126,15 +127,14 @@ for file; do
localFileChecksum=0 localFileChecksum=0
fi fi
if ! [ "$localFileChecksum" = "$repoFileChecksum" ]; then if ! [ "$localFileChecksum" = "$repoFileChecksum" ]; then
printf "%s[AVAILABLE]%s\n" "$yellow" "$norm" printf "%s[AVAILABLE]%s " "$yellow" "$norm"
updatesAvailable=$((updatesAvailable+1)) updatesAvailable=$((updatesAvailable+1))
# download update # download update
printf "Downloading updated '%s'... " "$file"
if ! wget --quiet --tries=3 --timeout=10 -O "$file" "$serverPath$file"; then if ! wget --quiet --tries=3 --timeout=10 -O "$file" "$serverPath$file"; then
printf "%s[ERROR]%s\n\n" "$err" "$norm" printf "%s[ERROR]%s\n" "$err" "$norm"
downloadFailed=$((downloadFailed+1)) downloadFailed=$((downloadFailed+1))
else else
printf "%s[OK] %s" "$ok" "$norm" printf "%s[DOWNLOADED] %s" "$ok" "$norm"
downloadSuccess=$((downloadSuccess+1)) downloadSuccess=$((downloadSuccess+1))
# verify download # verify download
localFileChecksum=$( sha256sum "$file" | grep -o '^\S*' ) localFileChecksum=$( sha256sum "$file" | grep -o '^\S*' )
@ -155,7 +155,18 @@ done
### display results ### display results
printf "\n%sResults:%s\n" "$cyan" "$norm" printf "\n%sResults:%s\n" "$cyan" "$norm"
printf "\tUpdates: %s available\n" "$updatesAvailable" printf "\tUpdates: %s available\n" "$updatesAvailable"
printf "\tDownloads: %s successful, %s%s failed%s\n" "$downloadSuccess" "$err" "$downloadFailed" "$norm" if [ "$updatesAvailable" -gt '0' ]; then
printf "\tUpdates: %s applied, %s%s failed%s\n" "$updateSuccess" "$err" "$updateFailed" "$norm" if [ "$downloadFailed" -gt '0' ]; then
printf "\tDownloads: %s successful, %s%s failed%s\n" "$downloadSuccess" "$err" "$downloadFailed" "$norm"
else
printf "\tDownloads: %s successful\n" "$downloadSuccess"
fi
if [ "$updateFailed" -gt '0' ]; then
printf "\tUpdates: %s applied, %s%s failed%s\n\n" "$updateSuccess" "$err" "$updateFailed" "$norm"
else
printf "\tUpdates: %s applied\n\n" "$updateSuccess"
fi
fi
exit 0
exit 0 #EOF

View File

@ -2,4 +2,4 @@ a4ff46220c20887c85dbd9f4cc3d455bddeb920701966693bc277fb0690e9272 ab-openldap-ba
206d756846839c13574adef3acec9a9475e0212904bd44c336414160dfeb7bb1 ab-openldap-backup.sh 206d756846839c13574adef3acec9a9475e0212904bd44c336414160dfeb7bb1 ab-openldap-backup.sh
a2ae75864833c517aa686bbef02cd22864f305a42013c02d44df0008e4f2995e ab-openldap.params.template a2ae75864833c517aa686bbef02cd22864f305a42013c02d44df0008e4f2995e ab-openldap.params.template
c0d949a47ece205e8b9f31ec7376491a75a39865a3affba85b349982f5519297 ab-openldap.sh c0d949a47ece205e8b9f31ec7376491a75a39865a3affba85b349982f5519297 ab-openldap.sh
2d5ccdfa11943edf5f29cd65bc5d597f47bb702f8f85924b14a55042d13bb3d9 ab-openldap-update.sh ed4091788e258c545a13c061459e4d206f8edd98b79abdcc8052aad43acb405b ab-openldap-update.sh