|
Packit Service |
a2ae7a |
(*
|
|
Packit Service |
a2ae7a |
Module: BootConf
|
|
Packit Service |
a2ae7a |
Parses (Open)BSD-stype /etc/boot.conf
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
Author: Jasper Lievisse Adriaanse <jasper@jasper.la>
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: Reference
|
|
Packit Service |
a2ae7a |
This lens is used to parse the second-stage bootstrap configuration
|
|
Packit Service |
a2ae7a |
file, /etc/boot.conf as found on OpenBSD. The format is largely MI,
|
|
Packit Service |
a2ae7a |
with MD parts included:
|
|
Packit Service |
a2ae7a |
http://www.openbsd.org/cgi-bin/man.cgi?query=boot.conf&arch=i386
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: Usage Example
|
|
Packit Service |
a2ae7a |
To be documented
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: License
|
|
Packit Service |
a2ae7a |
This file is licensed under the LGPL v2+, like the rest of Augeas.
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: Configuration files
|
|
Packit Service |
a2ae7a |
This lens applies to /etc/boot.conf.
|
|
Packit Service |
a2ae7a |
See <filter>.
|
|
Packit Service |
a2ae7a |
*)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
module BootConf =
|
|
Packit Service |
a2ae7a |
autoload xfm
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* Utility variables/functions
|
|
Packit Service |
a2ae7a |
************************************************************************)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: comment *)
|
|
Packit Service |
a2ae7a |
let comment = Util.comment
|
|
Packit Service |
a2ae7a |
(* View: empty *)
|
|
Packit Service |
a2ae7a |
let empty = Util.empty
|
|
Packit Service |
a2ae7a |
(* View: eol *)
|
|
Packit Service |
a2ae7a |
let eol = Util.eol
|
|
Packit Service |
a2ae7a |
(* View: fspath *)
|
|
Packit Service |
a2ae7a |
let fspath = Rx.fspath
|
|
Packit Service |
a2ae7a |
(* View: space *)
|
|
Packit Service |
a2ae7a |
let space = Sep.space
|
|
Packit Service |
a2ae7a |
(* View: word *)
|
|
Packit Service |
a2ae7a |
let word = Rx.word
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* View: key_opt_value_line
|
|
Packit Service |
a2ae7a |
* A subnode with a keyword, an optional part consisting of a separator
|
|
Packit Service |
a2ae7a |
* and a storing lens, and an end of line
|
|
Packit Service |
a2ae7a |
*
|
|
Packit Service |
a2ae7a |
* Parameters:
|
|
Packit Service |
a2ae7a |
* kw:regexp - the pattern to match as key
|
|
Packit Service |
a2ae7a |
* sto:lens - the storing lens
|
|
Packit Service |
a2ae7a |
************************************************************************)
|
|
Packit Service |
a2ae7a |
let key_opt_value_line (kw:regexp) (sto:lens) =
|
|
Packit Service |
a2ae7a |
[ key kw . (space . sto)? . eol ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* Commands
|
|
Packit Service |
a2ae7a |
************************************************************************)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: single_command
|
|
Packit Service |
a2ae7a |
single command such as 'help' or 'time' *)
|
|
Packit Service |
a2ae7a |
let single_command =
|
|
Packit Service |
a2ae7a |
let line_re = /help|time|reboot/
|
|
Packit Service |
a2ae7a |
in [ Util.indent . key line_re . eol ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: ls
|
|
Packit Service |
a2ae7a |
ls [directory] *)
|
|
Packit Service |
a2ae7a |
let ls = Build.key_value_line
|
|
Packit Service |
a2ae7a |
"ls" space (store fspath)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let set_cmd = "addr"
|
|
Packit Service |
a2ae7a |
| "debug"
|
|
Packit Service |
a2ae7a |
| "device"
|
|
Packit Service |
a2ae7a |
| "howto"
|
|
Packit Service |
a2ae7a |
| "image"
|
|
Packit Service |
a2ae7a |
| "timeout"
|
|
Packit Service |
a2ae7a |
| "tty"
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: set
|
|
Packit Service |
a2ae7a |
set [varname [value]] *)
|
|
Packit Service |
a2ae7a |
let set = Build.key_value
|
|
Packit Service |
a2ae7a |
"set" space
|
|
Packit Service |
a2ae7a |
(key_opt_value_line set_cmd (store Rx.space_in))
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: stty
|
|
Packit Service |
a2ae7a |
stty [device [speed]] *)
|
|
Packit Service |
a2ae7a |
let stty =
|
|
Packit Service |
a2ae7a |
let device = [ label "device" . store fspath ]
|
|
Packit Service |
a2ae7a |
in let speed = [ label "speed" . store Rx.integer ]
|
|
Packit Service |
a2ae7a |
in key_opt_value_line "stty" (device . (space . speed)?)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: echo
|
|
Packit Service |
a2ae7a |
echo [args] *)
|
|
Packit Service |
a2ae7a |
let echo = Build.key_value_line
|
|
Packit Service |
a2ae7a |
"echo" space (store word)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: boot
|
|
Packit Service |
a2ae7a |
boot [image [-acds]]
|
|
Packit Service |
a2ae7a |
XXX: the last arguments are not always needed, so make them optional *)
|
|
Packit Service |
a2ae7a |
let boot =
|
|
Packit Service |
a2ae7a |
let image = [ label "image" . store fspath ]
|
|
Packit Service |
a2ae7a |
in let arg = [ label "arg" . store word ]
|
|
Packit Service |
a2ae7a |
in Build.key_value_line "boot" space (image . space . arg)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: machine
|
|
Packit Service |
a2ae7a |
machine [command] *)
|
|
Packit Service |
a2ae7a |
let machine =
|
|
Packit Service |
a2ae7a |
let machine_entry = Build.key_value ("comaddr"|"memory")
|
|
Packit Service |
a2ae7a |
space (store word)
|
|
Packit Service |
a2ae7a |
| Build.flag ("diskinfo"|"regs")
|
|
Packit Service |
a2ae7a |
in Build.key_value_line
|
|
Packit Service |
a2ae7a |
"machine" space
|
|
Packit Service |
a2ae7a |
(Build.opt_list
|
|
Packit Service |
a2ae7a |
machine_entry
|
|
Packit Service |
a2ae7a |
space)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* Lens
|
|
Packit Service |
a2ae7a |
************************************************************************)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: command *)
|
|
Packit Service |
a2ae7a |
let command = boot | echo | ls | machine | set | stty
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: lns *)
|
|
Packit Service |
a2ae7a |
let lns = ( empty | comment | command | single_command )*
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* Variable: filter *)
|
|
Packit Service |
a2ae7a |
let filter = (incl "/etc/boot.conf")
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let xfm = transform lns filter
|