From 0fb5c77289fcd3b252f1a023ee9d3992e6340f4e Mon Sep 17 00:00:00 2001 From: Muhammad Rivan Date: Fri, 16 Apr 2021 21:22:27 +0700 Subject: [PATCH] fixed gsettings problem and made a better error logging --- lib-core.sh | 17 ++++++++++++++--- lib-install.sh | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lib-core.sh b/lib-core.sh index 9cbf0f16..d20a4d84 100755 --- a/lib-core.sh +++ b/lib-core.sh @@ -112,6 +112,7 @@ max_round="false" # Misc msg="Run '${0} --help' to explore more customization features!" +error_msg="" process_ids=() ANIM_PID="0" has_any_error="false" @@ -459,7 +460,7 @@ lockWhiteSur() { rootify() { trap true SIGINT prompt -w "Executing '$(echo "${@}" | cut -c -35 )...' as root" - sudo ${@} || operation_canceled + error_msg="$(sudo ${@} 2>&1)" || operation_canceled trap sig_c SIGINT } @@ -472,7 +473,7 @@ full_rootify() { userify() { trap true SIGINT - sudo -u "${MY_USERNAME}" ${@} || operation_canceled + error_msg="$(sudo -u "${MY_USERNAME}" ${@} 2>&1)" || operation_canceled trap sig_c SIGINT } @@ -482,7 +483,17 @@ sig_c() { } operation_canceled() { - clear; prompt -e "\n\n Oops! Operation has been canceled or failed...\n\n"; exit 1 + clear + + if [[ ${error_msg} != "" ]]; then + prompt -e "\n\n Oops! An error is detected...\n" + prompt -e "ERROR LOG:\n${error_msg}\n" + prompt -i "TIP: you can google or report to us the error log above\n\n" + else + prompt -e "\n\n Oops! Operation has been canceled or failed...\n\n" + fi + + exit 1 } usage() { diff --git a/lib-install.sh b/lib-install.sh index cfed96d0..57beb7ba 100755 --- a/lib-install.sh +++ b/lib-install.sh @@ -440,7 +440,7 @@ install_dash_to_dock_theme() { rootify sassc ${SASSC_OPT} "${DASH_TO_DOCK_SRC_DIR}/stylesheet$(destify ${colors[0]}).scss" "${DASH_TO_DOCK_DIR_ROOT}/stylesheet.css" fi - userify dbus-launch gsettings set org.gnome.shell.extensions.dash-to-dock apply-custom-theme true + userify dbus-launch dconf write /org/gnome/shell/extensions/dash-to-dock/apply-custom-theme true } revert_dash_to_dock_theme() {