Make ripunzip installer accessible from outside this repo.

* 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.
This commit is contained in:
Cornelius Riemenschneider
2024-08-23 14:24:51 +02:00
parent 20d9fd11ac
commit d84e745ce9
2 changed files with 11 additions and 2 deletions

View File

@@ -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"],
)

View File

@@ -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}"