3

When I add a repository using zypper:

zypper ar <url> name

then I have to do

zypper lr

check the number of the repository and enable autorefresh:

zypper mr -r 2

Can't I do all this in one line?

Chris Maes
  • 35,025
  • 12
  • 111
  • 136
  • You can execute `zypper ar name && zypper lr && zypper mr -r 2`. With `&&`, none of the commands will be executed if the previous did not execute properly. – fedorqui Mar 17 '14 at 14:32
  • yes but the number of the repository is not fixed (not always 2) – Chris Maes Mar 17 '14 at 14:33
  • But what do you exactly want? To create an alias or function for that? If so, you can define it so that it accepts some parameters. – fedorqui Mar 17 '14 at 14:34

1 Answers1

4

after looking around on the internet for a while I found the -f option:

zypper ar -f <url> name

this enables autorefresh automatically. I am wondering why autorefresh is off by default!

Chris Maes
  • 35,025
  • 12
  • 111
  • 136
  • 2
    You don't need to wonder. Just consider a case when the user might need to add several repos, then will need to refresh. This will save some time in case the repos metadata is really large. So just for flexibility its worth to keep auto-refresh off. – deimus Mar 17 '14 at 14:56