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

feat: replace symlink with simple shell wrapper #346

Closed
wants to merge 7 commits into from
16 changes: 13 additions & 3 deletions src/usr/local/buildpack/utils/linking.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ fi

${1} "\$@"
EOM
# make it writable for the owner and the group
chmod 775 "$FILE"
if [[ -O "$FILE" ]] && [ "$(stat --format '%a' "${FILE}")" -ne 775 ] ; then
# make it writable for the owner and the group only if we are the owner
chmod 775 "$FILE"
fi
}

# use this for simple symlink to /usr/local/bin
Expand All @@ -36,5 +38,13 @@ function link_wrapper () {
SOURCE=$SOURCE/${1}
fi
check_command "$SOURCE"
ln -sf "$SOURCE" "$TARGET"
cat > "$TARGET" <<- EOM
#!/bin/bash

${SOURCE} "\$@"
EOM
if [[ -O "$TARGET" ]] && [ "$(stat --format '%a' "${TARGET}")" -ne 775 ] ; then
# make it writable for the owner and the group only if we are the owner
chmod 775 "$TARGET"
fi
}