diff --git a/README.md b/README.md index a345d38..8381de4 100644 --- a/README.md +++ b/README.md @@ -171,6 +171,8 @@ Config files are located at: /usr/local/etc/adsorber/ Documentation: https://github.com/stablestud/adsorber/blob/master/README.md If you encounter any issues please report them to the Github repository. +If you create an issue please provide the debug output from Adsorber, +it can be generated with the environment variable ADSORBER_DEBUG=true ``` ### Operations (required): diff --git a/install.sh b/install.sh index b194fd0..0cbd591 100755 --- a/install.sh +++ b/install.sh @@ -46,8 +46,6 @@ printHelp() echo " Will place Adsorbers executables and other" echo " files relevant to Adsorber into the system." echo - printf "\\033[4;37mNote\\033[0m: Adsorbers own 'setup' command will not do the same action as this script.\\n" - echo echo "Usage: ${0} [option]:" echo echo "Options:" diff --git a/src/bin/adsorber b/src/bin/adsorber index 0180818..fbf9e7f 100755 --- a/src/bin/adsorber +++ b/src/bin/adsorber @@ -13,12 +13,17 @@ readonly tmp_dir_path="/tmp/adsorber" readonly cache_dir_path="/var/cache/adsorber" -readonly debug="false" - ############[ DO NOT EDIT ]##################################################### +if [ -z "${ADSORBER_DEBUG+no}" ]; then + readonly debug="false" +else + readonly debug="true" + set -x +fi + # NOTE: following values will be changed when installed with # 'install.sh', if you want to change them, change them there @@ -106,7 +111,7 @@ showHelp() echo " e.g., disable scheduler (if set)" echo " restore hosts file to its original state" echo " - version" - echo " show version of this shell script" + echo " show version of Adsorber" echo " - help" echo " show this help" echo @@ -134,6 +139,8 @@ showHelp() echo echo "Documentation: https://github.com/stablestud/adsorber/blob/master/README.md" echo "If you encounter any issues please report them to the Github repository." + echo "If you create an issue please provide the debug output from Adsorber," + echo "it can be generated with the environment variable ADSORBER_DEBUG=true" exit 0 } @@ -143,7 +150,7 @@ showSpecificHelp() { case "${operation}" in setup | enable ) - printf "\\033[4;37madsorber ${operation} []\\033[0m:\\n" + printf "\\033[4;37madsorber %s []\\033[0m:\\n" "${operation}" echo echo "You should run this command first." echo " (e.g. after files have been placed onto the system)" @@ -174,7 +181,7 @@ showSpecificHelp() echo "Note: Cron supports only hourly, daily, weekly and monthly." ;; update | start ) - printf "\\033[4;37madsorber ${operation} []\\033[0m:\\n" + printf "\\033[4;37madsorber %s []\\033[0m:\\n" "${operation}" echo echo "Updates your hosts files with the newest ad-domains fetched from the sources specified in 'sources.list'." echo @@ -188,7 +195,7 @@ showSpecificHelp() echo " --noformatting - turn off coloured and formatted output" ;; restore | stop ) - printf "\\033[4;37madsorber ${operation} []\\033[0m:\\n" + printf "\\033[4;37madsorber %s []\\033[0m:\\n" "${operation}" echo echo "Restore the hosts file to its operating system default, without removing the backup or scheduler." echo @@ -206,7 +213,7 @@ showSpecificHelp() echo " --noformatting - turn off coloured and formatted output" ;; revert ) - printf "\\033[4;37madsorber ${operation} []\\033[0m:\\n" + printf "\\033[4;37madsorber %s []\\033[0m:\\n" "${operation}" echo echo "Revert the current hosts file to the previously applied ad-domains" echo "Use it if the current host file has been corrupted or misses previously applied ad-domains." @@ -221,7 +228,7 @@ showSpecificHelp() echo " --noformatting - turn off coloured and formatted output" ;; disable ) - printf "\\033[4;37madsorber disable []\\033[0m:\\n" + printf "\\033[4;37madsorber %s []\\033[0m:\\n" "${operation}" echo echo "Completely disable all background tasks (schedulers) and remove all changes made by Adsorber." echo diff --git a/src/lib/config.sh b/src/lib/config.sh index f539c15..3cef533 100755 --- a/src/lib/config.sh +++ b/src/lib/config.sh @@ -370,6 +370,7 @@ config_PrintVariables() config() { printf "%bReading configuration ...%b\\n" "${prefix_title}" "${prefix_reset}" + [ "${debug}" = "true" ] && config_PrintVariables config_CreateTmpDir config_CopySourceList config_CopyWhiteList