Skip to content

Commit 83e9302

Browse files
committed
fix(installer): resolve lockfile path before cd changes cwd
Capture _script_dir as the script's absolute directory before the top-level cd, so _installPipCommon finds requirements-common_lock.txt at the script's location rather than the post-cd working directory. Signed-off-by: Jack Luar <jluar@precisioninno.com>
1 parent fa7ad82 commit 83e9302

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

etc/DependencyInstaller.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22

33
set -euo pipefail
44

5-
# Make sure we are on the correct folder before beginning
5+
# Capture the script's absolute directory before any cd
66
if [[ "$OSTYPE" == "darwin"* ]]; then
7-
cd "$(dirname $(perl -e 'use Cwd "abs_path";print abs_path(shift)' $0))/../"
7+
_script_dir="$(dirname $(perl -e 'use Cwd "abs_path";print abs_path(shift)' $0))"
88
else
9-
cd "$(dirname $(readlink -f $0))/../"
9+
_script_dir="$(dirname $(readlink -f $0))"
1010
fi
1111

12+
# Make sure we are on the correct folder before beginning
13+
cd "${_script_dir}/../"
14+
1215
# package versions
1316
klayoutVersion=0.30.7
1417
if [[ "$OSTYPE" == "darwin"* ]]; then
@@ -37,7 +40,7 @@ _installPipCommon() {
3740
set -u
3841
fi
3942
local lockfile
40-
lockfile="$(cd "$(dirname "$0")" && pwd)/requirements-common_lock.txt"
43+
lockfile="${_script_dir}/requirements-common_lock.txt"
4144
if [[ "$OSTYPE" == "darwin"* ]]; then
4245
if [[ "$EUID" -eq 0 ]]; then
4346
echo "Error: Do NOT run with sudo."

0 commit comments

Comments
 (0)