Remove the usage of 'which' (following dib)

diskimage-builder deprecated the usage of which (dib-lint marks its
occurrences as error by default):
https://review.openstack.org/#/c/466063/

Replace all the occurences of 'which' with 'type -p'.
Also, remove the (now useless) installation of which from
the disable-firewalld element.

Change-Id: I00bda062767070e46133cc800e82c9470923f572
This commit is contained in:
Luigi Toscano 2017-07-10 16:10:14 +02:00
parent d0bfaa0fa9
commit 52c39ec6d0
6 changed files with 4 additions and 7 deletions

View File

@ -1 +0,0 @@
package-installs

View File

@ -1,2 +0,0 @@
which:
phase: post-install.d

View File

@ -8,7 +8,7 @@ set -o pipefail
case "${DISTRO_NAME}" in case "${DISTRO_NAME}" in
fedora | centos | centos7 | rhel | rhel7 ) fedora | centos | centos7 | rhel | rhel7 )
if which systemctl && [[ $(systemctl --no-pager list-unit-files firewalld) =~ 'enabled' ]]; then if type -p systemctl && [[ $(systemctl --no-pager list-unit-files firewalld) =~ 'enabled' ]]; then
systemctl disable firewalld systemctl disable firewalld
fi fi
;; ;;

View File

@ -14,7 +14,7 @@ esac
case "${DISTRO_NAME}" in case "${DISTRO_NAME}" in
fedora | centos | rhel | rhel7) fedora | centos | rhel | rhel7)
if which service; then if type -p service; then
service ip6tables save service ip6tables save
chkconfig ip6tables off chkconfig ip6tables off
fi fi

View File

@ -14,7 +14,7 @@ esac
case "${DISTRO_NAME}" in case "${DISTRO_NAME}" in
fedora | centos | rhel | rhel7) fedora | centos | rhel | rhel7)
if which service; then if type -p service; then
service iptables save service iptables save
chkconfig iptables off chkconfig iptables off
fi fi

View File

@ -7,7 +7,7 @@ set -eu
set -o pipefail set -o pipefail
function _get_version_package { function _get_version_package {
if which pbr > /dev/null; then if type -p pbr > /dev/null; then
local version=$(pbr info $1 | awk '{print $2}') local version=$(pbr info $1 | awk '{print $2}')
echo "${version}" echo "${version}"
fi fi