-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiagnose
More file actions
executable file
·112 lines (101 loc) · 3.67 KB
/
diagnose
File metadata and controls
executable file
·112 lines (101 loc) · 3.67 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/env bash
#
# This script is for quickly generate helpful info
#
# It should be as independent as possible and should not source other files unless it has to
#
# TODO: How to get the Qt version which Quickshell was built against?
STY_RED='\e[31m'
STY_RST='\e[00m'
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 "${STY_RED}[$0]: This script is NOT to be executed with sudo or as root. Aborting...${STY_RST}";exit 1;;
esac
x() { _exec "$@" 2>&1 | tee -a $output_file ; }
e() { _box "$@" | tee -a $output_file ; }
_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"
}
_exec() {
printf "\n[===diagnose===] $*\n"
"$@"
err=$?;if [ ! $err -eq 0 ];then echo "[---EXIT $err---]";else echo "[---SUCCESS---]";fi
}
_check_distro_id() {
OS_RELEASE_FILE=/etc/os-release
if [[ -f "$OS_RELEASE_FILE" ]]; then
OS_DISTRO_ID=$(awk -F'=' '/^ID=/ { gsub("\"","",$2); print tolower($2) }' ${OS_RELEASE_FILE} 2> /dev/null)
OS_DISTRO_ID_LIKE=$(awk -F'=' '/^ID_LIKE=/ { gsub("\"","",$2); print tolower($2) }' ${OS_RELEASE_FILE} 2> /dev/null)
echo "distro ID: $OS_DISTRO_ID"
echo "distro ID_LIKE: $OS_DISTRO_ID_LIKE"
else
echo "$OS_RELEASE_FILE does not exist."
fi
}
_check_distro() {
lsb_release -a || cat /etc/os-release || cat /etc/lsb-release
}
_check_venv() {
source $(eval echo $ILLOGICAL_IMPULSE_VIRTUAL_ENV)/bin/activate
which python
deactivate
}
_check_quickshell_version() {
pacman -Q | grep -E 'quickshell|qt6-base'
}
_check_PKGBUILD_version() {
pacman -Q | grep '^illogical-impulse-'
}
e "Checking git repo info"
x git remote get-url origin
x git rev-parse HEAD
x git status
x git submodule status --recursive
e "Checking distro"
x _check_distro_id
x cat os-release
#x _check_distro
e "Checking variables"
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/quickshell/.venv
e "Checking directories/files"
x ls -l ~/.local/state/quickshell/.venv
#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 _check_quickshell_version
x _check_PKGBUILD_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'file=@diagnose.result' -Fexpires=360 https://0x0.st && \
echo "Uploaded. Please attach the URL above when asking for help."
;;
*) echo "Uploading aborted.";;
esac