From 5f1f8bd38699f1da2815b967eb1cd9bf373ebb2b Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sun, 10 May 2020 00:28:25 +0100 Subject: [PATCH] hack/populate_secrets: make POSIX-compliant? --- hack/populate_secrets.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hack/populate_secrets.sh b/hack/populate_secrets.sh index 5094cb137b..f6f814daf5 100755 --- a/hack/populate_secrets.sh +++ b/hack/populate_secrets.sh @@ -1,12 +1,12 @@ -#!/usr/bin/env nix-shell -#!nix-shell -i bash +#!/bin/sh -set -euo pipefail +set -eu echo Dropping files into place as defined by manifest... while read -r manifest_line; do - IFS='=' read -ra manifest_bits <<< "$manifest_line" - if [[ "${#manifest_bits[@]}" -ne 2 ]]; then continue; fi - echo -e "\t${manifest_bits[1]}" - cp "${!manifest_bits[0]}" "${manifest_bits[1]}" + manifest_key="$(echo "$manifest_line" | cut -f'=' -f1)" + manifest_value="$(echo "$manifest_line" | cut -f'=' -f2)" + printf "\t%s\n" "${manifest_key}" + eval manifest_key_val=\"\$$manifest_key\" + cp "${manifest_key_val}" "${manifest_value}" done < "$SECRETS_MANIFEST"