PPM: How to download packages into any directory

How to do things, solutions, recipes, tutorials
Message
Author
User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#46 Post by greengeek »

mavrothal wrote:Version 9 should fix this as well as the one above reported by rg66.
Yep, v9 works perfectly for me - testing with Slacko 5.6 and setting destination directories either within or without of the save file works great.

Even if there is no further development this seems like good progress.

New feature request:
if there was one feature I would ask for it is the ability to set the download directory at the time you commence the download - rather than having a pre-configured destination in the depths of the PPM settings.

There might be times where you are downloading packages for two entirely separate purposes and wanting to store them in two entirely different directories. It would be nice to do so without delving into the PPM settings between the two downloads.

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

#47 Post by mavrothal »

greengeek wrote: if there was one feature I would ask for it is the ability to set the download directory at the time you commence the download - rather than having a pre-configured destination in the depths of the PPM settings.
I think some may be annoyed if every time PPM asks where to download.

Keep in mind that although the configure window advises to restart PPM, changes in the download folder or in 'keep install pets' take effect as soon as you say "OK" and close the configure window and do not need a PPM restart.
== [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

#48 Post by bigpup »

Keep in mind that although the configure window advises to restart PPM, changes in the download folder or in 'keep install pets' take effect as soon as you say "OK" and close the configure window and do not need a PPM restart
I was wondering if that restart was really needed.
Thanks for the info!!

However, I think a PPM restart is still needed for some of the other config options.

I have turned over testing of this feature to the Puppy test lab.
(wonder what the 3 computers with yellow warning lights handle)
Attachments
Puppy test lab.jpg
(109.15 KiB) Downloaded 407 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
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#49 Post by greengeek »

Clearly the heat generated by the modern technology in the Puppy Test Lab requires getting half naked. Such dedication! "Don't try this at home!"

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

#50 Post by bigpup »

Test of install to USB flash drive formatted Fat32

Tahrpup 6.0 CE
Installed to USB flash drive
Partition sdb1
Formatted Fat32
Booted using a save file.

Installed version ppm_down_dir-9.pet.

PPM
Changed download locations to places not in save file.
Tried these two locations:
/mnt/home
Made a download directory on top layer of partition so it is /mnt/home/download
Tried download only and save installed pets too options.

All downloads went to what I had selected for a download location.
Seems to be working OK.

One thing did happen. Not sure if it is a problem or the way it should be for a USB flash drive install..
My PPM-> config->miscellaneous looks like this:
Attachments
capture15919.png
(38.39 KiB) Downloaded 272 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

#51 Post by mavrothal »

bigpup wrote: Test of Puppy full install operation.
<latter>
Test of install to USB flash drive formatted Fat32
Now I understand why these people in the puppy test lab are half naked. Too much work :D
Thanks for testing.
bigpup wrote: One thing did happen.
Yes that is an additional option appearing when you run in pupmode 3, 7, 13. (ie when the save icon appears on the desktop)
== [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

#52 Post by bigpup »

Yes that is an additional option appearing when you run in pupmode 3, 7, 13. (ie when the save icon appears on the desktop)
Earlier in testing, when I got this result, I thought there was something wrong, because it did not match the example image you posted.

PPM is evil :evil: making the miscellaneous window change it's looks, based on how Puppy is installed and running.

You must be smarter than the equipment or software you are using :shock: :lol:
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

#53 Post by bigpup »

Just to see what would happen.
if I typed in a download location, that did not exist, or typed it in wrong.
If I typed in a location on a partition that was not mounted.
Attachments
capture26953.png
(5.3 KiB) Downloaded 258 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
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#54 Post by MochiMoppel »

mavrothal wrote:OK. Please provide a patch set and possibly a pet that implements (with a GUI) this less complex process.
Please notice that will be nice if it also offers the option to save installed pets too.
Can't promise a "patch set", in fact can't promise anything, but in any case will document all changes. May take a while though ...

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

#55 Post by mavrothal »

MochiMoppel wrote:
mavrothal wrote:OK. Please provide a patch set and possibly a pet that implements (with a GUI) this less complex process.
Please notice that will be nice if it also offers the option to save installed pets too.
Can't promise a "patch set", in fact can't promise anything, but in any case will document all changes. May take a while though ...
I do not know if it makes it any easier for you but in the ppm_down_dir-9.pet post I have all the changes in this pet (present in the patches too)

They are:
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)

Would be nice if some of these changes can be eliminated and still maintain the same functionality.
== [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
rg66
Posts: 1158
Joined: Mon 23 Jul 2012, 05:53
Location: Vancouver, BC Canada / Entebbe, Uganda Africa!?!

#56 Post by rg66 »

greengeek wrote:New feature request:
if there was one feature I would ask for it is the ability to set the download directory at the time you commence the download - rather than having a pre-configured destination in the depths of the PPM settings.

There might be times where you are downloading packages for two entirely separate purposes and wanting to store them in two entirely different directories. It would be nice to do so without delving into the PPM settings between the two downloads.
I decided to have a go at this for something to do. Seems to be working but haven't tested it too much, proof of concept at the moment.
X-slacko-5b1 - X-tahr-2.0 - X-precise-2.4
[url=http://smokey01.com/rg66/]X-series repo[/url]

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

#57 Post by MochiMoppel »

mavrothal wrote:I do not know if it makes it any easier for you but in the ppm_down_dir-9.pet post I have all the changes in this pet (present in the patches too)
The patch files are the most valuable. I could work without the pets, but hardly without the patch files. :lol:

As it looks now the files verifypkg.sh and pet2tgz don't need to be changed, download_file only needs to have 2 variables changed to accomodated spaced files. Maybe we can leave wget untouched, but maybe we shouldn't ... I'll toss a coin.

Haven't touched the GUI yet. What I also haven't looked at yet: petget. When a user doubleclicks a locally saved pet, petget "downloads" the file to /root , calls installpkg.sh and after installation deletes the pets from /root, very similar to an unpatched download_file.sh. Needs fixing, but will have to wait.

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

#58 Post by mavrothal »

MochiMoppel wrote: What I also haven't looked at yet: petget. When a user doubleclicks a locally saved pet, petget "downloads" the file to /root , calls installpkg.sh and after installation deletes the pets from /root, very similar to an unpatched download_file.sh. Needs fixing, but will have to wait.
petget is no harm since it does not delete the original pet, even if it is in root.
Yes could be using the defined directory for consistency but...
Last edited by mavrothal on Wed 03 Dec 2014, 20:04, edited 2 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
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#59 Post by greengeek »

rg66 wrote:I decided to have a go at this for something to do. Seems to be working but haven't tested it too much, proof of concept at the moment.
Looks like its working fine. I only use the PPM to access packages that I believe have been 'approved' with the particular puppy and the ability to select the destination directory for such pets would be handy. I'm less concened about what directory is used when i click 'install' - as i have already made a decision at that time that I am committing to the pet.

It is when i want to inspect the pet or save for later use that i want to change the destination directory.

(I guess what I am saying is - if it defaults to /root for install that is fine by me as long as it asks me for destintion directory when I choose 'download only')

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

#60 Post by bigpup »

Just adding to the discussion.
Just an idea to think about.

Being able to change the default download location is a good feature. What you have done works and I like and use it.

I too was looking for a download location option as Greengeek talks about.

What I was originally thinking was the way a web browser works when you choose to download something.
You click on download and a Window pops up giving you the ability to choose the download location.
If what is already set looks good you do nothing.
If you want to change the location you enter it or navigate to it.
Basically that change now becomes the default location.
Example what you would see for a pop up window:
Attachments
capture13965.png
(8.21 KiB) Downloaded 133 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

#61 Post by mavrothal »

mavrothal wrote: Yes could be using the defined directory for consistency
OK here is a patch for petget. Whoever builds the next version (if not me) is welcome to use it.

Code: Select all

--- a/usr/local/petget/petget	2014-08-27 23:07:44.000000000 +0300
+++ b/usr/local/petget/petget	2014-12-03 23:53:14.036633783 +0200
@@ -35,6 +35,12 @@
 
 [ ! $1 ] && exit
 
+if [ -f /root/.packages/download_path ]; then
+ . /root/.packages/download_path
+ [ -d "$dir_prefix" ] && dir_prefix="$dir_prefix" || dir_prefix=/root
+else
+ dir_prefix=/root
+fi
 #export LANG=C
 . /etc/DISTRO_SPECS #has DISTRO_BINARY_COMPAT, DISTRO_COMPAT_VERSION
 
@@ -97,7 +103,7 @@
 #download if required...
 PKGNAME=""
 if [ "`echo -n "$PASSEDPARAM" | grep -E '^ftp|^http'`" != "" ];then
- cd /root
+ cd "$dir_prefix"
  #101116 use download_file utility...
  download_file "$PASSEDPARAM"
  PKGPATH="`dirname "$PASSEDPARAM"`" #really a url.
@@ -126,10 +132,10 @@
    PKGMAIN="`basename "$PASSEDPARAM" ${EXT}`"
   fi
  fi
- cp -f "${PKGPATH}/${FULLPKGNAME}" /root/ 2>/dev/null #v424 fix if spaces in path.
+ cp -f "${PKGPATH}/${FULLPKGNAME}" "$dir_prefix"/ 2>/dev/null #v424 fix if spaces in path.
 fi
 originPKGPATH="$PKGPATH" #w482
-PKGPATH=/root
+PKGPATH="$dir_prefix"
 
 #split PKGMAIN, ex: FULLPKGNAME=xvidtune-1.0.1-i486-1.tgz has PKGNAME=xvidtune-1.0.1
  case $EXT in
@@ -178,7 +184,7 @@
   ;;
  esac
 
-cd "$PKGPATH" #well, this is /root
+cd "$PKGPATH"
 
 #confirm want to install...
 export INSTALL_DIALOG="<window title="$(gettext 'Puppy Package Manager')" icon-name="gtk-about">
@@ -219,7 +225,7 @@
 rm -f /tmp/petget_missing_dbentries-Packages-* 2>/dev/null
 rm -f /tmp/petget-installed-pkgs-log 2>/dev/null
 echo "$DB_ENTRY" > /tmp/petget_missing_dbentries-Packages-alien
-/usr/local/petget/installpkg.sh $PKGPATH/$FULLPKGNAME
+/usr/local/petget/installpkg.sh "$PKGPATH"/$FULLPKGNAME
 RETVAL=$?
 
 #installpkg.sh has already done this...
In the mean time you may want to test the next PPM project: Installing multiple packages at once with PPM (attended too)
== [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

#62 Post by MochiMoppel »

bigpup wrote:I too was looking for a download location option as Greengeek talks about.
You should keep in mind the main reason for a download option (see 2nd para of my initial post): to help people who have a skimpy pupsave file and not enough room in /root. The download directory is foremost a working directory, should be the fastest possible and /root is still a good choice for most users. The present default is: download pet to RAM, install and delete. The pet never touches your USB or HDD.

EDIT: OK, last statement depends on PUPMODE. I'm using PUPMODE 5 and tend to forget that some modes write directly to disc.

If you ask for a default directory for download-only pets, then we are possibly talking about a target somewhere on a permanent save location. Normally this location outside of RAM would be much slower and not ideal for PPM as a working directory.

@mavrothal
After good night's sleep I think that petget should keep its current defaults. Was just one of those ideas :lol:


-
Last edited by MochiMoppel on Thu 04 Dec 2014, 06:36, edited 1 time in total.

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

#63 Post by bigpup »

MochiMoppel you bring up some good points.

However, this feature is already changing the default download location and making this change the new default setting.

I may be wrong, but as it stands the normal install operation:
download pet to RAM, install and delete
is not that clearcut anymore.
It will use this new location to do the install.
So, does it not already do what you are worried about?

AT least what I propose would make you at least verify the setting is what you want to use and give you option to change it, just before doing the download.

Just to make the discussion more confusing.
Seems working only in ram, is not that clear, for a normal program install.
Before adding the download feature it still had options.

PPM could have two possible looks after adding this feature.

see images:
Attachments
capture12187.png
PPM before adding download option
(33.66 KiB) Downloaded 405 times
download_folder.png
download feature added to PPM on a hard drive install
(26.51 KiB) Downloaded 410 times
capture15919.png
download feature added to PPM on a USB flash drive
(38.39 KiB) Downloaded 404 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
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#64 Post by MochiMoppel »

@bigpup
Interesting. I've never seen the installation mode option. This will be shown only to users of PUPMODE 3,7 or 13.

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

#65 Post by MochiMoppel »

mavrothal wrote: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)

Would be nice if some of these changes can be eliminated and still maintain the same functionality.
Done. :lol: I tried to keep changes to a minimum, which eliminates some of your fixes but on the other hand adds some new ones.

I tested in Slacko and Precise. I tried to make it compatible with Lucid 5.2.8 but gave up. Too many differences. Lucid users can still patch manually (solution 2), this worked. And Puppy 4.2...no way, but solution 1 always works.

Biggest change is the GUI. I moved the directory selection from the configuration dialog to the preinstall dialog. I did this mainly for technical reason, but there is also a benefit for the users: The choices are more visible and are better linked to their context. It also answers the request of some forum members who asked for the option to choose a download directory before each download.
Features of directory input field:
  • Input field shows current download directory
  • New directories entered into the field will be created on-the-fly if they don't exist.
  • User may enclose path with quotation marks (he shouldn't, but if he does, the marks will be stripped automatically)
The pet includes 4 files:

installpreview.sh
- Added GUI code to check and save user options for download folder and to save installed packages.

downloadpkgs.sh:
- cd to preset dir
- Removed hard coded /root
- Modified "Finished. The packages have been downloaded" dialog to show correct download path
- Fixed bug which would show "Finished. The packages have been downloaded" dialog even if download failed and nothing had been downloaded.

installpkg.sh:
- Added function to optionally keep installed packages in the download directory.
- Added code to correctly reassemble .pet files after PPM changed them to .tar.gz files

download_file
- Changed PWD variable to dot placeholder to avoid problems with spaces in path name.

Keyword "mochi" will find all my changes and comments.
Attachments
preinstall.png
(30.74 KiB) Downloaded 347 times
ppm_mochi-1.pet
Adds option to choose dl directory and to keep pkgs after install
(27.35 KiB) Downloaded 256 times

Post Reply