diff options
author | Joseph Graham <joseph@fibreglass.tunachunks> | 2014-06-08 17:13:35 +0100 |
---|---|---|
committer | Joseph Graham <joseph@fibreglass.tunachunks> | 2014-06-08 17:13:35 +0100 |
commit | 01131dbcec43fa0d3cbaef476b11f70f2b35c94e (patch) | |
tree | 2a18fdf1a4319f252e4f16e3e865ae0601f2bbca | |
parent | 66e80f3278ac50a15fd37f5e86693a3b93bb4936 (diff) |
Fixed bug of it displaying "100%" erronously sometimes.
-rw-r--r-- | pacman2pacman-get | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/pacman2pacman-get b/pacman2pacman-get index c020a6a..99cf6e9 100644 --- a/pacman2pacman-get +++ b/pacman2pacman-get @@ -1,7 +1,7 @@ #! /bin/bash # /usr/bin/pacman2pacman-get # -# Version 1.4.0 +# Version 1.4.1 # # Copyright (C) 2014 Joseph Graham <joseph@t67.eu> # @@ -192,15 +192,25 @@ else do [[ "${char}" =~ [[:digit:].%\ ] ]] && echo -n "${char}" done | - while read -d '%' word - do - progress="${word}%" + { + while read -d '%' word + do + progress="${word}%" - # For consistency with the transmission progress bar: - [[ "${progress}" == '100.0%' ]] && progress='100%' + # There's a crazy bug that causes it to display 100% at the + # start of the download. This should fix it. + [[ "${progress}" == '100.0%' ]] && continue - printf "\rPacman2pacman http download: %s: %s " "${pname}" "${progress}" - done + printf "\rPacman2pacman http download: %s: %s " "${pname}" "${progress}" + done + + # It's the end of the download so we can now display 100% + if [[ "${progress}" == '100.0%' ]] + then + progress='100%' + printf "\rPacman2pacman http download: %s: %s " "${pname}" "${progress}" + fi + } echo |