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]} )