diff options
author | johnraff <github@rafflesnagoya.com> | 2020-05-01 11:23:39 +0900 |
---|---|---|
committer | Raphaƫl Hertzog <hertzog@debian.org> | 2020-05-01 09:59:11 +0000 |
commit | 0e5d0483e5596e200430d28356b808af76806439 (patch) | |
tree | 66ea8d81afc59322bedce8c738f32fa737877bd1 /functions/configuration.sh | |
parent | fd18d46e0eb6abfe757f8764c65ac4c472fcdeef (diff) | |
download | vyos-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 'functions/configuration.sh')
-rwxr-xr-x | functions/configuration.sh | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/functions/configuration.sh b/functions/configuration.sh index 4adba4485..2fba5a148 100755 --- a/functions/configuration.sh +++ b/functions/configuration.sh @@ -36,7 +36,7 @@ Prepare_config () LB_SYSTEM="${LB_SYSTEM:-live}" - if [ $(which lsb_release) ] + if command -v lsb_release >/dev/null then local _DISTRIBUTOR _DISTRIBUTOR="$(lsb_release -is | tr "[A-Z]" "[a-z]")" @@ -66,7 +66,7 @@ Prepare_config () LIVE_IMAGE_TYPE="${LB_IMAGE_TYPE}" if [ -z "${LB_ARCHITECTURE}" ]; then - if [ $(which dpkg) ]; then + if command -v dpkg >/dev/null; then LB_ARCHITECTURE="$(dpkg --print-architecture)" else case "$(uname -m)" in @@ -688,7 +688,7 @@ Validate_config_permitted_values () # Check option combinations and other extra stuff Validate_config_dependencies () { - if [ "${LB_BINARY_FILESYSTEM}" = "ntfs" ] && [ ! $(which ntfs-3g) ]; then + if [ "${LB_BINARY_FILESYSTEM}" = "ntfs" ] && ! command -v ntfs-3g >/dev/null; then Echo_error "Using ntfs as the binary filesystem is currently only supported if ntfs-3g is installed on the host system." exit 1 fi |