Make downloading work on a stock buster installation
Previously it was relying on an old version of libssl being installed.
Change-Id: I9d2bb58dc96d0e7a403c7602ab7e8e034e65de91
diff --git a/debian/BUILD b/debian/BUILD
index 9b7ad4d..5c9d814 100644
--- a/debian/BUILD
+++ b/debian/BUILD
@@ -243,7 +243,7 @@
)
generate_deb_tarball(
- name = "ssh",
+ name = "ssh_v3",
files = ssh_debs,
)
@@ -281,3 +281,7 @@
name = "python_gtk",
files = python_gtk_debs,
)
+
+exports_files([
+ "ssh_wrapper.sh",
+])
diff --git a/debian/ssh.BUILD b/debian/ssh.BUILD
index fb7f120..f26d19a 100644
--- a/debian/ssh.BUILD
+++ b/debian/ssh.BUILD
@@ -1,11 +1,31 @@
-filegroup(
- name = "ssh",
- srcs = ["usr/bin/ssh"],
+_tools = [
+ "ssh",
+ "scp",
+]
+
+[genrule(
+ name = "copy_%s_wrapper" % tool,
+ srcs = ["@//debian:ssh_wrapper.sh"],
+ outs = ["%s_wrapper.sh" % tool],
+ cmd = "cat $< | sed 's,%%(TOOL),usr/bin/%s,g' > $@" % tool,
+) for tool in _tools]
+
+[sh_binary(
+ name = tool,
+ srcs = [
+ "%s_wrapper.sh" % tool,
+ ],
+ data = [
+ "usr/bin/%s" % tool,
+ ":libs",
+ "@bazel_tools//tools/bash/runfiles",
+ ],
visibility = ["//visibility:public"],
-)
+) for tool in _tools]
filegroup(
- name = "scp",
- srcs = ["usr/bin/scp"],
- visibility = ["//visibility:public"],
+ name = "libs",
+ srcs = glob([
+ "usr/lib/x86_64-linux-gnu/**",
+ ]),
)
diff --git a/debian/ssh.bzl b/debian/ssh.bzl
index 005768c..77b913c 100644
--- a/debian/ssh.bzl
+++ b/debian/ssh.bzl
@@ -1,3 +1,4 @@
files = {
- "openssh-client_6.7p1-5+deb8u8_amd64.deb": "50bf902cc680fd1442556325e47d892f24621d7f0c4baf826f298d737a1e8030",
+ "openssh-client_7.9p1-10+deb10u1_amd64.deb": "1c30bcaf37dafe198783cf691096fe557e8eacbc9435631f51af62b3f705ee12",
+ "libssl1.1_1.1.1d-0+deb10u2_amd64.deb": "31c15130e0e4b2c907ef7cd92e50be23320a22c0c3b54e130b5258fe6bd8df2d",
}
diff --git a/debian/ssh_wrapper.sh b/debian/ssh_wrapper.sh
new file mode 100755
index 0000000..687ed87
--- /dev/null
+++ b/debian/ssh_wrapper.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# --- begin runfiles.bash initialization v2 ---
+# Copy-pasted from the Bazel Bash runfiles library v2.
+set -uo pipefail; 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 v2 ---
+
+LIB_PATH="$(rlocation ssh/usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0)"
+LIB_PATH="${LIB_PATH%/libcrypto.so.1.0.0}"
+export LD_LIBRARY_PATH="${LIB_PATH}"
+
+TOOL_PATH="$(rlocation ssh/%(TOOL))"
+
+exec "${TOOL_PATH}" "$@"