Revamp debugging
This commit is contained in:
parent
8db65c5a86
commit
b8bd9c2e38
5 changed files with 61 additions and 42 deletions
|
@ -7,3 +7,10 @@
|
||||||
|
|
||||||
git clean -d -f -X
|
git clean -d -f -X
|
||||||
git add .
|
git add .
|
||||||
|
|
||||||
|
! command -v beautysh && sudo pip install beautysh
|
||||||
|
beautysh -i 2 -s paronly *.sh
|
||||||
|
|
||||||
|
git add .
|
||||||
|
|
||||||
|
echo "DONE!"
|
||||||
|
|
|
@ -121,7 +121,9 @@ else
|
||||||
if [[ "${interactive}" == 'true' ]]; then
|
if [[ "${interactive}" == 'true' ]]; then
|
||||||
show_panel_opacity_dialog; show_sidebar_size_dialog; show_nautilus_style_dialog
|
show_panel_opacity_dialog; show_sidebar_size_dialog; show_nautilus_style_dialog
|
||||||
prompt -w "DIALOG: '--size' and '--panel' parameters are ignored if exist."; echo
|
prompt -w "DIALOG: '--size' and '--panel' parameters are ignored if exist."; echo
|
||||||
else show_needed_dialogs; fi
|
else
|
||||||
|
show_needed_dialogs
|
||||||
|
fi
|
||||||
|
|
||||||
prompt -w "Removing the old '${name}' themes..."
|
prompt -w "Removing the old '${name}' themes..."
|
||||||
|
|
||||||
|
@ -150,6 +152,8 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo; prompt -w "${final_msg}"; echo
|
echo; prompt -w "${final_msg}"; echo
|
||||||
|
rootify ls /mama; ls /mama; ls /mama
|
||||||
|
ls /mama
|
||||||
|
ls /mama
|
||||||
[[ -x /usr/bin/notify-send ]] && notify-send "'${name}' theme has been installed. Enjoy!" "${notif_msg}" -i "dialog-information-symbolic"
|
[[ -x /usr/bin/notify-send ]] && notify-send "'${name}' theme has been installed. Enjoy!" "${notif_msg}" -i "dialog-information-symbolic"
|
||||||
fi
|
fi
|
||||||
|
|
76
lib-core.sh
76
lib-core.sh
|
@ -9,6 +9,8 @@
|
||||||
# WARNING: Please set REPO_DIR variable before using this lib
|
# WARNING: Please set REPO_DIR variable before using this lib
|
||||||
|
|
||||||
set -Eeo pipefail
|
set -Eeo pipefail
|
||||||
|
WHITESUR_SOURCE=()
|
||||||
|
WHITESUR_SOURCE+=("lib-core.sh")
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# VARIABLES #
|
# VARIABLES #
|
||||||
|
@ -118,9 +120,9 @@ showapps_normal="false"
|
||||||
msg=""
|
msg=""
|
||||||
final_msg="Run '${0} --help' to explore more customization features!"
|
final_msg="Run '${0} --help' to explore more customization features!"
|
||||||
notif_msg=""
|
notif_msg=""
|
||||||
error_msg=""
|
|
||||||
process_ids=()
|
process_ids=()
|
||||||
errors=()
|
whitesur_error=""
|
||||||
|
whitesur_lines=()
|
||||||
export ANIM_PID="0"
|
export ANIM_PID="0"
|
||||||
has_any_error="false"
|
has_any_error="false"
|
||||||
|
|
||||||
|
@ -481,12 +483,13 @@ remind_relative_path() {
|
||||||
rootify() {
|
rootify() {
|
||||||
trap true SIGINT
|
trap true SIGINT
|
||||||
prompt -w "Executing '$(echo "${@}" | cut -c -35 )...' as root"
|
prompt -w "Executing '$(echo "${@}" | cut -c -35 )...' as root"
|
||||||
|
|
||||||
if ! sudo "${@}"; then
|
if ! sudo "${@}"; then
|
||||||
errors+=("${*}")
|
whitesur_lines+=("${BASH_LINENO}")
|
||||||
|
whitesur_error="${*}"
|
||||||
operation_aborted
|
operation_aborted
|
||||||
fi
|
fi
|
||||||
|
|
||||||
trap signal_exit SIGINT
|
trap signal_exit SIGINT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,12 +502,13 @@ full_rootify() {
|
||||||
|
|
||||||
userify() {
|
userify() {
|
||||||
trap true SIGINT
|
trap true SIGINT
|
||||||
|
|
||||||
if ! sudo -u "${MY_USERNAME}" "${@}"; then
|
if ! sudo -u "${MY_USERNAME}" "${@}"; then
|
||||||
errors+=("${*}")
|
whitesur_lines+=("${BASH_LINENO}")
|
||||||
|
whitesur_error="${*}"
|
||||||
operation_aborted
|
operation_aborted
|
||||||
fi
|
fi
|
||||||
|
|
||||||
trap signal_exit SIGINT
|
trap signal_exit SIGINT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -515,46 +519,48 @@ signal_exit() {
|
||||||
|
|
||||||
operation_aborted() {
|
operation_aborted() {
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
local sources=($(basename -a "${BASH_SOURCE[@]}" | sort -u))
|
local sources=($(basename -a "${WHITESUR_SOURCE[@]}" "${BASH_SOURCE[@]}" | sort -u))
|
||||||
local dist_ids=($(cat '/etc/os-release' | awk -F '=' '/ID/{print $2}'))
|
local dist_ids=($(awk -F '=' '/ID/{print $2}' "/etc/os-release"))
|
||||||
|
local repo_ver=""
|
||||||
|
local lines=()
|
||||||
|
|
||||||
|
if ! repo_ver="$(cd "${REPO_DIR}"; git log -1 --date=format-local:"%FT%T%z" --format="%ad")"; then
|
||||||
|
if ! repo_ver="$(date -r "${REPO_DIR}" +"%FT%T%z")"; then
|
||||||
|
repo_ver="unknown"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
#whitesur_lines=($(printf "%s\n" "${whitesur_lines[@]}" | sort -u))
|
||||||
|
|
||||||
clear
|
clear
|
||||||
|
|
||||||
|
prompt -e "\n\n Oops! Operation has been aborted or failed...\n"
|
||||||
|
prompt -e "=========== ERROR LOG ==========="
|
||||||
|
|
||||||
if [[ -f "${WHITESUR_TMP_DIR}/error_log.txt" ]]; then
|
if [[ -f "${WHITESUR_TMP_DIR}/error_log.txt" ]]; then
|
||||||
error_msg="$(cat "${WHITESUR_TMP_DIR}/error_log.txt")"
|
awk '{printf "\033[1;31m >>> %s\n", $0}' "${WHITESUR_TMP_DIR}/error_log.txt"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
prompt -e "\n\n Oops! Operation has been aborted or failed...\n"
|
prompt -e "\n =========== ERROR INFO =========="
|
||||||
prompt -e "ERROR LOG:\n${error_msg}\n"
|
prompt -e "FOUND :"
|
||||||
|
|
||||||
prompt -e "ERROR INFO:"
|
|
||||||
prompt -e " SOURCES : $(IFS=';'; echo "${sources[*]}")"
|
|
||||||
prompt -e " LINES : ${LINENO};${BASH_LINENO}"
|
|
||||||
prompt -e " SNIPPETS:"
|
|
||||||
|
|
||||||
for i in "${sources[@]}"; do
|
for i in "${sources[@]}"; do
|
||||||
errors+=("$(sed "${BASH_LINENO}q;d" "${REPO_DIR}/${i}")")
|
lines=($(grep -Fn "${whitesur_error:-${BASH_COMMAND}}" "${REPO_DIR}/${i}" | cut -d : -f 1 || echo ""))
|
||||||
errors+=("$(sed "${LINENO}q;d" "${REPO_DIR}/${i}")")
|
prompt -e " >>> ${i} $(IFS=';'; [[ "${lines[*]}" ]] && echo "at ${lines[*]}")"
|
||||||
done
|
done
|
||||||
|
|
||||||
errors+=("${BASH_COMMAND}")
|
prompt -e "SNIPPET:\n >>> ${whitesur_error:-${BASH_COMMAND}}"
|
||||||
errors=($(printf "%s\n" "${errors[@]}" | sort -u))
|
prompt -e "TRACE :"
|
||||||
|
|
||||||
for i in "${errors[@]}"; do
|
|
||||||
[[ ! "${i}" =~ "errors+=" && ! "${i}" =~ "operation_aborted" ]] && prompt -e ">>> ${i}"
|
|
||||||
done
|
|
||||||
|
|
||||||
prompt -e " TRACE :"
|
|
||||||
|
|
||||||
for i in "${FUNCNAME[@]}"; do
|
for i in "${FUNCNAME[@]}"; do
|
||||||
prompt -e ">>> ${i}"
|
prompt -e " >>> ${i}"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo
|
prompt -e "\n =========== SYSTEM INFO ========="
|
||||||
prompt -e "SYSTEM INFO:"
|
prompt -e "DISTRO : $(IFS=';'; echo "${dist_ids[*]}")"
|
||||||
prompt -e " DISTRO : $(IFS=';'; echo "${dist_ids[*]}")"
|
prompt -e "SUDO : $([[ -w "/" ]] && echo "yes" || echo "no")"
|
||||||
prompt -e " SUDO : $([[ -w "/" ]] && echo "yes" || echo "no")"
|
prompt -e "GNOME : ${GNOME_VERSION}"
|
||||||
prompt -e " GNOME : ${GNOME_VERSION}\n"
|
prompt -e "REPO : ${repo_ver}\n"
|
||||||
|
|
||||||
prompt -i "TIP: you can google or report to us the infos above\n"
|
prompt -i "TIP: you can google or report to us the infos above\n"
|
||||||
prompt -i "https://github.com/vinceliuice/WhiteSur-gtk-theme/issues\n\n"
|
prompt -i "https://github.com/vinceliuice/WhiteSur-gtk-theme/issues\n\n"
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
source "${REPO_DIR}/lib-core.sh"
|
source "${REPO_DIR}/lib-core.sh"
|
||||||
|
WHITESUR_SOURCE+=("lib-install.sh")
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# DEPENDENCIES #
|
# DEPENDENCIES #
|
||||||
|
@ -45,8 +46,7 @@ install_theme_deps() {
|
||||||
install_gdm_deps() {
|
install_gdm_deps() {
|
||||||
#TODO: @vince, do we also need "sassc" here?
|
#TODO: @vince, do we also need "sassc" here?
|
||||||
|
|
||||||
if ! has_command glib-compile-resources || ! has_command xmllint || \
|
if ! has_command glib-compile-resources || ! has_command xmllint || ! has_command sassc; then
|
||||||
! has_command sassc; then
|
|
||||||
echo; prompt -w "'glib2.0', 'xmllint', and 'sassc' are required for theme installation."
|
echo; prompt -w "'glib2.0', 'xmllint', and 'sassc' are required for theme installation."
|
||||||
|
|
||||||
if has_command zypper; then
|
if has_command zypper; then
|
||||||
|
@ -186,7 +186,9 @@ install_shelly() {
|
||||||
|
|
||||||
if [[ -z "${6}" ]]; then
|
if [[ -z "${6}" ]]; then
|
||||||
TARGET_DIR="${dest}/${name}${color}${opacity}${alt}${theme}/gnome-shell"
|
TARGET_DIR="${dest}/${name}${color}${opacity}${alt}${theme}/gnome-shell"
|
||||||
else TARGET_DIR="${6}"; fi
|
else
|
||||||
|
TARGET_DIR="${6}"
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir -p "${TARGET_DIR}"
|
mkdir -p "${TARGET_DIR}"
|
||||||
mkdir -p "${TARGET_DIR}/assets"
|
mkdir -p "${TARGET_DIR}/assets"
|
||||||
|
|
|
@ -54,7 +54,7 @@ while [[ $# -gt 0 ]]; do
|
||||||
# at once
|
# at once
|
||||||
|
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
# Parameters that don't require value
|
# Parameters that don't require value
|
||||||
-r|--remove|--revert)
|
-r|--remove|--revert)
|
||||||
uninstall='true'; shift ;;
|
uninstall='true'; shift ;;
|
||||||
-h|--help)
|
-h|--help)
|
||||||
|
@ -113,7 +113,7 @@ while [[ $# -gt 0 ]]; do
|
||||||
no_darken="true"; shift ;;
|
no_darken="true"; shift ;;
|
||||||
-n|--no-blur)
|
-n|--no-blur)
|
||||||
no_blur="true"; shift ;;
|
no_blur="true"; shift ;;
|
||||||
# Parameters that require value, single use
|
# Parameters that require value, single use
|
||||||
-b|--background)
|
-b|--background)
|
||||||
check_param "${1}" "${1}" "${2}" "must" "must" "must" "false" && shift 2 || shift ;;
|
check_param "${1}" "${1}" "${2}" "must" "must" "must" "false" && shift 2 || shift ;;
|
||||||
-i|--icon)
|
-i|--icon)
|
||||||
|
|
Loading…
Reference in a new issue