diff --git a/Makefile b/Makefile index 348a1aeb..b1ed3bf2 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +SHELL:=/usr/bin/env bash + # # Building: # diff --git a/src/commands/git_secret_reveal.sh b/src/commands/git_secret_reveal.sh index 973ddab5..6143a0eb 100644 --- a/src/commands/git_secret_reveal.sh +++ b/src/commands/git_secret_reveal.sh @@ -32,11 +32,11 @@ function reveal { fi if [[ ! -z "$passphrase" ]]; then - base="$base --batch --yes --passphrase $passphrase" + echo "$passphrase" | $base --batch --yes --no-tty --passphrase-fd 0 -o "$line" "$encrypted_filename" + else + $base -o "$line" "$encrypted_filename" fi - $base -o "$line" "$encrypted_filename" - counter=$((counter+1)) done < "$SECRETS_DIR_PATHS_MAPPING" diff --git a/tests/test_main.bats b/tests/test_main.bats index f52e9daa..6a1d5838 100644 --- a/tests/test_main.bats +++ b/tests/test_main.bats @@ -23,3 +23,9 @@ function teardown { run git secret notacommand [ "$status" -eq 126 ] } + + +@test "run 'git secret --version'" { + run git secret --version + [ "$output" == "$GITSECRET_VERSION" ] +} diff --git a/utils/build-deb.sh b/utils/build-deb.sh index 7a866849..e62eaf4e 100755 --- a/utils/build-deb.sh +++ b/utils/build-deb.sh @@ -3,7 +3,7 @@ set -e # Initializing and settings: -READ_PEM=0744 +READ_PEM=0644 EXEC_PEM=0755 SCRIPT_NAME="git-secret" @@ -23,22 +23,20 @@ rm -rf "$SCRIPT_BUILD_DIR" mkdir -p "$SCRIPT_DEST_DIR" # Coping the files inside the build folder: -install -b -m "$EXEC_PEM" "git-secret" "${SCRIPT_DEST_DIR}/git-secret" -install -m "$READ_PEM" -d "${SCRIPT_DEST_DIR}/man/man1" +install -D -T -b -m "$EXEC_PEM" -T "git-secret" "${SCRIPT_DEST_DIR}/usr/bin/git-secret" +install -m "$READ_PEM" -d "${SCRIPT_DEST_DIR}/usr/share/man/man1" for file in man/man1/* ; do - if [[ "$file" == *.ronn ]]; then - continue - fi + if [[ "$file" == *.ronn ]]; then + continue + fi - install -b -m "$READ_PEM" "$file" "${SCRIPT_DEST_DIR}/${file}" + install -D -T -b -m "$READ_PEM" -T "$file" "${SCRIPT_DEST_DIR}/usr/share/${file}" done # Building .deb package: cd "$SCRIPT_DEST_DIR" && fpm -s dir -t deb \ -a all \ -n "$SCRIPT_NAME" \ - -d git \ - -d gpg \ --epoch "$SCRIPT_EPOCH" \ --version "$SCRIPT_VERSION" \ --iteration "$SCRIPT_ITERATION" \