Mailinglist Archive: opensuse (621 mails)

< Previous Next >
Re: [opensuse] save installed packages for reinstall
On 09/06/2019 10.43, Per Jessen wrote:
Patrick Shanahan wrote:

I am considering wiping my main system drive and reinstalling Tw clean
but would like to have the same packages on the new system. I will
backup home and replace the new home contents with the backedup data.

is this feasible?

how to save the currently installed pkgs for reinstall?

You can save a list - YaST->Software Managment->Extras->Export package
list. (I presume there is a zypper incantation too). It can be
imported during installation.
Unfortunately the list does not include banned packages which make it
slightly less useful, but ignoring that, it's very useful.

This will generate a list of installed packages from a particular repository:

cer@Telcontar:~> zypper --no-refresh se -s -i -r OBS_Emulators_Wine
Loading repository data...
Reading installed packages...

S | Name | Type | Version | Arch | Repository
i | libFAudio0-32bit | package | 19.03-lp150.1.1 | x86_64 | OBS:
Emulators: Wine
i+ | wine | package | 4.9-lp150.1004.2 | x86_64 | OBS:
Emulators: Wine
i+ | wine-32bit | package | 4.9-lp150.1004.2 | x86_64 | OBS:
Emulators: Wine
i+ | wine-gecko | package | 2.47-lp150.55.1 | noarch | OBS:
Emulators: Wine
i+ | wine-mono | package | 4.7.1-lp150.1.1 | noarch | OBS:
Emulators: Wine
i+ | winetricks | package | 20190310-lp150.14.2 | x86_64 | OBS:
Emulators: Wine

Same with comma separated list:

cer@Telcontar:~> zypper --no-refresh se -s -i -r OBS_Emulators_Wine | sed 's/
*| */,/g'
Loading repository data...
Reading installed packages...

i,libFAudio0-32bit,package,19.03-lp150.1.1,x86_64,OBS: Emulators: Wine
i+,wine,package,4.9-lp150.1004.2,x86_64,OBS: Emulators: Wine
i+,wine-32bit,package,4.9-lp150.1004.2,x86_64,OBS: Emulators: Wine
i+,wine-gecko,package,2.47-lp150.55.1,noarch,OBS: Emulators: Wine
i+,wine-mono,package,4.7.1-lp150.1.1,noarch,OBS: Emulators: Wine
i+,winetricks,package,20190310-lp150.14.2,x86_64,OBS: Emulators: Wine

From this we could separate the package list using "cut -d"," -f2", and then
repeat for each repository we have defined:

for REPOS in repo1 repo2 repo3
zypper --no-refresh se -s -i -r $REPOS > $REPOS.raw.packagelist
cat $REPOS.raw.packagelist | sed 's/ *| */,/g' | cut -d"," -f2 >

Another zypper command could install that list (modifying the one from David):

zypper in $(awk -vORS=" " '{print}' installed_pkgs.txt) --repo

or another "for" to repeat for each repo.

There is a doubt about whether the command line buffer will take the entire
package list, I think there is a limit (64K?). Can a zypper take input from a
file directly?

All that untested.

Cheers / Saludos,

Carlos E. R.
(from 15.0 x86_64 at Telcontar)

< Previous Next >
Follow Ups