master
cmd.scm
1;; (open-input-pipe (format #t "echo ~a" (cadr (command-line))))
2
3(define (_system . a)
4 (let* ((p (apply open-pipe* OPEN_READ a))
5 (s (read-string p)))
6 (close-pipe p)s))
7
8(define (mkdir-p p)
9 (unless (file-exists? p)
10 (mkdir-p (dirname p))
11 (mkdir p))
12 )
13
14(define (info a)
15 (format #t "\x1b[m\x1b[37m=>\x1b[m ~a~%" a))
16
17(define (msg b a)
18 (format #t "\x1b[m\x1b[32m~a\x1b[m ~a~%" a b))
19(define (pmsg a b)
20 (format #t "\x1b[m\x1b[31m(~a)\x1b[m ~a~%" a b))
21
22(define (_warn a)
23 (format #t "\x1b[m\x1b[33mwarning: \x1b[m~a~%" a))
24(define (die a n)
25 (format #t "\x1b[m\x1b[31mERROR: \x1b[m~a~%" a)(quit n))
26
27(define (desc)
28;; (seteuid (passwd:uid (getpwnam (getenv "DOAS_USER"))))
29 (seteuid 0)
30 )
31
32(define (usage)
33 (format #t "usage: ~a <cmd> <pkgs>~%" DULL)
34 (format #t " ~a h~%" DULL)
35 (format #t " ~a u~%" DULL)
36 (format #t " ~a b|i|c|d <pkgs>~%" DULL)
37 (format #t " ~a m|f|s <pkgs>~%" DULL)
38 )