diff options
author | Joseph Graham <joseph@fibreglass.tunachunks> | 2014-06-15 11:06:36 +0100 |
---|---|---|
committer | Joseph Graham <joseph@fibreglass.tunachunks> | 2014-06-15 11:06:36 +0100 |
commit | ac91dd93808a00eda3ce86335492e1ee1bc6c0dc (patch) | |
tree | 214f7181e5015e1ac50a0bd140db6d346b516205 | |
parent | 3af4198426e1d42404eebafaac1c563b77a9d76c (diff) |
Made it print if a db was changed or not.
-rw-r--r-- | pacman2pacman-get | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/pacman2pacman-get b/pacman2pacman-get index c1e93d1..0e31aa0 100644 --- a/pacman2pacman-get +++ b/pacman2pacman-get @@ -179,6 +179,8 @@ else # meter how we want it, to make it consistent with the progress # bar when we download stuff with transmission. + mod_time=$(stat -c %Y "/srv/pacman2pacman/dbcache/${filename##*/}" 2>/dev/null) + progress='0%' echo -n "Pacman2pacman http download: ${pname}: ${progress}" @@ -223,6 +225,31 @@ else fi } + # What was the result of the download? + if (( dbfile )) + then + # If we fail to stat it that means it doesn't exist so the + # download failed. + if ! new_mod_time=$(stat -c %Y "/srv/pacman2pacman/dbcache/${filename##*/}" 2>/dev/null) + then + progress='failed' + printf "\rPacman2pacman http download: %s: %s " "${pname}" "${progress}" + + # If the file was not modified we display such + elif [[ "${new_mod_time}" == "${mod_time}" ]] + then + progress='file not modified' + printf "\rPacman2pacman http download: %s: %s " "${pname}" "${progress}" + fi + else + # It's not a dbfile. Just check the output file exists. + if ! [[ -f "${filename}" ]] + then + progress='failed' + printf "\rPacman2pacman http download: %s: %s " "${pname}" "${progress}" + fi + fi + echo if (( dbfile )) && [[ -f "/srv/pacman2pacman/dbcache/${filename##*/}" ]] |