It is essential to show download progress when Slax bundle is to be downloaded for activation. Yet wget doesn't provide GUI feedback at all, so we have to hack on its output. The idea is simple, just parse output of wget, read percentage value of current progress, and pass it to kdialog progress bar. But I found that rather problematic due to the buffering made by grep and sed.
For example, if you use something like
$ tail -f | grep 'foo bar'then it works realtime. As soon as new data becomes available, it is filtered by grep and printed right away. But when another pipe is added, such as
$ tail -f | grep 'foo bar' | tr -d '%'then it stops working the same way. Grep buffers the output, for better performance. In our case where wget output is filtered and manipulated, we need new percentage value as soon as possible, so the user gets updated the GUI progress bar accurately, but the buffering would delay the update, which we don't want. Fortunately recent versions of grep and sed support parameters to stop this buffering.
So the filter which can be passed to kdialog later looks like this:
wget --progress=dot http://download.data/ 2>&1 \notice -u for sed, and --line-buffered for grep.
| fgrep --line-buffered '%' \
| sed -u -r 's:.* ([0-9]+)% .*:\1:'