Adding diagnose

This commit is contained in:
clsty 2025-02-09 10:55:14 +08:00
parent f5aca0e591
commit 9c35ad9443
2 changed files with 52 additions and 0 deletions

View file

@ -23,6 +23,7 @@ assignees: ''
<!-- ↓↓ DO NOT IGNORE THIS. NO HELP CAN BE GIVEN WITHOUT SUFFICIENT LOGS -->
<!-- Bar and widgets not showing? run `pkill ags; ags` for logs -->
<!-- Installation failed? Run installation again for logs -->
<!-- Optionally also run `./diagnose` inside the repo for logs -->
```plain
Paste logs here

51
diagnose Executable file
View file

@ -0,0 +1,51 @@
#!/usr/bin/env bash
#
# This script is for quickly generate helpful logs
#
cd "$(dirname "$0")";export base="$(pwd)"
logfile=diagnose.log;rm $logfile
export LANG=C;export LC_ALL=C
function d() { ii_diagnose "$@" 2>&1 | tee -a $logfile ; }
function e() { ii_box "$@" | tee -a $logfile ; }
function ii_box() {
length=$(echo "$1" | wc -L);total_width=$((length + 2))
#line=$(printf "═%.0s" $(seq 1 $total_width))
#border_up="╔${line}╗";border_down="╚${line}╝"
#border_vertical="║"
line=$(printf "=%.0s" $(seq 1 $total_width))
border_up="/${line}\\";border_down="\\${line}/"
border_vertical="|"
echo -e "\n$border_up"
echo "$border_vertical $1 $border_vertical"
echo "$border_down"
}
function ii_diagnose() {
printf "\n[===diagnose===] $*\n"
"$@"
err=$?;if [ ! $err -eq 0 ];then echo "[---EXIT $err---]";else echo "[---SUCCESS---]";fi
}
e "Checking distro"
d cat /etc/*-release
d lsb_release -a
e "Checking variables"
d declare -p ILLOGICAL_IMPULSE_VIRTUAL_ENV
d declare -p XDG_BIN_HOME
d declare -p XDG_CACHE_HOME
d declare -p XDG_CONFIG_HOME
d declare -p XDG_DATA_HOME
d declare -p XDG_STATE_HOME
e "Checking directories"
d ls -l $ILLOGICAL_IMPULSE_VIRTUAL_ENV/bin
d ls -l ~/.local/share/glib-2.0
d ls -l ~/.local/share/gradience
e "Checking command existence"
d command -v pacman
#e "Checking Color Generators"
#d ~/.config/ags/scripts/color_generation/applycolor.sh