From b6ad0571ac585b85dc6d336602986b5d6bb0a18e Mon Sep 17 00:00:00 2001 From: Jordan Carlin Date: Tue, 2 Jul 2024 22:17:43 -0700 Subject: [PATCH] Update sourcing of secondary scripts to work when called from any directory --- bin/wally-package-install.sh | 3 ++- bin/wally-tool-chain-install.sh | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bin/wally-package-install.sh b/bin/wally-package-install.sh index f012fe259..fd9031ccc 100755 --- a/bin/wally-package-install.sh +++ b/bin/wally-package-install.sh @@ -38,7 +38,8 @@ ENDC='\033[0m' # If run standalone, determine distro information. Otherwise, use info from main install script if [ -z "$FAMILY" ]; then - source wally-distro-check.sh + dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + source "${dir}"/wally-distro-check.sh fi # Generate list of packages to install, determined based on distro diff --git a/bin/wally-tool-chain-install.sh b/bin/wally-tool-chain-install.sh index 55dcba9a3..61686a22e 100755 --- a/bin/wally-tool-chain-install.sh +++ b/bin/wally-tool-chain-install.sh @@ -36,6 +36,7 @@ NUM_THREADS=8 # for >= 32GiB #NUM_THREADS=16 # for >= 64GiB set -e # break on error +dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # Colors BOLD='\033[1m' @@ -48,7 +49,7 @@ FAIL_COLOR='\033[91m' ENDC='\033[0m' # Get Linux distro and version -source wally-distro-check.sh +source "${dir}"/wally-distro-check.sh # Check if root ROOT=$( [ "${EUID:=$(id -u)}" = 0 ] && echo true || echo false); @@ -70,9 +71,9 @@ echo "Installation path: $RISCV" # Install/update packages if root. Otherwise, check that packages are already installed. if [ "$ROOT" = true ]; then - source wally-package-install.sh + source "${dir}"/wally-package-install.sh else - source wally-package-install.sh --check + source "${dir}"/wally-package-install.sh --check fi if [ "$FAMILY" = rhel ]; then