master ohmu/dihfiles / bin / satch
ohmu  ·  2026-09-26
 1#!/bin/sh
 2## satch - dynamic ascii loading (KISS)linux-centric fetch script
 3
 4n=0
 5b='\033[0m\033[1;37m'
 6bb='\033[0m'
 7
 8_gf(){
 9n=$((1+n))
10case $n in
11        1)
12                . /etc/os-release
13                info=$(printf "${b}os$bb $PRETTY_NAME")
14        ;;
15	3) info=$(printf "${b}kern$bb $(uname -r)") ;;
16	2) info=$(
17		{
18			read -r name    < /sys/devices/virtual/dmi/id/product_name
19			read -r version < /sys/devices/virtual/dmi/id/product_version
20			read -r model   < /sys/firmware/devicetree/base/model
21		}>/dev/null 2>&1
22		printf "${b}host${bb} $name $version $model"
23	) ;;
24	4)
25		info=$(
26			IFS=. read -r s _ < /proc/uptime
27			d=$((s / 60 / 60 / 24))
28			h=$((s / 60 / 60 % 24))
29			m=$((s / 60 % 60))
30
31			uptime=''
32			[ ! $d -eq 0 ]&&uptime="${uptime}${d}d "
33			[ ! $h -eq 0 ]&&uptime="${uptime}${h}h "
34			[ ! $m -eq 0 ]&&uptime="${uptime}${m}m "
35			printf "${b}up$bb $uptime"
36		)
37	;;
38	5) info=$(
39		cd /var/db/kiss/installed
40		for i in *;do x=$((x+1));done
41		printf "${b}pkgs$bb $x")
42	;;
43	*)info=;;
44esac
45}
46
47while IFS= read -r _ || [ -n "$_" ]; do
48    _gf
49    printf "${bb}%b\t%s\n" "$_" "$info"
50done < "$1"