site  contact  subhomenews

File downloader

November 16, 2010 — BarryK
I have written a "heavy duty" file downloader, /usr/sbin/download_file, in Woof.

This utility checks that the file exists online before downloading it, downloads, offers to continue if previous partial download. Reports everything, so you know exactly what has happened.

I am now calling this utility from the Video Upgrade Wizard, file /usr/local/video_upgrade/video_upgrade_wizard, instead of just running wget.

Next, I will modify PPM to do the same.

Comments

PPM uses download_file
Username: BarryK
Ok, the Puppy Package Manager now uses download_file.

code link?
Username: 01micko
"Hi Barry, I figure I can ditch all the rigorous code in quickpet for lucid puppy, if only I had a link to the code! I gather it is built into the next woof, but a snapshot of the code would give me some time to update my stuff. Cheers

download_file posted
Username: BarryK
"01micko, Ok, it is here: http://murga-linux.com/puppy/viewtopic.php?p=468143#468143

download_file size fix
Username: BarryK
"The 'download_file' script checks first that the remote file exists, and obtains its size. This worked for an http protocol site, however for an ftp site the file-size information is returned differently. I have modified download_file to correctly obtain the remote file size for an ftp URL.

thanks
Username: 01micko
"Yes I just discovered that myself! (actually I knew it but they have changed it recently) Now they list the whole directory and sizes, so I'm grepping the exact size with the exact file name, I guess you do similar. Cheers (and aren't some of those wget header files wild? .. turtle power? hehe!)

re download_file
Username: 01micko
"Ok, part of quickpet is an sfs grabber, it didn't use the rigorous code. Someone complained. http://murga-linux.com/puppy/viewtopic.php?p=468996#468996 I rewrote it to use 'download_file. Worked great for me, lets hope it works great for all. Cheers

re Downlod_file
Username: 01micko
"Ok, doesn't matter. I put code in to detect download_file and if it's there it uses it, Otherwise the old wget (with some params) is run from rxvt -e Cheers

wget woes
Username: 01micko
"Hi Barry One particular user is reporting failure with PPM and my sfs_grab script (which uses 'download_file') but success with quickpet, http://www.murga-linux.com/puppy/viewtopic.php?p=469115#469115 It just dawned on me what it is... the "[b]-4[/b]" option with wget. (ipv4 vs ipv6, if that makes sense) [b]aarf[/b] (I'm sure you remember him/her) was considerably vocal and helpful on this issue in quickpet development, but what perplexes me is aarf's lack of problems with PPM at the time, which was some months ago. So.. for some it seems the '-4' option is needed, but I bet for others it may bork their download. Incidentally, in all of quickpet's testing, since the '-4' option was added to the wget call, there have been no problems reported, that doesn't mean they are not there! Cheers

sfs issue, download_file
Username: 01micko
"jpeps reported an sfs issue downloading the devx for lupu using my sfs_grabber http://www.murga-linux.com/puppy/viewtopic.php?p=483290#483290 I narrowed it down to some code in download_file that needs 3X the space to allow for installation of the file. Here's my proposal At line 93 I added a case for pupmodes 6 and 12 conditional upon the file being an sfs, [code]case $PUPMODE in 3|7|13|77) #tmpfs on top #when install pkg, it writes direct to save-layer. SIZEK_REQUEST=`expr $SIZEK_ONLINE + 6000` #6MB slack. ;; 6|12) FILE_SFS=`echo $FILENAME|grep .sfs$` #01micko incase file is an sfs 20110104, pwd may not be inside savefile if [ "$FILE_SFS" = "" ];then SIZEK_REQUEST=`expr $SIZEK_ONLINE \* 3` #3MB slack, no, need install space too. else SIZEK_REQUEST=`expr $SIZEK_ONLINE + 3000` #3MB slack. fi ;; *) SIZEK_REQUEST=`expr $SIZEK_ONLINE \* 3` ;; esac[/code] Shouldn't do any harm Thoughts?


Tags: woof