Reputation: 43
Let's say that i want to install specific package from ubuntu repos, but all depends of codename. For example, on ubuntu 14.04 lts there is a package called librabbitmq1, and on ubuntu 16.04 librabbitmq4. Depends on codename i want to choose existing one.
"If ubuntu_codename=trusty install librabbitmq1
else
install librabbitmq4"
or something like this...
"If apt-get install librabbitmq1 returns 1 (or positive) install that, else install librabbitmq4"
Upvotes: 1
Views: 334
Reputation: 85530
A simple one-liner in bash
could do the trick which works on the return-code(s) of the commands executed.
sudo apt-get install librabbitmq1 || echo "librabbitmq1 Installation failed" && sudo apt-get install librabbitmq4 || echo "librabbitmq4 Installation failed"
Upvotes: 2