PPM: How to download packages into any directory

How to do things, solutions, recipes, tutorials
Message
Author
User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

PPM: How to download packages into any directory

#1 Post by MochiMoppel »

The Puppy Package Manager (PPM) tends to download, install and then delete packages. I prefer to keep the package, inspect the contents and - maybe - install it by clicking on the downloaded pet file. I don't want PPM to install it for me. Adding a download-only button to PPM can help here, but adding such button to older distros is cumbersome and may not even work. Too many PPM flavors.

Another cause for trouble is the download directory. PPM insists on downloading to /root. Downloads to /root, even temporary ones, eat into the personal storage space (e.g. remaining space on pupsave file) and may freeze the system. Direct downloads to a destination outside of Puppy, e.g. /mnt/home, would alleviate the problem.
The following solutions can solve both problems.

Solution 1
Extremely simple, keeps downloaded pets, prevents automatic installation, works even in very old Puppy versions

Necessary actions:
  • Step 1: Open editor and create new document
    Step 2: Add line dir_prefix = /mnt/home/downloads <= adapt path. No quotation marks!
    Step 3: Save as /root/.wgetrc
What happens
Pushing the "Install" or the "Download-only" button in PPM will save packages directly to the defined directory.
PPM doesn't like that and responds with funny messages: "Error, failed to download XXX.pet", followed by an equally phony "Finished. The packages have been downloaded to /root". Ignore them. Tip: If you have a choice between an "Install" and a "Download-only" button, always push the "Install" button. This prevents the second message. In no case will packages be installed.

How it works
As many other programs, PPM "outsources" the downloading job to /usr/bin/wget, yet PPM blindly relies on wget's default behaviour. By default wget downloads to the current working directory, so PPM would set this directory with a "cd /root" command, and when it passes the package's URL to wget it would expect that wget saves the file to /root. PPM is not clever enough to check if the user has set a different default path in the .wgetrc config file and it also doesn't bother to add the target directory to the download parameters . When wget passes control back to PPM, PPM would search for the downloaded file in /root, can't find it and cries foul.

