[fix] it should use a config and app path managemen

This commit is contained in:
alban 2020-05-19 10:14:22 +02:00
parent dddd30aa96
commit efb1a2c2b6
1 changed files with 8 additions and 6 deletions

View File

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