From ac91dd93808a00eda3ce86335492e1ee1bc6c0dc Mon Sep 17 00:00:00 2001 From: Joseph Graham Date: Sun, 15 Jun 2014 11:06:36 +0100 Subject: Made it print if a db was changed or not. --- pacman2pacman-get | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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##*/}" ]] -- cgit v1.2.2