Skip to content
Snippets Groups Projects
Unverified Commit 813bcbc4 authored by Ludovic Courtès's avatar Ludovic Courtès
Browse files

bournish: Add 'reboot' command.

Suggested by Ricardo Wurmus.

* guix/build/bournish.scm (reboot-command): New procedure.
(%commands): Add it.
parent 7c515a43
No related branches found
No related tags found
No related merge requests found
...@@ -162,6 +162,17 @@ (define (wc-command . args) ...@@ -162,6 +162,17 @@ (define (wc-command . args)
(else (else
`((@@ (guix build bournish) wc-command-implementation) ,@args)))) `((@@ (guix build bournish) wc-command-implementation) ,@args))))
(define (reboot-command . args)
"Emit code for 'reboot'."
;; Normally Bournish is used in the initrd, where 'reboot' is provided
;; directly by (guile-user). In other cases, just bail out.
`(if (defined? 'reboot)
(reboot)
(begin
(format (current-error-port)
"I don't know how to reboot, sorry about that!~%")
#f)))
(define (help-command . _) (define (help-command . _)
(display "\ (display "\
Hello, this is Bournish, a minimal Bourne-like shell in Guile! Hello, this is Bournish, a minimal Bourne-like shell in Guile!
...@@ -189,7 +200,8 @@ (define %commands ...@@ -189,7 +200,8 @@ (define %commands
("ls" ,ls-command) ("ls" ,ls-command)
("which" ,which-command) ("which" ,which-command)
("cat" ,cat-command) ("cat" ,cat-command)
("wc" ,wc-command))) ("wc" ,wc-command)
("reboot" ,reboot-command)))
(define (read-bournish port env) (define (read-bournish port env)
"Read a Bournish expression from PORT, and return the corresponding Scheme "Read a Bournish expression from PORT, and return the corresponding Scheme
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment