Fix get_system_info for cross-distribution compatibility
- Remove dependency on lsb_release (not available on all distros) - Use DISTRO_NAME variable for OS info - Fix uptime parsing to work without -p option
This commit is contained in:
@@ -412,12 +412,12 @@ cleanup() {
|
|||||||
# Performance monitoring
|
# Performance monitoring
|
||||||
get_system_info() {
|
get_system_info() {
|
||||||
log_info "System Information:"
|
log_info "System Information:"
|
||||||
echo " OS: $(lsb_release -d | cut -f2)"
|
echo " OS: ${DISTRO_NAME:-Unknown}"
|
||||||
echo " Kernel: $(uname -r)"
|
echo " Kernel: $(uname -r)"
|
||||||
echo " CPU: $(lscpu | grep 'Model name' | cut -d: -f2 | xargs)"
|
echo " CPU: $(lscpu | grep 'Model name' | cut -d: -f2 | xargs)"
|
||||||
echo " RAM: $(free -h | awk 'NR==2{printf "%s/%s", $3,$2}')"
|
echo " RAM: $(free -h | awk 'NR==2{printf "%s/%s", $3,$2}')"
|
||||||
echo " Disk: $(df -h / | awk 'NR==2{printf "%s/%s (%s used)", $3,$2,$5}')"
|
echo " Disk: $(df -h / | awk 'NR==2{printf "%s/%s (%s used)", $3,$2,$5}')"
|
||||||
echo " Uptime: $(uptime -p)"
|
echo " Uptime: $(uptime | awk -F'up ' '{print $2}' | awk -F',' '{print $1,$2}' | xargs)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Version and compatibility checks
|
# Version and compatibility checks
|
||||||
|
|||||||
Reference in New Issue
Block a user