summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorjohnraff <github@rafflesnagoya.com>2020-05-01 11:23:39 +0900
committerRaphaƫl Hertzog <hertzog@debian.org>2020-05-01 09:59:11 +0000
commit0e5d0483e5596e200430d28356b808af76806439 (patch)
tree66ea8d81afc59322bedce8c738f32fa737877bd1 /scripts
parentfd18d46e0eb6abfe757f8764c65ac4c472fcdeef (diff)
downloadvyos-live-build-0e5d0483e5596e200430d28356b808af76806439.tar.gz
vyos-live-build-0e5d0483e5596e200430d28356b808af76806439.zip
Replace 'which' with 'command -v' to test for the existance of an executable
This is considered to be more robust. Two instances remain: scripts/build/chroot_archives, line 257: if [ "${LB_APT}" = "aptitude" ] && [ ! $(Chroot chroot "which aptitude") ] The command is run inside a chroot where the environment might be special, and would need further testing. manpages/Makefile, line 42: @if [ ! -x "$$(which po4a 2>/dev/null)" ]; \ I am insufficiently familiar with makefile syntax to edit this.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build/bootstrap_debootstrap2
-rwxr-xr-xscripts/build/chroot_archives2
-rwxr-xr-xscripts/build/config2
3 files changed, 3 insertions, 3 deletions
diff --git a/scripts/build/bootstrap_debootstrap b/scripts/build/bootstrap_debootstrap
index c438b8459..e2266b712 100755
--- a/scripts/build/bootstrap_debootstrap
+++ b/scripts/build/bootstrap_debootstrap
@@ -21,7 +21,7 @@ USAGE="${PROGRAM} [--force]"
# Processing arguments and configuration files
Init_config_data "${@}"
-if [ ! $(which debootstrap) ]
+if ! command -v debootstrap >/dev/null
then
Echo_error "debootstrap - command not found"
Echo_verbose "debootstrap can be obtained from http://ftp.debian.org/debian/pool/main/d/debootstrap/"
diff --git a/scripts/build/chroot_archives b/scripts/build/chroot_archives
index e170d5be0..7dc7b32fb 100755
--- a/scripts/build/chroot_archives
+++ b/scripts/build/chroot_archives
@@ -236,7 +236,7 @@ case "${_ACTION}" in
cp -f cache/indices.bootstrap/*Release* chroot/var/lib/apt/lists
fi
- if [ "${LB_APT}" = "aptitude" ] && [ ! $(which aptitude) ]
+ if [ "${LB_APT}" = "aptitude" ] && ! command -v aptitude >/dev/null
then
Chroot chroot "apt-get ${APT_OPTIONS} update"
Chroot chroot "apt-get ${APT_OPTIONS} install aptitude"
diff --git a/scripts/build/config b/scripts/build/config
index b511d79ae..318a2cc8c 100755
--- a/scripts/build/config
+++ b/scripts/build/config
@@ -212,7 +212,7 @@ Local_arguments ()
--dump)
# Dump version
Echo "This is live-build version %s" "${VERSION}"
- if [ $(which dpkg-query) ]; then
+ if command -v dpkg-query >/dev/null; then
Echo "Installed version reported by dpkg is %s" "$(dpkg-query -f='${Version}' --show live-build)"
fi