master chld/dot / bin / fetch
 1#!/usr/bin/env guile
 2!#
 3
 4(use-modules
 5 (ice-9 popen)
 6 (ice-9 rdelim)
 7 (srfi srfi-1))
 8
 9(define (system-output . a)
10  (let*  ((p (apply open-pipe* OPEN_READ a))
11	  (s (read-string p)))
12    (close-pipe p)s))
13
14(let* ( 
15       (f (call-with-input-file "/etc/os-release" (lambda (s)
16						    (string-split (read-string s) #\newline)
17						    )))
18       (os (string-trim (cadr (string-split (last
19					     (string-split 
20					      (list-ref f (list-index (lambda (s) (string-contains s "PRETTY_NAME")) f))
21					      #\=)
22					     ) #\"))
23			))
24       (pkg (- (length
25		(string-split (system-output "apk" "list" "--installed") #\newline)) 1)
26	    )
27
28       (fmem (call-with-input-file "/proc/meminfo" (lambda (s)
29						     (string-split (read-string s) #\newline))))
30       (ms (make-struct/no-tail (make-vtable "pwpw") 0 0))
31       (mem
32	0
33	)
34       )
35
36  (format #t "os: ~a~%" os)
37  (format #t "pkg: ~a~%" pkg)
38
39
40  )