If /usr/bin/which is not available, the current code
doesn't detect i.e. /usr/bin/zypper . Using "command -v" solved
the problem.
Change-Id: I1c281c3184d69cd9dc2418295b6a392d8e5693e0
| ... | ... |
@@ -312,20 +312,20 @@ declare os_VENDOR os_RELEASE os_PACKAGE os_CODENAME |
| 312 | 312 |
# user if not available. Note can't use generic install_package* |
| 313 | 313 |
# because they depend on this! |
| 314 | 314 |
function _ensure_lsb_release {
|
| 315 |
- if [[ -x $(which lsb_release 2>/dev/null) ]]; then |
|
| 315 |
+ if [[ -x $(command -v lsb_release 2>/dev/null) ]]; then |
|
| 316 | 316 |
return |
| 317 | 317 |
fi |
| 318 | 318 |
|
| 319 |
- if [[ -x $(which apt-get 2>/dev/null) ]]; then |
|
| 319 |
+ if [[ -x $(command -v apt-get 2>/dev/null) ]]; then |
|
| 320 | 320 |
sudo apt-get install -y lsb-release |
| 321 |
- elif [[ -x $(which zypper 2>/dev/null) ]]; then |
|
| 321 |
+ elif [[ -x $(command -v zypper 2>/dev/null) ]]; then |
|
| 322 | 322 |
# XXX: old code paths seem to have assumed SUSE platforms also |
| 323 | 323 |
# had "yum". Keep this ordered above yum so we don't try to |
| 324 | 324 |
# install the rh package. suse calls it just "lsb" |
| 325 | 325 |
sudo zypper -n install lsb |
| 326 |
- elif [[ -x $(which dnf 2>/dev/null) ]]; then |
|
| 326 |
+ elif [[ -x $(command -v dnf 2>/dev/null) ]]; then |
|
| 327 | 327 |
sudo dnf install -y redhat-lsb-core |
| 328 |
- elif [[ -x $(which yum 2>/dev/null) ]]; then |
|
| 328 |
+ elif [[ -x $(command -v yum 2>/dev/null) ]]; then |
|
| 329 | 329 |
# all rh patforms (fedora, centos, rhel) have this pkg |
| 330 | 330 |
sudo yum install -y redhat-lsb-core |
| 331 | 331 |
else |