From d818ddfcd24ab0dd3392e37cc1422ff2efcb2e8f Mon Sep 17 00:00:00 2001 From: Martin Ridgers Date: Wed, 23 Feb 2022 09:15:32 +0100 Subject: remote_build: convert given key file to Unix line endings --- scripts/remote_build.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/remote_build.py b/scripts/remote_build.py index 08e44c9ad..70f9cf9bf 100644 --- a/scripts/remote_build.py +++ b/scripts/remote_build.py @@ -106,13 +106,15 @@ def _local(args): _header("Validating remote host and credentials") - # Validate key file. OpenSSL needs a trailing EOL, LibreSSL doesn't + # Validate key file. Git's SSH uses OpenSSL which needs UNIX line-endings if args.keyfile: with open(args.keyfile, "rt") as key_file: - lines = [x for x in key_file] - if not lines[-1].endswith("\n"): - print("!! ERROR: key file must end with a new line") - return 1 + lines = [x.strip() for x in key_file] + + with open(args.keyfile, "wb") as key_file: + for line in lines: + key_file.write(line.encode() + b"\n") + identity = ("-i", args.keyfile) else: identity = () -- cgit v1.2.3