#!/bin/rc # Warning, parts of this script have been STOLEN! # TODO: # fs usage # kernel fn storage { disks = `{ls -d /dev/sd* | uniq} anydisk = 'false' for(i in $disks){ if(test -f $i/data){ full = `{ls -l $i/data} disk = `{echo $full | awk -F '/' '{print $3}'} size = `{echo $full | awk '{print $6}'} echo $disk^': '^`{echo $size^' / 1024 / 1024 /1024' | bc}^GB anydisk = 'true' } } if(~ $anydisk -c 'false') echo Running in the diskless } fn fs { if(ls /srv | grep -s '*.cmd') ls /srv/*.cmd | sed 's/.cmd//g' | sed 's/\/srv\///g' if(test -f /srv/fscons) echo fossil # Logic from storage to scrape for venti arenas v='false' disks = `{ls -d /dev/sd* | uniq} for(i in $disks){ if(ls $i | grep -s arena) v='true' } if(~ $v -c 'true') echo venti } fn cpuid { if(test -f /bin/aux/cpuid) aux/cpuid >[2]/dev/null | grep procname | sed 's/.*procname//' } os=`{ if(grep -s 'zrv' /dev/drivers) echo 9ants if not if(grep -s 'vmx' /dev/drivers) echo 9front if not echo Bell Labs } # fs and storage require #S bound on /dev bind -b '#S' /dev arch=`{echo $cputype} shell=/bin/rc uptime=`{uptime| sed 's/.*up//; s/..........$//'} scr=`{dd -count 1 < /dev/screen|[2];} scr=($scr(4) x $scr(5)) ram=(`{tr / ' '