Improved jargroup_getlatest to use the most exact file name when downloading.

Older versions of wget have the --trust-server-names flag on by default
(if it exists for them at all).
This commit is contained in:
Marcus Whybrow 2012-05-30 21:09:01 +01:00
parent f05e540609
commit 35ea082968

8
msm
View File

@ -503,7 +503,7 @@ jargroup_getlatest() {
return 1
fi
as_user "$USERNAME" "wget --quiet --input-file='$JAR_STORAGE_PATH/$1/$JARGROUP_TARGET' --directory-prefix='$JAR_STORAGE_PATH/$1/$JARGROUP_DOWNLOAD_DIR' --no-check-certificate"
as_user "$USERNAME" "wget --quiet --trust-server-names --no-check-certificate --input-file='$JAR_STORAGE_PATH/$1/$JARGROUP_TARGET' --directory-prefix='$JAR_STORAGE_PATH/$1/$JARGROUP_DOWNLOAD_DIR'"
echo "Done."
local num_files=$(as_user "$USERNAME" "ls -1 '$JAR_STORAGE_PATH/$1/$JARGROUP_DOWNLOAD_DIR' | wc -l")
@ -516,7 +516,7 @@ jargroup_getlatest() {
local most_recent_jar=$(get_latest_file "$JAR_STORAGE_PATH/$1")
if [[ ! -e "$most_recent_jar" ]] || ! diff "$most_recent_jar" "$JAR_STORAGE_PATH/$1/$JARGROUP_DOWNLOAD_DIR/$file_name"; then
if [[ ! -e "$most_recent_jar" ]] || ! diff "$most_recent_jar" "$JAR_STORAGE_PATH/$1/$JARGROUP_DOWNLOAD_DIR/$file_name" > /dev/null; then
# There is not a previous version to do a comparison against, or
# The previous version is different:
# Add it to the group
@ -526,8 +526,8 @@ jargroup_getlatest() {
as_user "$USERNAME" "mv '$JAR_STORAGE_PATH/$1/$JARGROUP_DOWNLOAD_DIR/$file_name' '$JAR_STORAGE_PATH/$1/$new_name'"
if [[ $was_previous == 0 ]]; then
echo "Downloaded version was different to previous latest. Saved as \"$1/$new_name\"."
if [[ ! -z $most_recent_jar ]]; then
echo "Downloaded version was different to previous latest. Saved as \"$JAR_STORAGE_PATH/$1/$new_name\"."
else
echo "Saved as \"$JAR_STORAGE_PATH/$1/$new_name\"."
fi