Skip to content

Commit

Permalink
fixup path comparisons
Browse files Browse the repository at this point in the history
Signed-off-by: Satadru Pramanik <satadru@gmail.com>
  • Loading branch information
satmandu committed Feb 13, 2024
1 parent 94d4444 commit f5631b0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
12 changes: 3 additions & 9 deletions src/env.d/00-path
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,11 @@
# Don't use `export PATH="${PATH}:${CREW_PREFIX}/bin`, as it may
# result in multiple copies of the same lines in $PATH.
# Instead, only add ${CREW_PREFIX}/bin to ${PATH} if it isn't there already.
if [ $(expr index "${CREW_PREFIX}/bin" "${PATH}") -ne 0 ]; then
export PATH="${PATH}:${CREW_PREFIX}/bin"
fi
[[ "$PATH" == *"${CREW_PREFIX}/bin"* ]] || export PATH="${PATH}:${CREW_PREFIX}/bin"

if [ $(expr index "${CREW_PREFIX}/sbin" "${PATH}") -ne 0 ]; then
export PATH="${PATH}:${CREW_PREFIX}/sbin"
fi
[[ "$PATH" == *"${CREW_PREFIX}/sbin"* ]] || export PATH="${PATH}:${CREW_PREFIX}/sbin"

if [ $(expr index "${CREW_PREFIX}/share/musl/bin" "${PATH}") -ne 0 ]; then
export PATH="${PATH}:${CREW_PREFIX}/share/musl/bin"
fi
[[ "$PATH" == *"${CREW_PREFIX}/share/musl/bin"* ]] || export PATH="${PATH}:${CREW_PREFIX}/share/musl/bin"

# Give TMPDIR standard permissions
if [ "$(stat -c %a "${TMPDIR:-/usr/local/tmp}")" -ne 1777 ]; then
Expand Down
4 changes: 1 addition & 3 deletions src/env.d/07-ld-library-path
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@
# Don't use `export LD_LIBRARY_PATH="${CREW_LIB_PREFIX}:${LD_LIBRARY_PATH}`, as it may
# result in multiple copies of the same lines in $LD_LIBRARY_PATH.
# Instead, only add ${CREW_LIB_PREFIX} to ${LD_LIBRARY_PATH} if it isn't there already.
if [ $(expr index "${CREW_LIB_PREFIX}" "${LD_LIBRARY_PATH}") -ne 0 ]; then
export LD_LIBRARY_PATH="${CREW_LIB_PREFIX}:${LD_LIBRARY_PATH}"
fi
[[ "$LD_LIBRARY_PATH" == *"$CREW_LIB_PREFIX"* ]] || export LD_LIBRARY_PATH="${CREW_LIB_PREFIX}:${LD_LIBRARY_PATH}"

0 comments on commit f5631b0

Please sign in to comment.