├── README.md ├── gfetch.png └── gfetch.rc /README.md: -------------------------------------------------------------------------------- 1 | ## gfetch 2 | glenda fetch for 9front. 3 | 4 | ![](gfetch.png) 5 | -------------------------------------------------------------------------------- /gfetch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arwn/gfetch/d4481779782b3036a30efd3e9461cda7aa8434df/gfetch.png -------------------------------------------------------------------------------- /gfetch.rc: -------------------------------------------------------------------------------- 1 | #!/bin/rc 2 | # Warning, parts of this script have been STOLEN! 3 | 4 | # TODO: 5 | # fs usage 6 | # kernel 7 | 8 | fn storage { 9 | disks = `{ls -d /dev/sd* | uniq} 10 | anydisk = 'false' 11 | for(i in $disks){ 12 | if(test -f $i/data){ 13 | full = `{ls -l $i/data} 14 | disk = `{echo $full | awk -F '/' '{print $3}'} 15 | size = `{echo $full | awk '{print $6}'} 16 | echo $disk^': '^`{echo $size^' / 1024 / 1024 /1024' | bc}^GB 17 | anydisk = 'true' 18 | } 19 | } 20 | if(~ $anydisk -c 'false') 21 | echo Running in the diskless 22 | } 23 | 24 | fn fs { 25 | if(ls /srv | grep -s '*.cmd') 26 | ls /srv/*.cmd | sed 's/.cmd//g' | sed 's/\/srv\///g' 27 | if(test -f /srv/fscons) 28 | echo fossil 29 | # Logic from storage to scrape for venti arenas 30 | v='false' 31 | disks = `{ls -d /dev/sd* | uniq} 32 | for(i in $disks){ 33 | if(ls $i | grep -s arena) 34 | v='true' 35 | } 36 | if(~ $v -c 'true') 37 | echo venti 38 | } 39 | 40 | fn cpuid { 41 | if(test -f /bin/aux/cpuid) 42 | aux/cpuid >[2]/dev/null | grep procname | sed 's/.*procname//' 43 | } 44 | 45 | os=`{ 46 | if(grep -s 'zrv' /dev/drivers) 47 | echo 9ants 48 | if not if(grep -s 'vmx' /dev/drivers) 49 | echo 9front 50 | if not 51 | echo Bell Labs 52 | } 53 | 54 | # fs and storage require #S bound on /dev 55 | bind -b '#S' /dev 56 | 57 | arch=`{echo $cputype} 58 | shell=/bin/rc 59 | uptime=`{uptime| sed 's/.*up//; s/..........$//'} 60 | if(test -f /dev/screen) scr=`{dd -count 1 < /dev/screen|[2];} 61 | scr=($scr(4) x $scr(5)) 62 | ram=(`{tr / ' '