[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

View File

@ -1,21 +1,23 @@
#!/bin/bash #!/bin/bash
#Manages an /etc/changelog #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 ]] || { [[ -w /etc/changelog ]] || {
echo -e "\nYou cannot write to $CHANGELOG... This doesn't look serious!\n" echo -e "\nYou cannot write to $CHANGELOG... This doesn't look serious!\n"
read -e -i y -n 1 -p "Run as sudo [Yn]? : " read -e -i y -n 1 -p "Run as sudo [Yn]? : "
[[ "Y" == ${REPLY^} ]] && sudo -E $0 [[ "Y" == ${REPLY^} ]] && sudo -E "$APP_PATH/$APP_NAME" && exit 0
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 # functions
msg(){ echo -e "$@"; } msg(){ echo -e "$@"; }
panic(){ msg "${@} Exiting."; exit 1;} panic(){ msg "${@} Exiting."; exit 1;}
ENTRY_FILE=$(mktemp) ENTRY_FILE=$(mktemp)
@ -85,7 +87,7 @@ PLUGIN_OUTPUT+=("hookOutputFile")
declare -a PLUGIN_OUTPUT_MENU declare -a PLUGIN_OUTPUT_MENU
# %PLUGIN% This comment is used to build custom scripts # %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 for (( i = 0; i < ${#PLUGIN_OUTPUT[@]} ; i++ )); do
TXT=$( ${PLUGIN_OUTPUT[$i]} ) TXT=$( ${PLUGIN_OUTPUT[$i]} )