From ae98c4d451c1db0408c154e53e87b27a21547acc Mon Sep 17 00:00:00 2001 From: Muhammad Rivan Date: Thu, 27 May 2021 23:23:57 +0700 Subject: [PATCH] Critical update: new error handling --- lib-core.sh | 9 +++++---- lib-install.sh | 20 +++++++++++--------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/lib-core.sh b/lib-core.sh index e2dd63b..af64718 100755 --- a/lib-core.sh +++ b/lib-core.sh @@ -161,7 +161,7 @@ start_animation() { } stop_animation() { - kill -13 "${ANIM_PID}" &> /dev/null || true + [[ -e "/proc/${ANIM_PID}" ]] && kill -13 "${ANIM_PID}" setterm -cursor on } @@ -468,7 +468,7 @@ rootify() { trap true SIGINT prompt -w "Executing '$(echo "${@}" | cut -c -35 )...' as root" sudo ${@} || operation_aborted - trap stop_animation SIGINT + trap signal_exit SIGINT } full_rootify() { @@ -481,7 +481,7 @@ full_rootify() { userify() { trap true SIGINT sudo -u "${MY_USERNAME}" ${@} || operation_aborted - trap stop_animation SIGINT + trap signal_exit SIGINT } signal_exit() { @@ -543,6 +543,7 @@ finalize_argument_parsing() { rm -rf "${WHITESUR_TMP_DIR}"; mkdir -p "${WHITESUR_TMP_DIR}" rm -rf "${THEME_SRC_DIR}/sass/_theme-options-temp.scss" exec 2> "${WHITESUR_TMP_DIR}/error_log.txt" - trap 'operation_aborted' ERR; trap 'signal_exit' SIGINT; trap 'signal_exit' EXIT + trap 'operation_aborted' ERR + trap 'signal_exit' INT EXIT TERM fi } diff --git a/lib-install.sh b/lib-install.sh index 4405e09..4d82be2 100755 --- a/lib-install.sh +++ b/lib-install.sh @@ -439,17 +439,19 @@ install_firefox_theme() { } config_firefox() { - killall "firefox" &> /dev/null + killall "firefox" &> /dev/null || true for d in "${FIREFOX_DIR_HOME}/"*"default"*; do - rm -rf "${d}/chrome" - userify ln -sf "${FIREFOX_THEME_DIR}" "${d}/chrome" - userify_file "${d}/prefs.js" - echo "user_pref(\"toolkit.legacyUserProfileCustomizations.stylesheets\", true);" >> "${d}/prefs.js" - echo "user_pref(\"browser.tabs.drawInTitlebar\", true);" >> "${d}/prefs.js" - echo "user_pref(\"browser.uidensity\", 0);" >> "${d}/prefs.js" - echo "user_pref(\"layers.acceleration.force-enabled\", true);" >> "${d}/prefs.js" - echo "user_pref(\"mozilla.widget.use-argb-visuals\", true);" >> "${d}/prefs.js" + if [[ -f "${d}/prefs.js" ]]; then + rm -rf "${d}/chrome" + userify ln -sf "${FIREFOX_THEME_DIR}" "${d}/chrome" + userify_file "${d}/prefs.js" + echo "user_pref(\"toolkit.legacyUserProfileCustomizations.stylesheets\", true);" >> "${d}/prefs.js" + echo "user_pref(\"browser.tabs.drawInTitlebar\", true);" >> "${d}/prefs.js" + echo "user_pref(\"browser.uidensity\", 0);" >> "${d}/prefs.js" + echo "user_pref(\"layers.acceleration.force-enabled\", true);" >> "${d}/prefs.js" + echo "user_pref(\"mozilla.widget.use-argb-visuals\", true);" >> "${d}/prefs.js" + fi done }