I’ve been thinking about moving to the upcoming version 12.3, and think I’d like to do a clean install this time, rather than a distribution upgrade.
My question is this: is there a way to make a list of all the packages I’ve got installed on my system, do the clean install, then feed the list back into zypper to reinstall the missing ones? One can do the equivalent with a Debian-based distro, but I don’t know if you can do it with openSUSE or not.
Yes
You can do this in Yast Software Management
I never tried it though. Well, I have save the list. But to me it looks version specific. But on import it may well overlook that.
Remember too, it’s often some time before some packages are available for a new release. I’m talking stuff like in Packman…
you can probably save an existing list by running this and use it for future reference
zypper se -i -s -t package >install.txt
se- search
-i -installed
-s -details
-t type
If you can write and script and separate packages alone and give a single line space between them then you can very well install all of them in a single shot using zypper proded you have configured all the required repos.
I’ve played a little around with zypper/rpm/bash and searched the internet. Now I’ve found my personal solution for the topic.
I’ll write it in short form, maybe later a little bit more detailed infos. Code is ugly with many piped grep commands, but it works. Suggestions for smarter code and maybe a shell script are welcome.
All commands can be done as $USER, expect final zypper command of course.
Write all installed rpm packages to RPM-Packagelist.txt
Compare RPM-Packagelist.txt to zypperlog.txt and write it to packages.txt. /var/log/zypp/history does not delete install lines when a package is removed. So we must compare the installed packages with the ones from zypperlog.txt because it will list packages you do not want anymore.
comm -13 RPM-Packagelist.txt zypperlog.txt > packages.txt
Install the packages listed in packages.txt (as root)
zypper in `cat packages.txt`
If you have packages installed from a local repo take care that the RPMs (including possible dependencies) are stored in the local repository (here /root/RPMS).
ls /root/RPMS > local-rpms.txt
Note: It may be possible that some packages are renamed after some time or are removed from a repo. Have a look at zypper output.