Score:0

Auto select solution for zypper

cn flag

I need to automate package installation with zypper that requires selecting a solution. How can this be done in non-interactive mode?

# zypper in /tmp/repos-sles15-sp2-current.x86_64.rpm
Loading repository data...
Reading installed packages...
Resolving package dependencies...

Problem: nothing provides sles-release = 15.2 needed by repos-sles15-sp2-x86_64-20210609-1.x86_64
 Solution 1: do not install repos-sles15-sp2-x86_64-20210609-1.x86_64
 Solution 2: break repos-sles15-sp2-x86_64-20210609-1.x86_64 by ignoring some of its dependencies

Choose from above solutions by number or cancel [1/2/c/d/?] (c): c

I need to select option #2. What I've tried:

  1. echo 2 | zypper in /tmp/repos-sles15-sp2-current.x86_64.rpm
  2. yes 2 | zypper in /tmp/repos-sles15-sp2-current.x86_64.rpm
  3. zypper in /tmp/repos-sles15-sp2-current.x86_64.rpm --force -y

Does anyone know a trick that help with selecting option #2?

Michael Hampton avatar
cz flag
Install both packages in the same command line. Be aware that the task you are attempting may damage your system and make it unusable to the point where it must be reinstalled from scratch.
Score:0
in flag

how about --best-effort, this option helped me in the case of one dependency obsoletes the other one when i was updating both of them.

Score:0
in flag

It seems like you're installing a package that was not meant for the version of your operating system. Can't you find the repos*rpm package for your exact version?

Not recommendend, but you could use

rpm -i --nodeps /tmp/repos-sles15-sp2-current.x86_64.rpm

but that ignores all dependencies, also the ones that would have been installed.

Dziki_Jam avatar
cn flag
It worked, thank you very much. :) I bit of off topic: I realize it shouldn't be that way, but it's company-internal stuff, so there's not much I can do. I'm even surprised that the package doesn't break the system, it actually works, the repos get updated, and I can install software from them.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.