0

I want to port my installed packages on a SLES SP1 System to another SLES System without an internet connection. So I got the idea to use

rpmrebuild packagename

to pack all installed packages back into rpms and then copy those to the other machine.

So I am searching for a way to loop through the names of all installed packages.

Brandon Minnick
  • 13,342
  • 15
  • 65
  • 123
Gring
  • 318
  • 3
  • 19
  • 1
    post your code is a start of getting help. Now the possible answer can be too broadly answered. – ZF007 Jan 17 '18 at 10:08
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww Jan 17 '18 at 12:17

1 Answers1

1

If I understood your question correctly, you can always loop through the list of installed packages on any system having RPM package manager by using below shell script -

#!/bin/bash 

while read -r package; do echo "This package is $package"; done < <(rpm -qa)

Output -

This package is ethtool-3.15-2.27.amzn1.x86_64
This package is libXau-1.0.6-4.9.amzn1.x86_64
This package is libXcomposite-0.4.3-4.6.amzn1.x86_64
This package is libblkid-2.23.2-33.28.amzn1.x86_64
....................................................
vivekyad4v
  • 13,321
  • 4
  • 55
  • 63