From cd903cd9a1a0c9f71fbf231187a44057e1735ddc Mon Sep 17 00:00:00 2001 From: jwerle Date: Wed, 13 Apr 2022 14:57:14 -0400 Subject: [PATCH] fix(bpkg-install): fix usage of '$BPKG_PACKAGE_DEPS' var --- lib/install/install.sh | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/lib/install/install.sh b/lib/install/install.sh index 2e4f796..2fe133c 100755 --- a/lib/install/install.sh +++ b/lib/install/install.sh @@ -491,17 +491,17 @@ bpkg_install_from_remote () { ## perform local install otherwise else ## copy 'bpkg.json' or 'package.json' over - save_remote_file "$url/$package_file" "$cwd/$BPKG_PACKAGE_DEPS/$name/$package_file" "$auth_param" + save_remote_file "$url/$package_file" "$BPKG_PACKAGE_DEPS/$name/$package_file" "$auth_param" ## make '$BPKG_PACKAGE_DEPS/' directory if possible - mkdir -p "$cwd/$BPKG_PACKAGE_DEPS/$name" + mkdir -p "$BPKG_PACKAGE_DEPS/$name" ## make '$BPKG_PACKAGE_DEPS/bin' directory if possible - mkdir -p "$cwd/$BPKG_PACKAGE_DEPS/bin" + mkdir -p "$BPKG_PACKAGE_DEPS/bin" # install package dependencies info "Install dependencies for $name" - (cd "$cwd/$BPKG_PACKAGE_DEPS/$name" && bpkg_getdeps) + (cd "$BPKG_PACKAGE_DEPS/$name" && bpkg_getdeps) ## grab each script and place in deps directory for script in "${scripts[@]}"; do @@ -510,27 +510,28 @@ bpkg_install_from_remote () { local scriptname="$(echo "$script" | xargs basename )" info "fetch" "$url/$script" - info "write" "$cwd/$BPKG_PACKAGE_DEPS/$name/$script" - save_remote_file "$url/$script" "$cwd/$BPKG_PACKAGE_DEPS/$name/$script" "$auth_param" + warn "BPKG_PACKAGE_DEPS is '$BPKG_PACKAGE_DEPS'" + info "write" "$BPKG_PACKAGE_DEPS/$name/$script" + save_remote_file "$url/$script" "$BPKG_PACKAGE_DEPS/$name/$script" "$auth_param" scriptname="${scriptname%.*}" - info "$scriptname to PATH" "$cwd/$BPKG_PACKAGE_DEPS/bin/$scriptname" + info "$scriptname to PATH" "$BPKG_PACKAGE_DEPS/bin/$scriptname" if (( force_actions == 1 )); then - ln -sf "$cwd/$BPKG_PACKAGE_DEPS/$name/$script" "$cwd/$BPKG_PACKAGE_DEPS/bin/$scriptname" + ln -sf "$BPKG_PACKAGE_DEPS/$name/$script" "$BPKG_PACKAGE_DEPS/bin/$scriptname" else - if test -f "$cwd/$BPKG_PACKAGE_DEPS/bin/$scriptname"; then - warn "'$cwd/$BPKG_PACKAGE_DEPS/bin/$scriptname' already exists. Overwrite? (yN)" + if test -f "$BPKG_PACKAGE_DEPS/bin/$scriptname"; then + warn "'$BPKG_PACKAGE_DEPS/bin/$scriptname' already exists. Overwrite? (yN)" read -r yn case $yn in - Yy) rm -f "$cwd/$BPKG_PACKAGE_DEPS/bin/$scriptname" ;; + Yy) rm -f "$BPKG_PACKAGE_DEPS/bin/$scriptname" ;; *) return 1; esac fi - ln -s "$cwd/$BPKG_PACKAGE_DEPS/$name/$script" "$cwd/$BPKG_PACKAGE_DEPS/bin/$scriptname" + ln -s "$BPKG_PACKAGE_DEPS/$name/$script" "$BPKG_PACKAGE_DEPS/bin/$scriptname" fi - chmod u+x "$cwd/$BPKG_PACKAGE_DEPS/bin/$scriptname" + chmod u+x "$BPKG_PACKAGE_DEPS/bin/$scriptname" fi ) done @@ -541,8 +542,9 @@ bpkg_install_from_remote () { ( if [[ "$file" ]];then info "fetch" "$url/$file" - info "write" "$cwd/$BPKG_PACKAGE_DEPS/$name/$file" - save_remote_file "$url/$file" "$cwd/$BPKG_PACKAGE_DEPS/$name/$file" "$auth_param" + warn "BPKG_PACKAGE_DEPS is '$BPKG_PACKAGE_DEPS'" + info "write" "$BPKG_PACKAGE_DEPS/$name/$file" + save_remote_file "$url/$file" "$BPKG_PACKAGE_DEPS/$name/$file" "$auth_param" fi ) done