Skip to content

Commit

Permalink
Make ripunzip installer accessible from outside this repo.
Browse files Browse the repository at this point in the history
* The relative path to misc doesn't work when running from another repo
* The buildifier dependency is not available from other repos,
  therefore we can't pull in //misc/bazel without further refactoring.

Therefore, inline the runfiles snippet here.
  • Loading branch information
criemen committed Aug 23, 2024
1 parent 20d9fd1 commit d84e745
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion misc/ripunzip/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ sh_binary(
srcs = ["install.sh"],
args = ["$(rlocationpath :ripunzip)"],
data = [":ripunzip"],
deps = ["//misc/bazel:sh_runfiles"],
deps = ["@bazel_tools//tools/bash/runfiles"],
)
11 changes: 10 additions & 1 deletion misc/ripunzip/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@

set -eu

. misc/bazel/runfiles.sh
# --- begin runfiles.bash initialization v3 ---
# Copy-pasted from the Bazel Bash runfiles library v3.
set -uo pipefail; set +e; f=bazel_tools/tools/bash/runfiles/runfiles.bash
source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
source "$0.runfiles/$f" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
# --- end runfiles.bash initialization v3 ---

dest="${2:-$HOME/.local/bin}"

Expand Down

0 comments on commit d84e745

Please sign in to comment.