@@ -9,21 +9,23 @@ focused_summary_file="focused_summary_temp.txt"
9
9
BOLD=' \033[1m'
10
10
RESET=' \033[0m'
11
11
12
-
13
12
# Ensure necessary packages are installed based on the operating system
14
13
if [ -f /etc/os-release ]; then
15
- # Extract OS details using grep
16
14
OS_ID=$( grep ^ID= /etc/os-release | cut -d' =' -f2 | tr -d ' "' )
17
15
OS_VERSION_ID=$( grep ^VERSION_ID= /etc/os-release | cut -d' =' -f2 | tr -d ' "' )
18
16
19
17
# Check and install required packages based on the distribution
20
18
case " $OS_ID " in
21
19
ubuntu)
22
20
sudo apt-get update -qq
23
- sudo apt-get install -y -qq pciutils iw inxi speedtest-cli lsb-release || { echo " ${BOLD} Package installation failed on Ubuntu.${RESET} " ; exit 1; }
21
+ sudo apt-get install -y -qq pciutils iw inxi || { echo " ${BOLD} Package installation failed on Ubuntu.${RESET} " ; exit 1; }
24
22
;;
25
23
fedora)
26
- sudo dnf install -y -q pciutils iw inxi speedtest-cli redhat-lsb-core || { echo " ${BOLD} Package installation failed on Fedora.${RESET} " ; exit 1; }
24
+ sudo dnf install -y -q pciutils iw inxi || { echo " ${BOLD} Package installation failed on Fedora.${RESET} " ; exit 1; }
25
+ ;;
26
+ bluefin|bazzite)
27
+ # Do not install any packages on these distributions
28
+ # Just skip installation.
27
29
;;
28
30
* )
29
31
echo " ${BOLD} Unsupported distribution: $OS_ID ${RESET} "
35
37
exit 1
36
38
fi
37
39
38
-
39
40
# Function to display progress bar
40
41
show_progress () {
41
42
local width=50
@@ -61,7 +62,15 @@ get_system_info() {
61
62
echo " " >> " $output_file "
62
63
echo " Kernel version: $( uname -r) " >> " $output_file "
63
64
echo " Desktop Environment: $XDG_CURRENT_DESKTOP " >> " $output_file "
64
- echo " Distribution: $( lsb_release -d | cut -f2) " >> " $output_file "
65
+
66
+ # For distribution, read from /etc/os-release
67
+ if [ -f /etc/os-release ]; then
68
+ OS_NAME=$( grep PRETTY_NAME /etc/os-release | cut -d= -f2 | tr -d ' "' )
69
+ echo " Distribution: $OS_NAME " >> " $output_file "
70
+ else
71
+ echo " Distribution: Unknown (no /etc/os-release)" >> " $output_file "
72
+ fi
73
+
65
74
echo " BIOS Version: $( sudo dmidecode -s bios-version) " >> " $output_file "
66
75
echo " " >> " $output_file "
67
76
}
@@ -70,8 +79,7 @@ get_system_info() {
70
79
process_logs () {
71
80
local start_time=$1
72
81
local end_time=$2
73
-
74
- # Convert start and end times to seconds since epoch for comparison
82
+
75
83
local start_seconds=$( date -d " $start_time " +%s)
76
84
local end_seconds=$( date -d " $end_time " +%s)
77
85
@@ -103,11 +111,9 @@ process_logs() {
103
111
done
104
112
105
113
echo -e " \nDmesg processing complete."
106
-
107
114
echo " " >> " $output_file "
108
115
109
116
# Create a header for journalctl section with spacing
110
- echo " " >> " $output_file "
111
117
echo " ===== journalctl output starts =====" >> " $output_file "
112
118
echo " " >> " $output_file "
113
119
@@ -131,7 +137,7 @@ process_logs() {
131
137
# Function to add summaries to the file
132
138
add_summaries () {
133
139
local file=$1
134
-
140
+
135
141
# Add focused summary section to the end of the output file
136
142
echo " " >> " $file "
137
143
echo " ===== Focused Summary of Potential Issues =====" >> " $file "
@@ -159,7 +165,10 @@ add_summaries() {
159
165
echo " " >> " $file "
160
166
}
161
167
168
+ # #######################################
162
169
# Main script starts here
170
+ # #######################################
171
+
163
172
echo " Choose an option:"
164
173
echo " 1. Last x minutes"
165
174
echo " 2. Last 24 hours"
@@ -194,22 +203,7 @@ case $choice in
194
203
add_summaries " $output_file "
195
204
;;
196
205
4)
197
- echo " Looking for file called combined_log.txt in home directory..."
198
- if [ ! -f " $output_file " ]; then
199
- echo " File not found: $output_file "
200
- exit 1
201
- fi
202
- echo " File found. Proceeding with filtering options."
203
- ;;
204
- * )
205
- echo " Invalid choice"
206
- exit 1
207
- ;;
208
- esac
209
-
210
- if [ " $choice " == " 4" ]; then
211
206
echo " Looking for file called combined_log.txt in current directory..."
212
- output_file=" $( pwd) /combined_log.txt" # Change to current directory
213
207
if [ ! -f " $output_file " ]; then
214
208
echo " File not found: $output_file "
215
209
exit 1
@@ -248,8 +242,13 @@ if [ "$choice" == "4" ]; then
248
242
echo -e " \n${BOLD} Filtered log saved in $filtered_output_file ${RESET} "
249
243
line_count=$( wc -l < " $filtered_output_file " )
250
244
echo -e " ${BOLD} Total lines in filtered output: $line_count ${RESET} "
251
- fi
245
+ ;;
246
+ * )
247
+ echo " Invalid choice"
248
+ exit 1
249
+ ;;
250
+ esac
252
251
253
- # Remove temporary files
252
+ # Clean up temporary files
254
253
[ -f " $summary_file " ] && rm " $summary_file "
255
254
[ -f " $focused_summary_file " ] && rm " $focused_summary_file "
0 commit comments