How to reset
Many options...
- Delete or rename .wgetrc
- Comment out the line (# dir_prefix = /mnt/home/downloads)
- If you feel nerdy, set it to default: dir_prefix = . (that's a single period, representing the current directory)
and of course you can scriptify any of those simple manual tasks

Solution 2
Some editing necessary, keeps PPM fully functional, works in all fairly new Puppies. Tested in Lucid 5.2.8

Necessary actions:
  • Step 1: Open file /usr/local/petget/downloadpkgs.sh with an editor
    Step 2: Find line cd /root and change to cd "/mnt/home" (or whatever download directory you prefer)
    Step 3: Find lines
    • /usr/local/petget/verifypkg.sh /root/$DLPKG
      else
      /usr/local/petget/installpkg.sh
      /root/$DLPKG
    Change to
    • /usr/local/petget/verifypkg.sh $DLPKG
      else
      /usr/local/petget/installpkg.sh $DLPKG

    Step 4: Find line
    <text><label>$(gettext 'Finished. The packages have been downloaded to') /root $(gettext 'directory.')</label></text>
    Change to
    <text><label>$(gettext 'Finished. The packages have been downloaded to') $PWD $(gettext 'directory.')</label></text>
What happens
Pushing the "Install" or the "Download-only" button in PPM will download packages directly to the defined directory. If the defined directory does not exist (unmounted, removed, misspelled etc.) the packages will be downloaded to /root. By default PPM will delete downloaded packages after installation. If you want to keep them, do this:

Optional actions (to prevent deletion of downloaded packages):
  • Step 5: While still editing file downloadpkgs.sh find line
    [ "$PASSEDPARAM" != "DOWNLOADONLY" ] && rm -f /root/$DLPKG 2>/dev/null
    Comment it out by putting a # in front:
    #[ "$PASSEDPARAM" != "DOWNLOADONLY" ] && rm -f /root/$DLPKG 2>/dev/null

    Step 6: Save and close downloadpkgs.sh and open file /usr/local/petget/installpkg.sh
    Step 7: Use the "Find" dialog of your editor and search for the string "rm -f $DLPKG"
    Depending on PPM version this will find once or twice these 2 lines:
    • rm -f $DLPKG_BASE 2>/dev/null
      rm -f $DLPKG_MAIN.tar.${EXT} 2>/dev/null
    Comment them out by putting a # in front:
    • #rm -f $DLPKG_BASE 2>/dev/null
      #rm -f $DLPKG_MAIN.tar.${EXT} 2>/dev/null
What happens
After completing steps 1-7 you will have a PPM that
- Works as usual, but for downloads uses the path set in step 2
- Keeps the downloaded packages after install
- Handles inaccessible download directories gracefully, falls back to /root

Solution 3 (added 2014-12-17)
Here the pizza with everything. A pet with the features of solution 2. Does not work with Lucid, but should be OK with all recent Precise and Slacko variants. For users of Precise: The "Download-only" button is also inluded, so no need to apply a manual patch.

The pet is the result of following vivid discussions and put here for better accessibility.

Features:
- Option to keep or discard packages after installation
- Last selected download folder will be saved
- New folders will be created on-the-fly if they don't exist.


-----
Attachments
ppm_mochi-2.pet
Adds option to choose dl directory and to keep pkgs after install
(27.59 KiB) Downloaded 470 times
preinstall_precise.png
(43.3 KiB) Downloaded 920 times
Last edited by MochiMoppel on Wed 17 Dec 2014, 09:44, edited 5 times in total.

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

Re: How to force PPM to download packages into any directory

#2 Post by mavrothal »

MochiMoppel wrote: Solution (example)
  • Step 1: Open editor and create new document
    Step 2: Add line dir_prefix = /mnt/home/downloads <= adapt path. No quotation marks!
    Step 3: Save as /root/.wgetrc
What happens
Pushing the "Install" or the "Download-only" button in PPM will save packages directly to the defined directory.
PPM doesn't like that and responds with funny messages: "Error, failed to download XXX.pet", followed by an equally phony "Finished. The packages have been downloaded to /root". Ignore them. Tip: If you have a choice between an "Install" and a "Download-only" button, always push the "Install" button. This prevents the second message. In no case will packages be installed.
The problem that I see with the wgetrc approach is that changes wget behavior globally so if someone uses i outside ppm the packages will still be downloaded in the predefined directory.

The patches below use the $dir_prefix variable defined in the /root/.packages/download_path file that looks like this

Code: Select all

dir_prefix=/mnt/home/downloads
and work fine either to download only or to install the pet without any errors (tested in slacko6)
If the /root/.packages/download_path does not exist ppm still works as usual.
Here are the patches.

Code: Select all

--- a/usr/local/petget/downloadpkgs.sh	2014-03-09 22:10:29.000000000 +0200
+++ b/usr/local/petget/downloadpkgs.sh	2014-11-25 10:25:25.740018392 +0200
@@ -39,6 +39,7 @@
 . /root/.packages/DISTRO_PKGS_SPECS #
 . /root/.packages/DISTRO_PET_REPOS #has PET_REPOS, PACKAGELISTS_PET_ORDER
 . /root/.packages/DISTRO_COMPAT_REPOS #v431 has REPOS_DISTRO_COMPAT
+[ -f /root/.packages/download_path ] && . /root/.packages/download_path || dir_prefix=/root
 
 echo -n "" > /tmp/petget-installed-pkgs-log
 
@@ -237,17 +238,17 @@
    download_file ${DOWNLOADFROM}/${ONEFILE}
    if [ $? -ne 0 ];then #101116
     DLPKG="`basename $ONEFILE`"
-    [ -f $DLPKG ] && rm -f $DLPKG
+    [ -f /$dir_prefix/$DLPKG ] && rm -f /$dir_prefix/$DLPKG
    fi
    unset DL_F_CALLED_FROM
   fi
   sync
   DLPKG="`basename $ONEFILE`"
-  if [ -f $DLPKG -a "$DLPKG" != "" ];then
+  if [ -f $dir_prefix/$DLPKG -a "$DLPKG" != "" ];then
    if [ "$PASSEDPARAM" = "DOWNLOADONLY" ];then
-    /usr/local/petget/verifypkg.sh /root/$DLPKG
+    /usr/local/petget/verifypkg.sh $dir_prefix/$DLPKG
    else
-    /usr/local/petget/installpkg.sh /root/$DLPKG
+    /usr/local/petget/installpkg.sh $dir_prefix/$DLPKG
     #...appends pkgname and category to /tmp/petget-installed-pkgs-log if successful.
    fi
    if [ $? -ne 0 ];then
@@ -264,7 +265,7 @@
     FAILCNT=`expr $FAILCNT + 1` #101118
    fi
    #already removed, but take precautions...
-   [ "$PASSEDPARAM" != "DOWNLOADONLY" ] && rm -f /root/$DLPKG 2>/dev/null
+   [ "$PASSEDPARAM" != "DOWNLOADONLY" ] && rm -f $dir_prefix/$DLPKG 2>/dev/null
   else
    export FAIL_DIALOG="<window title="$(gettext 'Puppy Package Manager')" icon-name="gtk-about">
   <vbox>
@@ -290,7 +291,7 @@
  export DL_DIALOG="<window title="$(gettext 'Puppy Package Manager')" icon-name="gtk-about">
   <vbox>
   <pixmap><input file>/usr/local/lib/X11/pixmaps/ok.xpm</input></pixmap>
-   <text><label>$(gettext 'Finished. The packages have been downloaded to') /root $(gettext 'directory.')</label></text>
+   <text><label>$(gettext 'Finished. The packages have been downloaded to') $dir_prefix $(gettext 'directory.')</label></text>
    <hbox>
     <button ok></button>
    </hbox>
and

Code: Select all

--- a/usr/sbin/download_file	2014-06-18 09:26:56.000000000 +0300
+++ b/usr/sbin/download_file	2014-11-25 10:31:02.013358584 +0200
@@ -38,6 +38,7 @@
 FILENAME="`basename "$@"`"
 URLDIR="`dirname "$@"`" #121019
 . /etc/rc.d/PUPSTATE
+[ -f /root/.packages/download_path ] && . /root/.packages/download_path || dir_prefix=/root
 
 #121019 ***TODO***
 #note: in future maybe make this into a gtkdialog window, with a button to launch web browser...
@@ -113,6 +114,7 @@
 #101117 check enough free space...
 #FREEK=`df -k | grep ' /$' | tr -s ' ' | cut -f 4 -d ' '`
 #no, need to know free space in whatever is current dir...
+cd ${dir_prefix}
 PWD="`pwd`"
 FREEblocks=`stat -f --format=%a ${PWD}`
 BLOCKsize=`stat -f --format=%S ${PWD}`
Now all we need is a dialog in /usr/local/petget/configure.sh, say in the miscellaneous tab, to allow user to define $dir_prefix easily :wink:
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

Re: How to force PPM to download packages into any directory

#3 Post by MochiMoppel »

mavrothal wrote:The problem that I see with the wgetrc approach is that changes wget behavior globally so if someone uses i outside ppm the packages will still be downloaded in the predefined directory.
Could even be an advantage. Users who use the wget command in a terminal or in scripts usually define an output directory with the -P switch, so they are not affected by .wgetrc. If they don't define anything and leave the decision to wget (= current situation), results can become unpredictable. Another nice feature of the wgetrc approach: The download directory appears in the header of the wget output, so the user gets this useful piece of information everytime he/she uses the command.
I see the aproach as a quick and easy work around. A proper solution needs to dig deeper :wink:
The patches below use the $dir_prefix variable defined in the /root/.packages/download_path file that looks like this

Code: Select all

dir_prefix=/mnt/home/downloads
and work fine either to download only or to install the pet without any errors (tested in slacko6)
If the /root/.packages/download_path does not exist ppm still works as usual.
I assume that it would only work as usual as long as a .wgetrc file doesn't set a different path. Priorities are .wgetrc -> download_path -> /root
I think it would be cleaner and rock solid if $dir_prefix (defined in download_path or wherever) would be passed by wget with -P option. This would have highest priority and can't be changed anymore by any other command or variable.

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

Re: How to force PPM to download packages into any directory

#4 Post by mavrothal »

MochiMoppel wrote: I think it would be cleaner and rock solid if $dir_prefix (defined in download_path or wherever) would be passed by wget with -P option.
OK here it is

Code: Select all

--- a/usr/sbin/download_file	2014-06-18 09:26:56.000000000 +0300
+++ b/usr/sbin/download_file	2014-11-25 14:01:46.593596287 +0200
@@ -38,6 +38,7 @@
 FILENAME="`basename "$@"`"
 URLDIR="`dirname "$@"`" #121019
 . /etc/rc.d/PUPSTATE
+[ -f /root/.packages/download_path ] && . /root/.packages/download_path || dir_prefix=/root
 
 #121019 ***TODO***
 #note: in future maybe make this into a gtkdialog window, with a button to launch web browser...
@@ -113,6 +114,7 @@
 #101117 check enough free space...
 #FREEK=`df -k | grep ' /$' | tr -s ' ' | cut -f 4 -d ' '`
 #no, need to know free space in whatever is current dir...
+cd ${dir_prefix}
 PWD="`pwd`"
 FREEblocks=`stat -f --format=%a ${PWD}`
 BLOCKsize=`stat -f --format=%S ${PWD}`
@@ -204,7 +206,7 @@
  rxvt -geometry 130x10+0+0 -bg "$BG" -fg "$FG" -title "$(gettext 'Downloading file:') ${URLSPEC}" -e tail -f /tmp/download_file_spider.log2 & #120908 restored.
   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
+ wget -4 ${CONTPARAM} -t 5 -w 5  -P $dir_prefix "${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.
 Do you want to try again, or give up?')" 0 0
About this gtkdialog modification to configure.sh I can not help. The gtkdialog rewrite of configure.sh appears too finicky for my abilities.( :oops: )
Maybe one of the resident gtkdialog experts will add a frame so the user can define the path of the download directory and then echo "dir_suffix=$path" into /root/.packages/download_path
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

Re: How to force PPM to download packages into any directory

#5 Post by mavrothal »

mavrothal wrote:About this gtkdialog modification to configure.sh I can not help.
Oh well I lied :D
Here is the patches, the customary picture showing the download folder dialog in the configure window and a pet that incorporates the 3 patches above (and latter 3 more) and will add in PPM the option to define where to download pets that you "download only" and the option to also keep the installed pets (see pic below)
Is tested in Slacko-6 beta, and Tahr-6.O CE
Also works in Precise-5.x, Slacko-5.x and even Lucid 5.2.8(!) though the "download only" option does not exist in these older pups. It can be added as described here. The "save installed pets" option does not need any additional modifications in these older pups.
Please test as hard as you can so it may eventually go to woof for future puppies :wink:

The following files were changed
configure.sh: Add GUI code to check and save user options for download folder and to save installed pets
downloadpkgs.sh: Add code to look for presets (dir and save pet); cd to preset dir; change hard coded /root to preset dir;
installpkg.sh: double quote pre-existing variables so will accept path names with spaces; modify code so will not delete installed pets if we choose to save them
verifypkg.sh : double quote pre-existing variables so will accept path names with spaces
pet2tgz: modify code so will not delete installed pets if we choose to save them
download_file.sh: Add code to look for presets dir (only when called from PPM); cd to preset dir; double quote pre-existing variables so will accept path names with spaces; added download dir variable to wget command (this last one could be skipped since we already cd'ed in it but some extra precausion)

Edit: v2 also informs for the current download file
Edit 2: v3 accepts folder names with spaces - Broken
Edit 3: v 4 will correctly work when names of the folders have spaces - oops never made it through :oops:
Edit 4: v 5 accepts pathnames with spaces and provides the option to save the installed pets :twisted:
Edit 5: v 6 will not break other apps that may use the download_file script
Edit 6: v 7 "final" I hope :roll:
Edit 7: v 8 checks that the download folder really exists. Also works fine in older pupps
Edit 8: v 9 Bug fix for v8 (v7 was OK). Thx rg66 and greengeek.
Attachments
ppm_downdir_patches-9.tar.gz
Patches to add this functionality to ppm (for developers).
Older pup compatibility (non svg icons), not included.
(20 KiB) Downloaded 374 times
ppm_down_dir-9.pet
Adds the option to define a pet download directory and also have the option to save installed pets.
Can be used with older pupps too
(24.56 KiB) Downloaded 607 times
download_folder.png
(26.51 KiB) Downloaded 1490 times
Last edited by mavrothal on Tue 02 Dec 2014, 08:46, edited 27 times in total.
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

Re: How to force PPM to download packages into any directory

#6 Post by MochiMoppel »

You've opened Pandora's box. Good luck :lol:
mavrothal wrote:...will add in PPM the option to define where to download pets (either to keep or transiently during installation).
Works as advertised in Slacko 5.9.3 .... and triggers the next request: An option to keep downloads after install. I remember that I've done it once and that it wasn't too hard, but of course can be shelved as long as there is no demand.

You need to use quotation marks for the variable in /root/.packages/download_path and also when using the variable in the scripts, otherwise download paths containing spaces don't work.

More general thought: I never understood why configure.sh saves settings to /var/local/petget/ . Seems wrong to me. Now that even /root/Startup moved to /root/.config I think it's time to create and use a /root/.config/petget
And this is where download_path should go, not to /root/.packages/ :wink:

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

Re: How to force PPM to download packages into any directory

#7 Post by mavrothal »

MochiMoppel wrote: An option to keep downloads after install. I remember that I've done it once and that it wasn't too hard, but of course can be shelved as long as there is no demand.
I do not thing there is "demand" for any of these. Is just fun :D
Maybe in v4
MochiMoppel wrote:You need to use quotation marks for the variable in /root/.packages/download_path and also when using the variable in the scripts, otherwise download paths containing spaces don't work.
Done in version 3 above
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#8 Post by MochiMoppel »

Sorry for getting into nitpicking mode, but I stumbled on something that made me scratch my head for half an hour.

The "Finished. Packages have been downloaded" gtkdialog in downloadpkgs.sh. I don't know if you misplaced the quotes or if this was intentional. Anyway, my suggestion:

Code: Select all

<text><label>$(gettext 'Finished. The packages have been downloaded to') "${dir_prefix}" $(gettext ' directory.')</label></text>
In your and my version the line breaks after the first forward slash, which looks odd. Unfortunately gtkdialog regards the slash as a word boundary, just like a space. I found no way to insert a linefeed before the slash without breaking the label text. Is there any way? I finally settled for 2 text widgets, my second suggestion. IMHO this produces the most readable dialog:

Code: Select all

<text><label>$(gettext 'Finished. The packages have been downloaded to')</label></text>
<text><label>"${dir_prefix}" $(gettext ' directory.')</label></text>
Here all 3 version:
Attachments
downloadpkgs.sh_finished_dialog.png
(25.15 KiB) Downloaded 1428 times

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

#9 Post by mavrothal »

MochiMoppel wrote:Sorry for getting into nitpicking mode, but I stumbled on something that made me scratch my head for half an hour.

The "Finished. Packages have been downloaded" gtkdialog in downloadpkgs.sh. I don't know if you misplaced the quotes or if this was intentional. :
Is intentional to show exactly the folder because without quotes if you name your folder "pets folder" then will look like
"The packages have been downloaded to pets folder folder"

BTW :roll: version 3 will fail to install when the path has spaces (download is OK).
Version 4 above is OK
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#10 Post by MochiMoppel »

mavrothal wrote:Is intentional to show exactly the folder because without quotes if you name your folder "pets folder" then will look like
"The packages have been downloaded to pets folder folder"
That's OK. What I meant with misplaced is the placement in the code. If you use

Code: Select all

downloaded to "') ${dir_prefix} $(gettext '"
doesn't this mean that the quotes become part of the gettext argument and therefore will require a change of .mo files?

I thought that this would be easier:

Code: Select all

downloaded to ') "${dir_prefix}" $(gettext '
BTW: No version 4 link :cry: You linked the patches twice :wink:



.
Last edited by MochiMoppel on Wed 26 Nov 2014, 14:40, edited 1 time in total.

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

#11 Post by mavrothal »

MochiMoppel wrote: BTW: No version 4 link :cry: You linked the patches twice :wink:
:oops:

But version 5 now also gives the option to save installed pets :D

PS If I know will be that messy...
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

#12 Post by bigpup »

mavrothal,

Thanks for doing this!

Tried it in Tahrpup 6.0

Selecting a download location works for me.

I am selecting /mnt/home

After restarting PPM as requested in the config window.

However,
It only works if I also have the "Save installed pets too" checked.

If "Save installed pets" is not checked it goes back to /root.

When selecting a package in PPM I am selecting to download only.
Attachments
capture22230.png
After selecting /mnt/home (selecting save installed pets too) and restart PPM
(22.41 KiB) Downloaded 1325 times
capture13891.png
After selecting /mnt/home (Not selecting save installed pets too)
and restart PPM
(22.08 KiB) Downloaded 1347 times
The things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected :shock:
YaPI(any iso installer)

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

#13 Post by mavrothal »

bigpup wrote: However,
It only works if I also have the "Save installed pets too" checked.
Yes, I realized that. Is corrected in version 6.
Also previous version could break other apps depended on download_file (ie sfsget). Version 6 should be OK.
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#14 Post by MochiMoppel »

mavrothal wrote:Also previous version could break other apps depended on download_file (ie sfsget). Version 6 should be OK.
I have problems with version 6. It adds dir_prefix for ALL applications, which may not be desirable. It overrides dir_prefix set in .wgetrc, which makes the option for Sfs manager described in my initial post impossible. Logic should be
- if app sets dir_prefix (as now ppm), use it (= use -P switch)
- id app doesn't, let wget check if it's set in .wgetrc, otherwise use $PWD

I propose, that in download_file you revert most of your new changes and add an if statement for wget command. This retains former behaviour for all applications except ppm.:
if [ "$DL_F_CALLED_FROM" = "ppm" ];then #see /usr/local/petget/downloadpkgs.sh
# Add option choose savefolder
#~ [ -f /root/.packages/download_path ] && \
#~ dir_prefix="$(grep dir_prefix /root/.packages/download_path | cut -f 2 -d '=')" \
#~ || dir_prefix=/root


PPM_NO_URL_MSG="

$(gettext "NOTE:")
$(gettext "It may be that the local package database needs to be updated. In some cases, the packages in the online package repository change, so you may be trying to download a package that no longer exists. One way to check this is to go to the URL with your web browser:")
${URLDIR}
$(gettext "If the URL is working and the repository has a later package, cancel the current operation. In the Puppy Package Manager main window, click the 'Configure' button, then the 'Update now' button -- this will update the local database. Be warned though, for some large repositories this process may take awhile.")"

#~ else
#~ dir_prefix=$(pwd)

fi
.
.
.
#~ cd "${dir_prefix}"
PWD="`pwd`"
.
.
.
if [ "$dir_prefix" ]; then
wget -4 ${CONTPARAM} -t 5 -w 5 -P "${dir_prefix}" "${URLSPEC}" > /tmp/download_file_spider.log2 2>&1
else
wget -4 ${CONTPARAM} -t 5 -w 5 "${URLSPEC}" > /tmp/download_file_spider.log2 2>&1
fi
There is no need to define dir_prefix again in download_file as is was already defined in downloadpkgs.sh (download_file is called from downloadpkgs.sh). You only need to export:
if [ -f /root/.packages/download_path ]; then
export dir_prefix="$(grep dir_prefix /root/.packages/download_path | cut -f 2 -d '=')"
SAVEFLAG=$(grep true /root/.packages/download_path)
else
export dir_prefix=/root
fi
Let's hope it works :lol:

User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

#15 Post by bigpup »

Tahrpup 6.0

Version 6 seems to be working OK.
No problems so far using it.

Thanks :!: :D

Seems version 6 is your sweet spot in developing additional features for Puppy :lol: :wink:

Edit:
Well, :wink: maybe that sweet spot is going to change to version 7 for this one.
The things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected :shock:
YaPI(any iso installer)

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

#16 Post by mavrothal »

bigpup wrote: Well, :wink: maybe that sweet spot is going to change to version 7 for this one.
I do not know...
PPM is such a convoluted mess that making it more convoluted for the sake of a rather useless/confusing "feature" is wrong.
Yes is fun "because we can", but still wrong.

Now days with savefolder you do not have any limitations in your root directory, And if you really want to save your pets then you probably just playing with puppies or you are alpha/beta testing or developing, But then you should be able to do it for yourself :wink:

I uploaded v7 and I'll probably keep looking to it but If anybody else want to run with it, please do because my "fun" is almost over... :roll:
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

#17 Post by mavrothal »

MochiMoppel wrote:I have problems with version 6. It adds dir_prefix for ALL applications, which may not be desirable. It overrides dir_prefix set in .wgetrc, which makes the option for Sfs manager described in my initial post impossible. Logic should be
- if app sets dir_prefix (as now ppm), use it (= use -P switch)
- id app doesn't, let wget check if it's set in .wgetrc, otherwise use $PWD
I do not see that, I can actually simultaneously download a pet in the "pets folder" and an SFS with the sfsmanager at /mnt/home.
You may want to check v7, or better yet modify it as you see fit and upload it :wink:
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#18 Post by MochiMoppel »

mavrothal, let's take a break here. V7 looks mature, is ready for download and should now be tested by users - where are they? - who have a real need for the new features.

I assume that by now you share my belief that the word "fun" (your 4th post) is not the right F-word to be associated with the ppm :lol:

User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

#19 Post by bigpup »

should now be tested by users - where are they? - who have a real need for the new features.
Well this Topic started about two days ago and has had 545 views.
Seems more than just a few are interested.

Up until a pet was made and the bugs worked out. This was more a discussion on how it could possibly be done.

Give it some time for people to use the pet and report back.

MochiMoppel,
You could help if you edited the first post to show that a pet is available to add this feature to PPM.

Nothing wrong with what you offer in that first post.
However, if this has progressed to a pet package, that can be downloaded and used to update PPM, it needs to be shown in the first post of the topic.
People will see that better than looking through the topic to find it.
Maybe even adjust the topic subject to indicate a PPM update.

You and mavrothal worked together on this and that is what Puppy is all about. Teamwork and passing around ideas.

Good work by both of you!!!

Thanks!
The things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected :shock:
YaPI(any iso installer)

User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

#20 Post by bigpup »

entered in error
The things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected :shock:
YaPI(any iso installer)

Post Reply