Index: woof-code/rootfs-skeleton/usr/sbin/download_file =================================================================== --- woof-code/rootfs-skeleton/usr/sbin/download_file +++ woof-code/rootfs-skeleton/usr/sbin/download_file @@ -8,10 +8,11 @@ #101118 for ftp connection have to get size differently. #101126 not sure, it seems that wget now defaults to ipv6, fails for some users, use '-4' to force ipv4. #101206 fix find filesize ftp://ftp.lug.udel.edu/pub/puppylinux ... #120201 rodin.s: internationalized. Add LANG=C to 1-st wget for proper work #120218 removed a LANG=C line (line 43). +#120220 jemimah: Technosaurus' wget progressbar function to the download_file utility. It also replaces an rxvt window with an Xdialog tailbox. refer: http://murga-linux.com/puppy/viewtopic.php?t=71767&start=420 # adding gettext export TEXTDOMAINDIR=/usr/share/locale export TEXTDOMAIN=download_file eval_gettext () { @@ -33,11 +34,12 @@ #test url... -t 2 means try 2 times, -T 20 means timeout in 20 seconds while [ 1 ];do echo -n "" > /tmp/download_file_spider.log1 #gtklogfileviewer "/tmp/download_file_spider.log" "Close" 0 0 600 200 "Testing remote file exists:" & - rxvt -geometry 130x10+0+0 -bg orange -fg black -title "$(gettext 'Testing file exists:') ${URLSPEC}" -e tail -f /tmp/download_file_spider.log1 & + #rxvt -geometry 130x10+0+0 -bg orange -fg black -title "$(gettext 'Testing file exists:') ${URLSPEC}" -e tail -f /tmp/download_file_spider.log1 & + Xdialog --wmclass "gtkdialog2" --title "$(gettext 'Testing file exists:') ${URLSPEC}" --tailbox /tmp/download_file_spider.log1 30 100 & #120220 PID1=$! LANG=C wget -4 -t 2 -T 20 --waitretry=20 --spider -S "${URLSPEC}" > /tmp/download_file_spider.log1 2>&1 # if [ $? -ne 0 ];then Xdialog --wmclass "gtkdialog2" --title "$(gettext 'Puppy File Downloader')" --screen-center --cr-wrap --ok-label "$(gettext 'TEST AGAIN')" --cancel-label "$(gettext 'GIVE UP')" --icon "/usr/local/lib/X11/pixmaps/error.xpm" --yesno "$(gettext 'Tested if remote file exists, but failed, see log top-left of screen. Do you want to test again, or give up?')" 0 0 @@ -178,11 +180,17 @@ fi fi fi echo -n "" > /tmp/download_file_spider.log2 - rxvt -geometry 130x10+0+0 -bg orange -fg black -title "$(gettext 'Downloading file:') ${URLSPEC}" -e tail -f /tmp/download_file_spider.log2 & + #rxvt -geometry 130x10+0+0 -bg orange -fg black -title "$(gettext 'Downloading file:') ${URLSPEC}" -e tail -f /tmp/download_file_spider.log2 & + #120220 jemimah... + tail -f /tmp/download_file_spider.log2 | while read LINE; do + case $LINE in + *%*)LINE=${LINE##*..};echo ${LINE%%%*};; + esac + done |Xdialog --gauge "$(gettext 'Downloading file:') ${URLSPEC}" 0 0& PID1=$! #-t 5 means retry 5 times, -w 5 means wait 5 seconds between retries... wget -4 ${CONTPARAM} -t 5 -w 5 "${URLSPEC}" > /tmp/download_file_spider.log2 2>&1 if [ $? -ne 0 ];then Xdialog --wmclass "gtkdialog2" --title "$(gettext 'Puppy File Downloader')" --screen-center --cr-wrap --ok-label "$(gettext 'TRY AGAIN')" --cancel-label "$(gettext 'GIVE UP')" --icon "/usr/local/lib/X11/pixmaps/error.xpm" --yesno "$(gettext 'Download failed, see log top-left of screen.