Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Echo failed dependency in add-to-bin #569

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions script/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ set -u # Treat unset variables and parameters other than the special parameters
set -o pipefail # Any command failed in the pipe fails the whole pipe
# set -x # Print shell commands as they are executed (or you can try -v which is less verbose)

# Look for a given dependency, failing the whole script if not found.
# If found, create a mapping script to that dependency in the .deps/bin folder
add-to-bin() {
/usr/bin/which "$1" &> /dev/null && \
cat > ".deps/bin/${2:-$1}" <<EOF
/usr/bin/which "$1" &> /dev/null || (echo "Dependency $1 not found" && exit 1)

cat > ".deps/bin/${2:-$1}" <<EOF
#!/bin/bash
exec '$(/usr/bin/which "$1")' "\$@"
EOF
}

# Delete the dependency mapping scripts from .deps/bin, recreate them,
# and establish our PATH with .deps/bin in it
nuke-path() {
/bin/rm -rf .deps/bin
/bin/mkdir -p .deps/bin
Expand Down
Loading