[fix] Changelog location should be configurable and piped content work with self call of sudo
This commit is contained in:
parent
0adaf05483
commit
a5cf3456c6
15
changelog.sh
15
changelog.sh
@ -1,17 +1,24 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#Manages an /etc/changelog
|
#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/tty
|
||||||
|
|
||||||
|
# Defining some path variables
|
||||||
APP_PATH=$( cd $(dirname ${BASH_SOURCE[0]}) && pwd )
|
APP_PATH=$( cd $(dirname ${BASH_SOURCE[0]}) && pwd )
|
||||||
APP_NAME=$( basename ${BASH_SOURCE[0]})
|
APP_NAME=$( basename ${BASH_SOURCE[0]})
|
||||||
STDIN=$( cat )
|
|
||||||
ls -lh /proc/self/fd
|
|
||||||
exec 0</dev/tty
|
|
||||||
CHANGELOG=/etc/changelog
|
|
||||||
# %CONFIG% This comment is used to build custom scripts
|
# %CONFIG% This comment is used to build custom scripts
|
||||||
[[ -f "$APP_PATH/config.sh" ]] && source "$APP_PATH/config.sh"
|
[[ -f "$APP_PATH/config.sh" ]] && source "$APP_PATH/config.sh"
|
||||||
|
|
||||||
# Sanity check on changelog file
|
# Sanity check on changelog file
|
||||||
|
[[ -n "$CHANGELOG" ]] && CHANGELOG="/etc/Changelog"
|
||||||
[[ -f "$CHANGELOG" ]] && [[ ! -w "$CHANGELOG" ]] && RUN_SUDO=1
|
[[ -f "$CHANGELOG" ]] && [[ ! -w "$CHANGELOG" ]] && RUN_SUDO=1
|
||||||
[[ ! -f "$CHANGELOG" ]] && ! touch /etc/changelog &>/dev/null && RUN_SUDO=1
|
[[ ! -f "$CHANGELOG" ]] && ! touch /etc/changelog &>/dev/null && RUN_SUDO=1
|
||||||
[[ $RUN_SUDO -eq 1 ]] && {
|
[[ $RUN_SUDO -eq 1 ]] && {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
CHANGELOG=/etc/Changelog
|
||||||
CHANGELOG_SERVER=https://changelog.example.com
|
CHANGELOG_SERVER=https://changelog.example.com
|
||||||
CHANGELOG_AUTH_KEY=your-shared-secret
|
CHANGELOG_AUTH_KEY=your-shared-secret
|
||||||
HASTEBIN_SERVER=https://hastebin.com
|
HASTEBIN_SERVER=https://hastebin.com
|
||||||
|
Loading…
Reference in New Issue
Block a user