#!/bin/bash source /etc/os-release ### short version (for osd) if test "$1" = "--short" then BATT=$(cat /sys/class/power_supply/{BAT,bat}*/uevent 2>/dev/null | grep -E "^POWER_SUPPLY_CAPACITY=" | sed -e s+'^POWER_SUPPLY_CAPACITY='++ | sort -rn | head -1) DT=$(date +%H:%M) if test -n "${BATT}" then echo "Battery: ${BATT}% - ${DT}" else echo "${DT}" fi exit 0 fi ### TEST=$(ldd /usr/bin/emulationstation | grep 64) if [ $? == 0 ] then V_OSARCH="aarch64" else V_OSARCH="arm" fi V_CPUMODEL1=$(grep -E $'^model name\t:' /proc/cpuinfo | head -1 | sed -e s+'^model name\t: '++) V_SYSTEM=$(uname -rs) V_ARCH=$(uname -m) [[ "$V_CPUMODEL1" ]] || V_CPUMODEL1="${HW_CPU}" # battery BATT=$(cat /sys/class/power_supply/{BAT,bat}*/uevent 2>/dev/null | grep -E "^POWER_SUPPLY_CAPACITY=" | sed -e s+'^POWER_SUPPLY_CAPACITY='++ | sort -rn | head -1) # PAD Battery for PADBAT in /sys/class/power_supply/*/device/uevent do # HID devices only PADNAME=$(grep -E '^HID_NAME=' "${PADBAT}" | sed -e s+'^HID_NAME='++) if test -n "${PADNAME}" then # parent of parent / uevent BATTUEVENT=$(dirname "${PADBAT}") BATTUEVENT=$(dirname "${BATTUEVENT}")/uevent BATT=$(grep -E "^POWER_SUPPLY_CAPACITY=" "${BATTUEVENT}" | sed -e s+'^POWER_SUPPLY_CAPACITY='++ | sort -rn | head -1) echo "${PADNAME}: ${BATT}%" fi done declare -a CF MF CNTR=0 for CPUFREQ in /sys/devices/system/cpu/cpufreq/* do if [ "${CNTR}" -eq 0 ] then CF+=("CURRENT FREQUENCY:") MF+=("MAXIMUM FREQUENCY:") fi CF+=("CORES $(cat ${CPUFREQ}/related_cpus | awk '{print $1"-"$NF}'): $(( $(cat ${CPUFREQ}/scaling_cur_freq | sort | tail -n 1) / 1000))MHz") MF+=("CORES $(cat ${CPUFREQ}/related_cpus | awk '{print $1"-"$NF}'): $(( $(cat ${CPUFREQ}/cpuinfo_max_freq | sort | tail -n 1) / 1000))MHz") CNTR=$(( CNTR + 1 )) done # temperature # Unit: millidegree Celsius TEMPE=$(cat /sys/devices/virtual/thermal/thermal_zone*/temp 2>/dev/null | sort -rn | head -1 | sed -e s+"[0-9][0-9][0-9]$"++) echo "SYSTEM INFORMATION:" echo "OPERATING SYSTEM: ${OS_NAME}" echo "VERSION: ${OS_VERSION}" echo "BUILD ID: ${BUILD_ID:0:7}" echo "ARCHITECTURE: ${V_OSARCH}" echo "KERNEL: ${V_SYSTEM} (${V_ARCH})" echo "DISK SPACE:" echo "/storage: $(df -h /storage | awk '/dev/ {print $3"/"$2" ("$5")"}')" echo "/storage/roms: $(df -h /storage/roms | awk '/dev/ {print $3"/"$2" ("$5")"}')" echo "BATTERY INFORMATION:" if test -n "${BATT}" then echo "BATTERY REMAINING: ${BATT}%" if [ -e "/sys/class/power_supply/bat/health" ] then echo "BATTERY HEALTH: $(cat /sys/class/power_supply/bat/health)" fi if [ -e "/sys/class/power_supply/bat/status" ] then echo "BATTERY STATE: $(cat /sys/class/power_supply/bat/status)" fi fi echo "CPU INFORMATION:" echo "CPU: ${V_CPUMODEL1}" if test -n "${TEMPE}" then echo "CPU TEMPERATURE: ${TEMPE}°" fi echo "CPU ACTIVE CORES: $(cat /sys/devices/system/cpu/online)" for C in "${CF[@]}" do echo ${C} done for M in "${MF[@]}" do echo ${M} done