-
-
Notifications
You must be signed in to change notification settings - Fork 367
/
Copy pathdiagnose
executable file
·100 lines (90 loc) · 3.12 KB
/
diagnose
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/env bash
#
# This script is for quickly generate helpful info
#
cd "$(dirname "$0")";export base="$(pwd)"
output_file=diagnose.result;rm $output_file
export LANG=C;export LC_ALL=C
case $(whoami) in
root)echo -e "\e[31m[$0]: This script is NOT to be executed with sudo or as root. Aborting...\e[0m";exit 1;;
esac
x() { ii_exec "$@" 2>&1 | tee -a $output_file ; }
e() { ii_box "$@" | tee -a $output_file ; }
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"
}
ii_exec() {
printf "\n[===diagnose===] $*\n"
"$@"
err=$?;if [ ! $err -eq 0 ];then echo "[---EXIT $err---]";else echo "[---SUCCESS---]";fi
}
ii_check_distro() {
lsb_release -a || cat /etc/os-release || cat /etc/lsb-release
}
ii_check_venv() {
source $(eval echo $ILLOGICAL_IMPULSE_VIRTUAL_ENV)/bin/activate
which gradience-cli
deactivate
}
ii_check_ags() {
pkill ags
pkill agsv1
agsv1 > ii_ags.log 2>&1 &
GUI_PID=$!
sleep 10
kill $GUI_PID
echo "AGS log saved to \"ii_ags.log\"."
}
#x ii_check_ags
e "Checking git repo info"
x git remote get-url origin
x git rev-parse HEAD
e "Checking distro"
x ii_check_distro
e "Checking variables"
x declare -p XDG_BIN_HOME # ~/.local/bin
x declare -p XDG_CACHE_HOME # ~/.cache
x declare -p XDG_CONFIG_HOME # ~/.config
x declare -p XDG_DATA_HOME # ~/.local/share
x declare -p XDG_STATE_HOME # ~/.local/state
x declare -p ILLOGICAL_IMPULSE_VIRTUAL_ENV # $XDG_STATE_HOME/ags/.venv
e "Checking directories/files"
x ls -l ~/.local/state/ags/.venv
x ls -l $ILLOGICAL_IMPULSE_VIRTUAL_ENV/bin/gradience-cli
x ls $XDG_DATA_HOME/glib-2.0/schemas
x ls $XDG_DATA_HOME/gradience
#x cat ~/.config/ags/
#e "Checking command existence"
#commands=(yay pacman zypper apt dnf yum)
commands+=(ags agsv1)
#commands+=(Hyprland hypr{ctl,idle,lock,picker})
#commands+=(uv)
#for i in "${commands[@]}";do x command -v $i;done
e "Checking versions"
x Hyprland --version
x ags --version
x agsv1 --version
e "Finished. Output saved as \"$output_file\"."
if ! command -v curl 2>&1 >>/dev/null ;then echo "\"curl\" not found, pastebin upload unavailable.";exit;fi
echo "(Optional) Do you agree to upload the file \"$output_file\" to the online pastebin (https://0x0.st)?"
echo "Notes:"
echo "1. It is a public service and the logfile will be expired in 15 days."
echo "2. You should have a look at the content of \"$output_file\" before agreeing to upload it."
echo "3. Only agree when necessary, typically when you are creating an issue and not able to upload the \"diagnose.result\" file there or copy-paste the output directly."
read -p "y=yes, n=no (default) ====> " p
case $p in
[yY]) echo "OK, uploading..."
curl -F'[email protected]' -Fexpires=360 https://0x0.st && \
echo "Uploaded. Please attach the URL above when asking for help."
;;
*) echo "Uploading aborted.";;
esac