From efb1a2c2b6c5669decb2d9685c66d138f9ef438d Mon Sep 17 00:00:00 2001 From: alban Date: Tue, 19 May 2020 10:14:22 +0200 Subject: [PATCH] [fix] it should use a config and app path managemen --- changelog.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/changelog.sh b/changelog.sh index de9dc6a..e69ab87 100755 --- a/changelog.sh +++ b/changelog.sh @@ -1,21 +1,23 @@ #!/bin/bash #Manages an /etc/changelog -# %CONFIG% This comment is used to build custom scripts -CHANGELOG=/etc/changelog +echo ${BASH_SOURCE[@]} +APP_PATH=$( cd $(dirname ${BASH_SOURCE[0]}) && pwd ) +APP_NAME=$( basename ${BASH_SOURCE[0]}) [[ -w /etc/changelog ]] || { echo -e "\nYou cannot write to $CHANGELOG... This doesn't look serious!\n" read -e -i y -n 1 -p "Run as sudo [Yn]? : " - [[ "Y" == ${REPLY^} ]] && sudo -E $0 - exit 0 + [[ "Y" == ${REPLY^} ]] && sudo -E "$APP_PATH/$APP_NAME" && exit 0 } +CHANGELOG=/etc/changelog +# %CONFIG% This comment is used to build custom scripts +[[ -f "$APP_PATH/config.sh" ]] && source "$APP_PATH/config.sh" # functions - msg(){ echo -e "$@"; } panic(){ msg "${@} Exiting."; exit 1;} ENTRY_FILE=$(mktemp) @@ -85,7 +87,7 @@ PLUGIN_OUTPUT+=("hookOutputFile") declare -a PLUGIN_OUTPUT_MENU # %PLUGIN% This comment is used to build custom scripts -[[ -d "plugins-enabled" ]] && [[ -n "plugins-enabled/*" ]] && source plugins-enabled/* +[[ -d "$APP_PATH/plugins-enabled" ]] && [[ -n "$APP_PATH/plugins-enabled/*" ]] && source "$APP_PATH"/plugins-enabled/* for (( i = 0; i < ${#PLUGIN_OUTPUT[@]} ; i++ )); do TXT=$( ${PLUGIN_OUTPUT[$i]} )