From 01131dbcec43fa0d3cbaef476b11f70f2b35c94e Mon Sep 17 00:00:00 2001 From: Joseph Graham Date: Sun, 8 Jun 2014 17:13:35 +0100 Subject: Fixed bug of it displaying "100%" erronously sometimes. --- pacman2pacman-get | 26 ++++++++++++++++++-------- 1 file 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 # @@ -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 -- cgit v1.2.2