LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-17-2015, 04:27 PM   #1
GeoWest
LQ Newbie
 
Registered: Jul 2015
Posts: 6

Rep: Reputation: Disabled
Help building a zypper command


Running OpenSuse 13.2_64

I need help writing a zypper command that will download, but not install, every package currently installed in the system and save those RPMs to a local directory.

There must be a way to do it. I can't figure it out.

Last edited by GeoWest; 07-17-2015 at 04:29 PM.
 
Old 07-17-2015, 05:55 PM   #2
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,803

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
Typing
Code:
zypper in --help
gives the options

The following option will do what you want
Code:
zypper in --download-only <package-foo>
 
Old 07-17-2015, 06:21 PM   #3
GeoWest
LQ Newbie
 
Registered: Jul 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ferrari View Post
Typing
Code:
zypper in --help
gives the options

The following option will do what you want
Code:
zypper in --download-only <package-foo>
I got that part. This command does not identify the packages to download as "all packages presently installed". That is where I'm having trouble.
 
Old 07-17-2015, 07:16 PM   #4
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,803

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
Quote:
This command does not identify the packages to download as "all packages presently installed". That is where I'm having trouble.
I'm still not sure that I completely understand you, and you may need to read the zypper man page.

The RPM database can be queried for all installed packages
Code:
zypper -qa
Show most recent first
Code:
rpm -qa --less
or
Code:
rpm -qa --less|more
Use zypper to check what is installed
Code:
zypper pa -i
 
Old 07-17-2015, 07:26 PM   #5
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,803

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
Going forward it is easy to configure zypper to keep downloaded packages. Downloaded packages are temporarily cached in /var/cache/zypp/packages, before being installed. If you want to keep them it is necessary to edit each .repo on /etc/zypp/repos.d and set
Code:
keeppackages=1
 
Old 07-17-2015, 07:30 PM   #6
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,803

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
Quote:
I need help writing a zypper command that will download, but not install, every package currently installed in the system and save those RPMs to a local directory.
Going back to your original request, you should be able to capture the rpm list in a text file and write a small script to download all the packages from that list.

This might be of interest to you as well
http://jason.ferrer.com.ph/2012/03/k...s-locally.html
 
Old 07-17-2015, 07:51 PM   #7
GeoWest
LQ Newbie
 
Registered: Jul 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
I'm beginning to think that zypper can't do what I want. Think of it this way: Say I want a private repository on my local drive that consists ONLY of EVERY RPM installed on that machine. I don't want to install anything. I just want to download and save all those RPMs, perhaps over a thousand of them. I want a zypper command that, upon completion, produces a local directory that contains all those RPMs from a variety of repos. (the repo of origin for installed packages is known to zypper)

Another way to think of it:
I want to query for the package names of every installed package, then download them all to a local directory, from whatever repo they came from, and without ever installing or reinstalling anything.

Zypper can query the system and produce a list of all installed packages. But I can't get zypper to use that query output to determine what to download with "zypper in --download-only". I can provide qualifiers like xyz* and it will download and save matching RPMs. Instead of xyz*, there seems to be no way to tell zypper "all packages currently installed". There is no option for that and I can't figure out any alternative method.
 
Old 07-17-2015, 07:56 PM   #8
GeoWest
LQ Newbie
 
Registered: Jul 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ferrari View Post
Going forward it is easy to configure zypper to keep downloaded packages. Downloaded packages are temporarily cached in /var/cache/zypp/packages, before being installed. If you want to keep them it is necessary to edit each .repo on /etc/zypp/repos.d and set
Code:
keeppackages=1
But I think this will only capture updates and new packages after the original install.

What I'm looking to do was possible in Gnome long before zypper.
 
Old 07-17-2015, 08:19 PM   #9
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,803

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
Quote:
Zypper can query the system and produce a list of all installed packages. But I can't get zypper to use that query output to determine what to download with "zypper in --download-only". I can provide qualifiers like xyz* and it will download and save matching RPMs. Instead of xyz*, there seems to be no way to tell zypper "all packages currently installed". There is no option for that and I can't figure out any alternative method.
It can be done in a couple of steps which is acceptable (or you can roll it up into a simple script).

Step 1: Get list of installed packages
Code:
rpm -qa > packagelist
Step 2: Download the packages
Code:
zypper in -f -D `cat packagelist`
That work for you?
 
Old 07-17-2015, 08:35 PM   #10
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,803

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
Sorry, the -D option is for dry-run, use -d for download only...
Code:
 zypper in -d -f `cat packagelist`
 
Old 07-17-2015, 09:03 PM   #11
GeoWest
LQ Newbie
 
Registered: Jul 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Modified it a bit and it looks promising with a few needed tweaks.

zypper in -f -D -d $(cat packagelist)

Thanks
 
Old 07-17-2015, 09:08 PM   #12
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,803

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
Just remember -D (--dry-run) is only for testing. You'll need to remove it for real action.
 
Old 07-17-2015, 09:13 PM   #13
GeoWest
LQ Newbie
 
Registered: Jul 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ferrari View Post
Just remember -D (--dry-run) is only for testing. You'll need to remove it for real action.
I think --dry-run is only "dry" with respect to actual installation. It seems to mean nothing to --download-only. The files come in.
 
Old 07-17-2015, 10:16 PM   #14
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,803

Rep: Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140Reputation: 1140
Quote:
I think --dry-run is only "dry" with respect to actual installation. It seems to mean nothing to --download-only. The files come in.
I haven't used the --dry-run option in a long time. I guess if the -download-only option is invoked the -dry-run option is irrelevant anyway.

Code:
      -D, --dry-run
              Test the installation, do not actually install any package. This option will add the  --test
              option to the rpm commands run by the install command.

       Download-and-install mode options:

       -d, --download-only
              Only download the packages for later installation.

           --download-in-advance
              First download all packages, then start installing.

           --download-in-heaps
              (Not  yet implemented, currently the same as --download-in-advance).  Download a minimal set
              of packages that can be installed without leaving the system in broken  state,  and  install
              them. Then download and install another heap until all are installed. This helps to keep the
              system in consistent state without the need to download all package in advance,  which  com-
              bines the advantages of --download-in-advance and --download-as-needed.  This is the default
              mode.

           --download-as-needed
              Download one package, install it immediately, and continue  with  the  rest  until  all  are
              installed.

           --download <mode>
              Use  the  specified  download-and-install  mode.  Available modes are: only, in-advance, in-
              heaps, as-needed.  See corresponding --download-<mode> options for their description.
I guess this is solved now? If so, mark it as such.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: SUSE Linux - Zypper Command Examples LXer Syndicated Linux News 0 10-23-2014 12:10 AM
yacc is not a command.. error while building bash thegreatstudio Linux From Scratch 4 08-22-2014 05:17 AM
Zypper ; add/use options that rpm command has? theKbStockpiler SUSE / openSUSE 7 08-17-2014 10:24 PM
Building the Tree command rsaltivan Programming 2 09-17-2005 10:39 PM
I need help with a command value for building the MPlayer Plug-in for Mozilla... Ausar Linux - Newbie 2 08-01-2004 09:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration