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