From a5cf3456c68b5ce9d92a1f661e35b57ae42eadb8 Mon Sep 17 00:00:00 2001 From: alban Date: Wed, 3 Jun 2020 21:50:40 +0200 Subject: [PATCH] [fix] Changelog location should be configurable and piped content work with self call of sudo --- changelog.sh | 15 +++++++++++---- config.sample.sh | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/changelog.sh b/changelog.sh index 7a3a554..83cb9e7 100755 --- a/changelog.sh +++ b/changelog.sh @@ -1,17 +1,24 @@ #!/bin/bash #Manages an /etc/changelog +# Immediately attempt to read from named pipe +# And store the piped content if provided +[[ -p /proc/self/fd/0 ]] && export STDIN=$( cat ) +# And then force the input to be from terminal +exec 0/dev/null && RUN_SUDO=1 [[ $RUN_SUDO -eq 1 ]] && { diff --git a/config.sample.sh b/config.sample.sh index 3995eeb..c7935c6 100644 --- a/config.sample.sh +++ b/config.sample.sh @@ -1,3 +1,4 @@ +CHANGELOG=/etc/Changelog CHANGELOG_SERVER=https://changelog.example.com CHANGELOG_AUTH_KEY=your-shared-secret HASTEBIN_SERVER=https://hastebin.com