From adb0a18fa4beac2f97a9d64ee6f9276e80561aee Mon Sep 17 00:00:00 2001 From: babaric-dev <104625126+babaric-dev@users.noreply.github.com> Date: Tue, 7 Feb 2023 15:39:04 +0800 Subject: [PATCH] Add fallback for `COMPLETIONSDIR` if `pkg-config` fails --- server/src/get-options.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/get-options.sh b/server/src/get-options.sh index 0bb6a005d..0aeef00b2 100755 --- a/server/src/get-options.sh +++ b/server/src/get-options.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash -COMPLETIONSDIR="$(pkg-config --variable=completionsdir bash-completion)" +COMPLETIONSDIR="$(pkg-config --variable=completionsdir bash-completion || echo "${PREFIX:-/usr}/share/bash-completion/completions")" DATADIR="$(dirname "$(dirname "${COMPLETIONSDIR}")")" -# Exit if bash-completion isn't installed. -if (( $? != 0 )) +# Exit if bash-completion isn't installed or COMPLETIONSDIR is invalid. +if (( $? != 0 )) || [ ! -d "${COMPLETIONSDIR}" ] then exit 1 fi