Results 1 to 8 of 8

Thread: Can zypper ?

  1. #1
    Join Date
    Aug 2010
    Location
    USA
    Posts
    87

    Default Can zypper ?

    In debian based systems once my system was set I'd do something like this to create a list of applications and be able to wipe-install base then reinstall my favorite apps and servers with one command. Is there a way to do this with zypper?

    dpkg --get-selections | grep -v deinstall > installed-packages
    Then, after reinstalling Kubuntu, you can use this list to reinstall those packages:
    Code:
    sudo apt-get update
    sudo apt-get dist-upgrade
    dpkg --set-selections < installed-packages
    sudo dselect

    1) Reinstall base system
    2) Copy necessary files from backup - entire network directory copied back to /etc/, sources.list copied back to etc/apt/
    3) Open network config window and enter encryption key. You now have internet access and the proper source.list to reinstall your packages.
    4) sudo apt-get update
    5) sudo apt-get dist-upgrade
    6) dpkg --set-selections < /media/disk/backup/installed-packages
    7) sudo apt-get install dselect
    8) sudo dselect
    9) When prompted, choose to install packages
    | openSUSE 12.2 Milestone4 32bit | KDE 4.8.3
    | AMD Athlon(tm) XP 3000+ | MSI K7N2 Delta-L | 3GB Black Diamond DDR
    | GeForce 6200@433Mhz 512MB | NVIDIA-Linux-x86-295.49

  2. #2

    Default Re: Can zypper ?

    It's not a complete solution but to get a list of package names you can use the following (note the dashes and the space after %{name})
    Code:
    rpm -qa --qf "%{name} "
    So I think what you want to do is (warning untested, probably wrong, I have never used "dup")
    Code:
    rpm -qa --qf "%{name} " > /media/disk/installed-packages
    sudo zypper dup
    sudo zypper in `cat /media/disk/installed-packages`
    I've done something similar in the past (replace "zypper dup" with "install from dvd").

    You can probably get smarter and get a list of the installed packages after the upgrade and to some shell magic to reduce the list of installed-packages but I think zypper is smart enough just to ignore already installed packages.

  3. #3

    Default Re: Can zypper ?

    There might be several ways to achieve that. Here's one, fast (I guess), untested though :

    Code:
    zypper search -t pattern -i  | awk '/pattern/ { print $3 }' > patternsToInstall.lst
    zypper search -t package -i  | awk '/package/ { print $3 }' | sed '/packages/d' > packagesToInstall.lst
    
    reinstall .....
    
    zypper search -t pattern -i  | awk '/pattern/ { print $3 }' > patternsInstalled.lst
    zypper in -t pattern  `diff patternsInstalled.lst patternsToInstall.lst | awk '/>/ { print $2 }' | tr "\n" " "`
    
    zypper search -t package -i  | awk '/ package/ { print $3 }' | sed '/packages/d' > packagesInstalled.lst
    zypper in  `diff packagesInstalled.lst packagesToInstall.lst | awk '/>/ { print $2 }' | tr "\n" " "`

  4. #4

    Default Re: Can zypper ?

    As I read form the cpackham's post, the last pipe (tr...) should not be necessary.

  5. #5
    Join Date
    Aug 2010
    Location
    USA
    Posts
    87

    Default Re: Can zypper ?

    Thank you both when I get done rebuilding my install I'll give this a try. Not intending to bork it again but its been my proven track record lately. SUSE is teaching me a lot. But a venture onto 11.4 milestone might be irresistible!
    | openSUSE 12.2 Milestone4 32bit | KDE 4.8.3
    | AMD Athlon(tm) XP 3000+ | MSI K7N2 Delta-L | 3GB Black Diamond DDR
    | GeForce 6200@433Mhz 512MB | NVIDIA-Linux-x86-295.49

  6. #6

    Default Re: Can zypper ?

    Quote Originally Posted by cpackham View Post
    It's not a complete solution but to get a list of package names you can use the following (note the dashes and the space after %{name})
    Code:
    rpm -qa --qf "%{name} "
    So I think what you want to do is (warning untested, probably wrong, I have never used "dup")
    Code:
    rpm -qa --qf "%{name} " > /media/disk/installed-packages
    sudo zypper dup
    sudo zypper in `cat /media/disk/installed-packages`
    Hi,

    worked fine for me :-) thanks.

    I use now:

    Code:
    ...
    rpm -qa --qf "%{name}\n"
    ...
    which puts a newline after each line. it's better for the eyes ;-)

    cheers,
    guddl

  7. #7
    Join Date
    Jun 2008
    Location
    Berlin
    Posts
    2,061

    Default Re: Can zypper ?

    Another way (tested):

    Code:
    rpm -qa --queryformat '%{name}\n' | grep -v gpg-pubkey | tr '\n' ' ' > packagelist.txt
    zypper in $(cat packagelist.txt)
    Doesn't create new lines for each package, but I don't see why that is needed. Always worked well for me.

    Edit: Before one reinstalls a system like that, I recommend to run a systemwide update with the default repositories first, then reboot, then activate the repositories used on the old system, then install the remaining packages.

  8. #8
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Can zypper ?

    On 2010-09-04 02:36, sixonetonoffun wrote:
    >
    > In debian based systems once my system was set I'd do something like
    > this to create a list of applications and be able to wipe-install base
    > then reinstall my favorite apps and servers with one command. Is there a
    > way to do this with zypper?


    Not with zypper, but with YaST. It is called autoyast, it is used to replicate installations. It can
    use a configuration file, very configurable. I haven't used it personally, tough.

    There is an option while installing to save an autoyast file precisely for this purpose. I think it
    can do way more than simply installing a list of packages, I think it will do things like
    partitioning and such automatically.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.2 x86_64 "Emerald" at Telcontar)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •