How to use zypper in bash scripts for someone coming from apt-get?












9















I have a few questions about moving from apt-get to zypper in bash scripts.



What is the equivalent of this?



sudo apt-get install curl --assume-yes


(where curl could be any package)



I found the Zypper Cheat Sheet - openSUSE. Very nice! But I would appreciate the voice of experience here -- what's the right way to use zypper in a script where I want to auto agree to all prompts and not skip things that need a response?



With my inexperience I would be tempted to use:



sudo zypper --non-interactive --no-gpg-checks --quiet install --auto-agree-with-licenses curl


But is that really the equivalent of --assume-yes?



What about the equivalent for these?



sudo apt-get autoremove -y
sudo apt-get autoclean -y


This suggests there isn't one...



Is there a replacement for gdebi-core? Or is gdebi not ever needed with zypper's "powerful satisfiability solver"? I use gdebi for situations where I need to install a package on an older version and I have a .deb file already (but not all the dependencies).










share|improve this question





























    9















    I have a few questions about moving from apt-get to zypper in bash scripts.



    What is the equivalent of this?



    sudo apt-get install curl --assume-yes


    (where curl could be any package)



    I found the Zypper Cheat Sheet - openSUSE. Very nice! But I would appreciate the voice of experience here -- what's the right way to use zypper in a script where I want to auto agree to all prompts and not skip things that need a response?



    With my inexperience I would be tempted to use:



    sudo zypper --non-interactive --no-gpg-checks --quiet install --auto-agree-with-licenses curl


    But is that really the equivalent of --assume-yes?



    What about the equivalent for these?



    sudo apt-get autoremove -y
    sudo apt-get autoclean -y


    This suggests there isn't one...



    Is there a replacement for gdebi-core? Or is gdebi not ever needed with zypper's "powerful satisfiability solver"? I use gdebi for situations where I need to install a package on an older version and I have a .deb file already (but not all the dependencies).










    share|improve this question



























      9












      9








      9


      4






      I have a few questions about moving from apt-get to zypper in bash scripts.



      What is the equivalent of this?



      sudo apt-get install curl --assume-yes


      (where curl could be any package)



      I found the Zypper Cheat Sheet - openSUSE. Very nice! But I would appreciate the voice of experience here -- what's the right way to use zypper in a script where I want to auto agree to all prompts and not skip things that need a response?



      With my inexperience I would be tempted to use:



      sudo zypper --non-interactive --no-gpg-checks --quiet install --auto-agree-with-licenses curl


      But is that really the equivalent of --assume-yes?



      What about the equivalent for these?



      sudo apt-get autoremove -y
      sudo apt-get autoclean -y


      This suggests there isn't one...



      Is there a replacement for gdebi-core? Or is gdebi not ever needed with zypper's "powerful satisfiability solver"? I use gdebi for situations where I need to install a package on an older version and I have a .deb file already (but not all the dependencies).










      share|improve this question
















      I have a few questions about moving from apt-get to zypper in bash scripts.



      What is the equivalent of this?



      sudo apt-get install curl --assume-yes


      (where curl could be any package)



      I found the Zypper Cheat Sheet - openSUSE. Very nice! But I would appreciate the voice of experience here -- what's the right way to use zypper in a script where I want to auto agree to all prompts and not skip things that need a response?



      With my inexperience I would be tempted to use:



      sudo zypper --non-interactive --no-gpg-checks --quiet install --auto-agree-with-licenses curl


      But is that really the equivalent of --assume-yes?



      What about the equivalent for these?



      sudo apt-get autoremove -y
      sudo apt-get autoclean -y


      This suggests there isn't one...



      Is there a replacement for gdebi-core? Or is gdebi not ever needed with zypper's "powerful satisfiability solver"? I use gdebi for situations where I need to install a package on an older version and I have a .deb file already (but not all the dependencies).







      bash package-management apt opensuse zypper






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 6 '13 at 23:16







      MountainX

















      asked Jul 6 '13 at 19:05









      MountainXMountainX

      5,1412675133




      5,1412675133






















          4 Answers
          4






          active

          oldest

          votes


















          7














          zypper is not very consistent with naming flags for subcommands. For install you should use --non-interactive mode, in shortcut -n:



          zypper -n install curl


          That might be quite confusing for someone coming from apt-get install -y curl. Although zypper's legacy option is -y/--no-confirm (sometimes the only option that actually works).



          According to documentation there's no way how to accept a GPG key without interactive mode:




          a new key can be trusted or imported in the interactive mode only




          Even with --no-gpgp-checks the GPG key will be rejected.



          A workaround for scripts is to use pipe and echo:



          zypper addrepo http://repo.example.org my_name | echo 'a'





          share|improve this answer

































            7














            You have the --non-interactive option. From the man page:



            Switches  to  non-interactive  mode. 
            In this mode zypper doesn't ask user to type answers to various prompts, but uses default answers automatically.
            The behaviour of this option is somewhat different than that of options like '--yes', since zypper can answer different answers to different questions.
            The answers also depend on other options like '--no-gpg-checks'.


            There is no real correspondense to apt-get's autoremove. The closest is the --clean-deps option of the remove command, which cleans dependencies right away (but not afterwards).






            share|improve this answer


























            • is it possible to add such an option in zypper.conf for permanent confirmation as in other package managers?

              – w17t
              Oct 23 '17 at 16:40











            • I don't know. I haven't used suse in a while, so I can't check it.

              – mat
              Oct 26 '17 at 20:57











            • it seems its impossible for zypper unlike pacman, apt, and yum/dnf :-(

              – w17t
              Oct 27 '17 at 15:43



















            1














            That is a sample



            zypper --non-interactive --quiet addrepo --refresh -p 90 http://packman.inode.at/suse/openSUSE_Leap_15.0/ 'packman'
            zypper --gpg-auto-import-keys refresh
            zypper --non-interactive dist-upgrade --allow-vendor-change --from packman
            zypper --non-interactive install vlc vlc-codecs


            Of course you can include more options like --auto-agree-with-licenses but remember that makes difference if its before or after install






            share|improve this answer































              0














              This worked for me (checked on SLES12SP3):



              zypper --non-interactive --quiet ar -C http://myrepo myrepo
              zypper --gpg-auto-import-keys ref


              Note -C/--no-check for zypper ar.



              Now you can install packages:



              zypper in -y --auto-agree-with-licenses vim





              share|improve this answer








              New contributor




              amaslenn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.




















                Your Answer








                StackExchange.ready(function() {
                var channelOptions = {
                tags: "".split(" "),
                id: "106"
                };
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function() {
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled) {
                StackExchange.using("snippets", function() {
                createEditor();
                });
                }
                else {
                createEditor();
                }
                });

                function createEditor() {
                StackExchange.prepareEditor({
                heartbeatType: 'answer',
                autoActivateHeartbeat: false,
                convertImagesToLinks: false,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: null,
                bindNavPrevention: true,
                postfix: "",
                imageUploader: {
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                },
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                });


                }
                });














                draft saved

                draft discarded


















                StackExchange.ready(
                function () {
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f82016%2fhow-to-use-zypper-in-bash-scripts-for-someone-coming-from-apt-get%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                4 Answers
                4






                active

                oldest

                votes








                4 Answers
                4






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                7














                zypper is not very consistent with naming flags for subcommands. For install you should use --non-interactive mode, in shortcut -n:



                zypper -n install curl


                That might be quite confusing for someone coming from apt-get install -y curl. Although zypper's legacy option is -y/--no-confirm (sometimes the only option that actually works).



                According to documentation there's no way how to accept a GPG key without interactive mode:




                a new key can be trusted or imported in the interactive mode only




                Even with --no-gpgp-checks the GPG key will be rejected.



                A workaround for scripts is to use pipe and echo:



                zypper addrepo http://repo.example.org my_name | echo 'a'





                share|improve this answer






























                  7














                  zypper is not very consistent with naming flags for subcommands. For install you should use --non-interactive mode, in shortcut -n:



                  zypper -n install curl


                  That might be quite confusing for someone coming from apt-get install -y curl. Although zypper's legacy option is -y/--no-confirm (sometimes the only option that actually works).



                  According to documentation there's no way how to accept a GPG key without interactive mode:




                  a new key can be trusted or imported in the interactive mode only




                  Even with --no-gpgp-checks the GPG key will be rejected.



                  A workaround for scripts is to use pipe and echo:



                  zypper addrepo http://repo.example.org my_name | echo 'a'





                  share|improve this answer




























                    7












                    7








                    7







                    zypper is not very consistent with naming flags for subcommands. For install you should use --non-interactive mode, in shortcut -n:



                    zypper -n install curl


                    That might be quite confusing for someone coming from apt-get install -y curl. Although zypper's legacy option is -y/--no-confirm (sometimes the only option that actually works).



                    According to documentation there's no way how to accept a GPG key without interactive mode:




                    a new key can be trusted or imported in the interactive mode only




                    Even with --no-gpgp-checks the GPG key will be rejected.



                    A workaround for scripts is to use pipe and echo:



                    zypper addrepo http://repo.example.org my_name | echo 'a'





                    share|improve this answer















                    zypper is not very consistent with naming flags for subcommands. For install you should use --non-interactive mode, in shortcut -n:



                    zypper -n install curl


                    That might be quite confusing for someone coming from apt-get install -y curl. Although zypper's legacy option is -y/--no-confirm (sometimes the only option that actually works).



                    According to documentation there's no way how to accept a GPG key without interactive mode:




                    a new key can be trusted or imported in the interactive mode only




                    Even with --no-gpgp-checks the GPG key will be rejected.



                    A workaround for scripts is to use pipe and echo:



                    zypper addrepo http://repo.example.org my_name | echo 'a'






                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Feb 14 '17 at 19:39









                    Brock

                    31




                    31










                    answered Jan 18 '17 at 12:51









                    TombartTombart

                    90021626




                    90021626

























                        7














                        You have the --non-interactive option. From the man page:



                        Switches  to  non-interactive  mode. 
                        In this mode zypper doesn't ask user to type answers to various prompts, but uses default answers automatically.
                        The behaviour of this option is somewhat different than that of options like '--yes', since zypper can answer different answers to different questions.
                        The answers also depend on other options like '--no-gpg-checks'.


                        There is no real correspondense to apt-get's autoremove. The closest is the --clean-deps option of the remove command, which cleans dependencies right away (but not afterwards).






                        share|improve this answer


























                        • is it possible to add such an option in zypper.conf for permanent confirmation as in other package managers?

                          – w17t
                          Oct 23 '17 at 16:40











                        • I don't know. I haven't used suse in a while, so I can't check it.

                          – mat
                          Oct 26 '17 at 20:57











                        • it seems its impossible for zypper unlike pacman, apt, and yum/dnf :-(

                          – w17t
                          Oct 27 '17 at 15:43
















                        7














                        You have the --non-interactive option. From the man page:



                        Switches  to  non-interactive  mode. 
                        In this mode zypper doesn't ask user to type answers to various prompts, but uses default answers automatically.
                        The behaviour of this option is somewhat different than that of options like '--yes', since zypper can answer different answers to different questions.
                        The answers also depend on other options like '--no-gpg-checks'.


                        There is no real correspondense to apt-get's autoremove. The closest is the --clean-deps option of the remove command, which cleans dependencies right away (but not afterwards).






                        share|improve this answer


























                        • is it possible to add such an option in zypper.conf for permanent confirmation as in other package managers?

                          – w17t
                          Oct 23 '17 at 16:40











                        • I don't know. I haven't used suse in a while, so I can't check it.

                          – mat
                          Oct 26 '17 at 20:57











                        • it seems its impossible for zypper unlike pacman, apt, and yum/dnf :-(

                          – w17t
                          Oct 27 '17 at 15:43














                        7












                        7








                        7







                        You have the --non-interactive option. From the man page:



                        Switches  to  non-interactive  mode. 
                        In this mode zypper doesn't ask user to type answers to various prompts, but uses default answers automatically.
                        The behaviour of this option is somewhat different than that of options like '--yes', since zypper can answer different answers to different questions.
                        The answers also depend on other options like '--no-gpg-checks'.


                        There is no real correspondense to apt-get's autoremove. The closest is the --clean-deps option of the remove command, which cleans dependencies right away (but not afterwards).






                        share|improve this answer















                        You have the --non-interactive option. From the man page:



                        Switches  to  non-interactive  mode. 
                        In this mode zypper doesn't ask user to type answers to various prompts, but uses default answers automatically.
                        The behaviour of this option is somewhat different than that of options like '--yes', since zypper can answer different answers to different questions.
                        The answers also depend on other options like '--no-gpg-checks'.


                        There is no real correspondense to apt-get's autoremove. The closest is the --clean-deps option of the remove command, which cleans dependencies right away (but not afterwards).







                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Apr 21 '15 at 7:11

























                        answered Jul 9 '13 at 13:59









                        matmat

                        21818




                        21818













                        • is it possible to add such an option in zypper.conf for permanent confirmation as in other package managers?

                          – w17t
                          Oct 23 '17 at 16:40











                        • I don't know. I haven't used suse in a while, so I can't check it.

                          – mat
                          Oct 26 '17 at 20:57











                        • it seems its impossible for zypper unlike pacman, apt, and yum/dnf :-(

                          – w17t
                          Oct 27 '17 at 15:43



















                        • is it possible to add such an option in zypper.conf for permanent confirmation as in other package managers?

                          – w17t
                          Oct 23 '17 at 16:40











                        • I don't know. I haven't used suse in a while, so I can't check it.

                          – mat
                          Oct 26 '17 at 20:57











                        • it seems its impossible for zypper unlike pacman, apt, and yum/dnf :-(

                          – w17t
                          Oct 27 '17 at 15:43

















                        is it possible to add such an option in zypper.conf for permanent confirmation as in other package managers?

                        – w17t
                        Oct 23 '17 at 16:40





                        is it possible to add such an option in zypper.conf for permanent confirmation as in other package managers?

                        – w17t
                        Oct 23 '17 at 16:40













                        I don't know. I haven't used suse in a while, so I can't check it.

                        – mat
                        Oct 26 '17 at 20:57





                        I don't know. I haven't used suse in a while, so I can't check it.

                        – mat
                        Oct 26 '17 at 20:57













                        it seems its impossible for zypper unlike pacman, apt, and yum/dnf :-(

                        – w17t
                        Oct 27 '17 at 15:43





                        it seems its impossible for zypper unlike pacman, apt, and yum/dnf :-(

                        – w17t
                        Oct 27 '17 at 15:43











                        1














                        That is a sample



                        zypper --non-interactive --quiet addrepo --refresh -p 90 http://packman.inode.at/suse/openSUSE_Leap_15.0/ 'packman'
                        zypper --gpg-auto-import-keys refresh
                        zypper --non-interactive dist-upgrade --allow-vendor-change --from packman
                        zypper --non-interactive install vlc vlc-codecs


                        Of course you can include more options like --auto-agree-with-licenses but remember that makes difference if its before or after install






                        share|improve this answer




























                          1














                          That is a sample



                          zypper --non-interactive --quiet addrepo --refresh -p 90 http://packman.inode.at/suse/openSUSE_Leap_15.0/ 'packman'
                          zypper --gpg-auto-import-keys refresh
                          zypper --non-interactive dist-upgrade --allow-vendor-change --from packman
                          zypper --non-interactive install vlc vlc-codecs


                          Of course you can include more options like --auto-agree-with-licenses but remember that makes difference if its before or after install






                          share|improve this answer


























                            1












                            1








                            1







                            That is a sample



                            zypper --non-interactive --quiet addrepo --refresh -p 90 http://packman.inode.at/suse/openSUSE_Leap_15.0/ 'packman'
                            zypper --gpg-auto-import-keys refresh
                            zypper --non-interactive dist-upgrade --allow-vendor-change --from packman
                            zypper --non-interactive install vlc vlc-codecs


                            Of course you can include more options like --auto-agree-with-licenses but remember that makes difference if its before or after install






                            share|improve this answer













                            That is a sample



                            zypper --non-interactive --quiet addrepo --refresh -p 90 http://packman.inode.at/suse/openSUSE_Leap_15.0/ 'packman'
                            zypper --gpg-auto-import-keys refresh
                            zypper --non-interactive dist-upgrade --allow-vendor-change --from packman
                            zypper --non-interactive install vlc vlc-codecs


                            Of course you can include more options like --auto-agree-with-licenses but remember that makes difference if its before or after install







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Apr 16 '18 at 23:42









                            Marcelo AtieMarcelo Atie

                            111




                            111























                                0














                                This worked for me (checked on SLES12SP3):



                                zypper --non-interactive --quiet ar -C http://myrepo myrepo
                                zypper --gpg-auto-import-keys ref


                                Note -C/--no-check for zypper ar.



                                Now you can install packages:



                                zypper in -y --auto-agree-with-licenses vim





                                share|improve this answer








                                New contributor




                                amaslenn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                Check out our Code of Conduct.

























                                  0














                                  This worked for me (checked on SLES12SP3):



                                  zypper --non-interactive --quiet ar -C http://myrepo myrepo
                                  zypper --gpg-auto-import-keys ref


                                  Note -C/--no-check for zypper ar.



                                  Now you can install packages:



                                  zypper in -y --auto-agree-with-licenses vim





                                  share|improve this answer








                                  New contributor




                                  amaslenn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                  Check out our Code of Conduct.























                                    0












                                    0








                                    0







                                    This worked for me (checked on SLES12SP3):



                                    zypper --non-interactive --quiet ar -C http://myrepo myrepo
                                    zypper --gpg-auto-import-keys ref


                                    Note -C/--no-check for zypper ar.



                                    Now you can install packages:



                                    zypper in -y --auto-agree-with-licenses vim





                                    share|improve this answer








                                    New contributor




                                    amaslenn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.










                                    This worked for me (checked on SLES12SP3):



                                    zypper --non-interactive --quiet ar -C http://myrepo myrepo
                                    zypper --gpg-auto-import-keys ref


                                    Note -C/--no-check for zypper ar.



                                    Now you can install packages:



                                    zypper in -y --auto-agree-with-licenses vim






                                    share|improve this answer








                                    New contributor




                                    amaslenn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.









                                    share|improve this answer



                                    share|improve this answer






                                    New contributor




                                    amaslenn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.









                                    answered 19 mins ago









                                    amaslennamaslenn

                                    1012




                                    1012




                                    New contributor




                                    amaslenn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.





                                    New contributor





                                    amaslenn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.






                                    amaslenn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.






























                                        draft saved

                                        draft discarded




















































                                        Thanks for contributing an answer to Unix & Linux Stack Exchange!


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid



                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.


                                        To learn more, see our tips on writing great answers.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function () {
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f82016%2fhow-to-use-zypper-in-bash-scripts-for-someone-coming-from-apt-get%23new-answer', 'question_page');
                                        }
                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        Popular posts from this blog

                                        Accessing regular linux commands in Huawei's Dopra Linux

                                        Can't connect RFCOMM socket: Host is down

                                        Kernel panic - not syncing: Fatal Exception in Interrupt