How to install patterns and packages at the same time?
Solution 1
edit: appending <resolveabletype>:
to the resolvable allows you to match different types in one command it seems.
zypper in java-1_6_0-openjdk-devel mercurial +pattern:devel_C_C++ +pattern:devel_java
creating a one-click install will let you do package resolution in one go, but i am unsure if a pattern can be called from within one. http://en.opensuse.org/openSUSE:One_Click_Install_ISV#Create_a_web_install_link you could then call it with oci /sbin/OCICLI /path/to/foobar.ymp
Solution 2
Simplest solution:
sudo zypper install -t pattern "devel_C_C++" "devel_java" && sudo zypper install java-1_6_0-openjdk-devel mercurial
If you're worried that sudo
will time out after 5 minutes and you don't want the user to have to type their password twice, you could do
sudo sh -c 'zypper install -t pattern "devel_C_C++" "devel_java" && zypper install java-1_6_0-openjdk-devel mercurial'
UPDATE
Since it sounds like you wanted it all to be a single call to zypper install
, a few more ideas:
- run
zypper search
orzypper list
twice, parse the package names, combine the output, and runzipper install
once with a full list of packages - run
zypper install --dry-run
to print the output, then ask the user to confirm, then runzypper install
without the dry-run option if the user answers yes - run
zypper install --download-only
twice with a custom packages dir, then runzypper install <that directory>/*.rpm
(seemktemp -d
and thepackagesdir
option inzypp.conf
Related videos on Youtube
Comments
-
gatoatigrado over 1 year
How can I install package patterns (e.g. "C/C++ development tools") and packages (e.g. "mercurial") at the same time? Currently, two commands are necessary; for example, the installation instructions I wrote for
sketch-frontend
are,sudo zypper install -t pattern "devel_C_C++" "devel_java" sudo zypper install java-1_6_0-openjdk-devel mercurial
[ link ].
(motivation). It's true one only needs two commands, but on machines with slower internet connections (or slower processors), not having the second command automatically continue is annoying. Also, the user does need to be prompted for package resolution, so just adding the
--non-interactive
flag is not an option.Thanks!
-
Mikel almost 12 yearsLooks good. Had to look up the syntax of
zypper
to see that in this casesh
meanszypper shell
andin
meanszypper install
. -
gatoatigrado almost 12 yearsThe idea was to have
zypper
prompt for resolutions all in one go. The problem with your solution is that after the first command will finish, it will hang waiting for user input. (which, supposing the user has switched tasks since downloading may take time, is bad.) -
Mikel almost 12 yearsIs it possible to parse the output of the
info
orsearch
subcommands? Or use the--dry-run
option to print what would happen, then ask the user to pressY
orN
, and then re-run the same command without the--dry-run
option? -
gatoatigrado almost 12 yearsIt's not just "yes or no", in some cases the user needs to select a resolution option (Zypper prints out 3 choices, e.g. "do not install X", "downgrade Y", "uninstall Z"). Don't spend too much time on it if
llua
's answer works (I'll test it soon), thanks anyway! -
llua almost 12 years#3 looks like it'll would work and will get package solution in one run, but it would be two commands again. @gatoatigrado i don't think you will be able to get this in 'one command' & 'one package resolution' without more work on your end. ie one-click install.
-
llua almost 12 yearsbut it is always possible just list whats in each pattern and add the packages to one huge
zypper install ...
-
llua almost 12 yearsthe answer wasn't documented in zypper's man page for some weird reason.