D | |
daemon, Hosts_Access | |
daemon_list, Hosts_Access | |
database | |
database_kw, Nsswitch | |
dayofmonth, Cron | |
dayofweek, Cron | |
debctrl | |
debian, Grub | |
DEBIAN-SPECIFIC SECTIONS, Grub | |
debian_comment, Grub | |
debian_comment_re, Grub | |
debian_entry, Grub | |
debian_footer, Grub | |
debian_header, Grub | |
debian_setting_re, Grub | |
decimal | |
decl_def_item, Test_Xml.Xml | |
def, LVM | |
default_approx, Test_Approx | |
default_depth, Xorg | |
default_sysctl, Test_Sysctl | |
default_type, Sudoers | |
defaults | |
DEFAULTS, Sudoers | |
DEFAULTS SECTION, Mke2fs | |
defaults_entry, Mke2fs | |
defaults_title, Mke2fs | |
Define comment and defaults, IniFile | |
del_negate, Sudoers | |
del_opt_ws, Util | |
del_str, Util | |
del_to_eol, Grub | |
del_ws, Util | |
del_ws_spc, Util | |
del_ws_tab, Util | |
delay, Anacron | |
delim, Util | |
dels, Grub | |
desc, Test_Systemd | |
description, Schroot | |
Description | |
Desktop | |
destination | |
device | |
device_name, Rx | |
device_re, Ntpd | |
Dhcpd | |
disk, FAI_DiskConfig | |
disk_config | |
disk_config_entry, FAI_DiskConfig | |
disk_free_limit | |
disk_list, FAI_DiskConfig | |
disk_with_opt, FAI_DiskConfig | |
display, Xorg | |
DISPLAY SUBSECTION, Xorg | |
display_entry, Xorg | |
display_modes, Xorg | |
dn, Automaster | |
Dns_Zone | |
do_dquote, Quote | |
do_dquote_opt, Quote | |
do_dquote_opt_nil, Quote | |
do_quote, Quote | |
do_squote, Quote | |
do_squote_opt, Quote | |
do_squote_opt_nil, Quote | |
doc, Test_Xml.Xml | |
doctype, Test_Xml.Xml | |
domain, Resolv | |
doseol, Util | |
dot, Syslog | |
double | |
double_opt | |
double_opt_allow_spc, Test_Quote | |
double_opt_re, Quote | |
Dovecot | |
Dpkg | |
dquote, Quote | |
dquote_opt, Quote | |
dquote_opt_nil | |
dquote_spaces | |
driver, Xorg | |
duration, Xymon_Alerting |
let daemon = let host = [ label "host" . Util.del_str "@" . list_item ] in [ label "process" . list_item . host? ]
A list of daemons
let daemon_list = Build.opt_list daemon list_sep
let database = [ label "database" . store database_kw . sep_colon . (Build.opt_list (service|reaction) Sep.space) . Util.eol ]
TODO: support for quoted strings
let database = comma_sep_list "database"
The database specification like `passwd’, `shadow’, or `hosts’
let database_kw = Rx.word
let dayofmonth = [ label "dayofmonth" . store num ]
let dayofweek = [ label "dayofweek" . store alphanum ]
A debian-specific section, made of debian_entry lines
let debian = [ label "debian" . del debian_header debian_header . (debian_comment|empty|debian_entry)* . del debian_footer debian_footer ]
A comment entry inside a debian-specific section
let debian_comment = [ Util.indent . label "#comment" . del /##[ \t]*/ "## " . store debian_comment_re . eol ]
let debian_comment_re = /([^ \t\n].*[^ \t\n]|[^ \t\n])/ - "## End Default Options ##"
let debian_entry = [ Util.del_str "#" . Util.indent . key debian_setting_re . del /[ \t]*=/ "=" . value_to_eol? . eol ]
Footer for a debian-specific section
let debian_footer = "## ## End Default Options ##\n"
Header for a debian-specific section
let debian_header = "## ## Start Default Options ##\n"
let debian_setting_re = "kopt" | "groot" | "alternative" | "lockalternative" | "defoptions" | "lockold" | "xenhopt" | "xenkopt" | "altoptions" | "howmany" | "memtest86" | "updatedefaultentry" | "savedefault" | "indomU"
let decimal = Rx.decimal
Store a decimal value
let decimal = store /[0-9]+(.[0-9]+)?/
A decimal value (using ‘,’ or ‘.’
let decimal = /[0-9]+([.,][0-9]+)?/
!ELEMENT declaration tags are mapped in “!ELEMENT” nodes.
test Xml.decl_def_item get "<!ELEMENT greeting (#PCDATA)>" = { "!ELEMENT" = "greeting" { "#decl" = "(#PCDATA)" } }
A full configuration
let default_approx = "# The following are the defaults, so there is no need # to uncomment them unless you want a different value. # See approx.conf(5) for details. $interface any $port 9999 $interval 720 $max_wait 10 $max_rate unlimited $debug false # Here are some examples of remote repository mappings. # See http://www.debian.org/mirror/list for mirror sites. debian http://ftp.nl.debian.org/debian debian-volatile http://ftp.nl.debian.org/debian-volatile security http://security.debian.org "
let default_depth = entry_int "DefaultDepth" /[dD]efault[dD]epth/
let default_sysctl = "# Kernel sysctl configuration file # Controls IP packet forwarding net.ipv4.ip_forward = 0 net.ipv4.conf.default.rp_filter = 1 net.ipv4.conf.default.accept_source_route = \t0 kernel.sysrq = 0 ; Semicolon comments are also allowed net.ipv4.tcp_mem = \t393216 524288 786432 "
Type definition for defaults
let default_type = let value = store /[@:!>][^ \t\n\\]+/ in [ label "type" . value ]
A defaults section
let defaults = IniFile.record defaults_title ((Util.indent . (defaults_entry|common_entry)) | comment)
A Defaults entry
let defaults = [ indent . key "Defaults" . default_type? . sep_cont . parameter_list . comment_or_eol ]
Possible entries under the defaults section
let defaults_entry = entry_sto "force_undo" ("true"|"false") | entry_sto "fs_type" Rx.word | entry_sto "undo_dir" Rx.fspath | list_sto "default_mntopts" (key Rx.word) | entry_sto "enable_periodic_fsck" Rx.integer
Title for the defaults section
let defaults_title = IniFile.title "defaults"
Delete an even number of ‘!’
let del_negate = del /(!!)*/ ""
Delete optional whitespace
let del_opt_ws = del /[ \t]*/
Delete a string and default to it
let del_str (s:string) = del s s
let del_to_eol = del /[^ \t\n]*/ ""
Delete mandatory whitespace
let del_ws = del /[ \t]+/
Delete mandatory whitespace, default to single space
let del_ws_spc = del_ws " "
Delete mandatory whitespace, default to single tab
let del_ws_tab = del_ws "\t"
The delay for an entry
let delay = [ label "delay" . store Rx.integer ]
let delim (op:string) = del (/[ \t]*/ . op . /[ \t]*/) (" " . op . " ")
let dels (s:string) = Util.del_str s
let desc = "[Unit] Description=RPC Description=RPC bind service Description=RPC bind\\ service Description= Resets System Activity Logs "
Descriptions are special entries, which can have an optional lang parameter
let description = let lang = [ Util.del_str "[" . label "lang" . store IniFile.entry_re . Util.del_str "]" ] in IniFile.entry_generic_nocomment (key "description" . lang?) sep "#" comment
Can be either a word (no spaces included) or a command with spaces
let destination = ( word | command )
let destination = [ label "destination" . word ]
let device = [ label "device" . store Rx.fspath ]
This is a shell-only directive in upstream grub; the grub versions in at least Fedora/RHEL use this to find devices for UEFI boot
let device = [ command "device" "" . Sep.space . store /\([A-Za-z0-9_.-]+\)/ . spc . [ label "file" . value_to_eol ] . Util.eol ]
let device = entry_str "Device" /[dD]evice/
A Linux device name like eth0 or i2c-0.
let device_name = /[a-zA-Z0-9_?.+:!-]+/
let device_re = Rx.device_name | /\*/
let disk = [ label "disk" . store /[^., \t\n]+/ . partition? ]
let disk_config = let excludes = "lvm" | "raid" | "end" | /disk[0-9]+/ | "cryptsetup" | "tmpfs" in let other_label = Rx.fspath - excludes in disk_config_entry "lvm" lvmoption volume_lvm | disk_config_entry "raid" raidoption volume_raid | disk_config_entry "tmpfs" option volume_tmpfs | disk_config_entry "end" option volume (* there shouldn't be an option here *) | disk_config_entry /disk[0-9]+/ option volume | disk_config_entry "cryptsetup" cryptoption volume_cryptsetup | disk_config_entry other_label option volume
Test FAI_DiskConfig.disk_config
test FAI_DiskConfig.disk_config get "disk_config hda preserve_always:6,7 disklabel:msdos bootable:3\n" = { "disk_config" = "hda" { "preserve_always" { "1" = "6" } { "2" = "7" } } { "disklabel" = "msdos" } { "bootable" = "3" } }
let disk_config_entry (kw:regexp) (opt:lens) (vol:lens) = [ key "disk_config" . space . store kw . (space . opt)* . eol . (volume_or_comment vol)? ]
let disk_free_limit = let value = Erlang.integer | Erlang.tuple Erlang.bare Erlang.decimal in Erlang.value "disk_free_limit" value
test Rabbitmq.disk_free_limit get "{disk_free_limit, 1000000000}" = { "disk_free_limit" = "1000000000" }
A list of disk_with_opts
let disk_list = Build.opt_list disk_with_opt Sep.comma
A disk with a spare/missing option for raids
let disk_with_opt = [ label "disk" . store /[^:., \t\n]+/ . partition? . spare_missing* ]
let display = [ indent . del "SubSection" "SubSection" . sep_spc . sep_dquote . key "Display" . sep_dquote . eol . display_entry* . indent . del "EndSubSection" "EndSubSection" . eol ]
Known values for entries in the Display subsection
let display_entry = entry_int "Depth" /[dD]epth/ | entry_int "FbBpp" /[fF]b[bB]pp/ | entry_rgb "Weight" /[wW]eight/ | entry_xy "Virtual" /[vV]irtual/ | entry_xy "ViewPort" /[vV]iew[pP]ort/ | display_modes | entry_str "Visual" /[vV]isual/ | entry_rgb "Black" /[bB]lack/ | entry_rgb "White" /[wW]hite/ | entry_str "Options" /[oO]ptions/ | empty | comment
let display_modes = [ indent . del /[mM]odes/ "Modes" . label "Modes" . [ label "mode" . sep_spc . quoted_string_val ]+ . eol ]
let dn = /[^:# \n\t]+/
Enclose a lens in dquotes
let do_dquote (body:lens) = square dquote body dquote
Enclose a lens in optional dquotes, use dquotes by default.
let do_dquote_opt (body:lens) = square dquote_opt body dquote_opt
Enclose a lens in optional dquotes, default to no quotes.
let do_dquote_opt_nil (body:lens) = square dquote_opt_nil body dquote_opt_nil
Enclose a lens in quotes.
let do_quote (body:lens) = square quote body quote
Enclose a lens in squotes
let do_squote (body:lens) = square squote body squote
Enclose a lens in optional squotes, use squotes by default.
let do_squote_opt (body:lens) = square squote_opt body squote_opt
Enclose a lens in optional squotes, default to no quotes.
let do_squote_opt_nil (body:lens) = square squote_opt_nil body squote_opt_nil
Test input1 with Xml.doc
test Xml.doc get input1 = { "#declaration" { "#attribute" { "version" = "1.0" } { "encoding" = "UTF-8" } } } { "html" { "#text" = "\r\n " } { "head" { "#text" = "\n " } { "title" { "#text" = "Wiki" } } { "#text" = " " } } { "#text" = " " } { "body" { "#text" = " " } { "h1" { "#text" = "Augeas" } } { "#text" = " " } { "p" { "#attribute" { "class" = "main" } } { "#text" = "Augeas is now able to parse XML files!" } } { "#text" = " " } { "ul" { "#text" = "\n " } { "li" { "#text" = "Translate from XML to a tree syntax" } } { "#text" = " " } { "li" { "#text" = "Translate from the tree back to XML" } } { "#text" = " " } { "#comment" = " this is some comment " } { "#text" = " " } { "li" { "#text" = "this" } } { "#text" = " " } } { "#text" = " " } } }
!DOCTYPE tags are mapped in “!DOCTYPE” nodes.
test Xml.doctype get "<!DOCTYPE greeting:foo SYSTEM \"hello.dtd\">" = { "!DOCTYPE" = "greeting:foo" { "SYSTEM" = "hello.dtd" } }
let domain = Build.key_value_line_comment "domain" Sep.space (store Rx.word) comment_eol
Delete end of line with optional carriage return, including optional trailing whitespace
let doseol = del /[ \t]*\r?\n/ "\n"
Deletes a dot and default to it
let dot = Util.del_str "."
A double-quoted value
let double = let body = store /[^\n]*/ in do_dquote body
let double = [ label "double" . Quote.double ]
An optionaly double-quoted value Double quotes are not allowed in value Value cannot begin or end with spaces
let double_opt = let body = store double_opt_re in do_dquote_opt body
let double_opt = [ label "double_opt" . Quote.double_opt ]
let double_opt_allow_spc = let body = store /[^\n"]+/ in [ label "double" . Quote.do_dquote_opt body ]
The regexp to store when value is optionally double-quoted
let double_opt_re = /[^\n\t "]([^\n"]*[^\n\t "])?/
A double quote
let dquote = Util.del_str "\""
An optional double quote, default to double
let dquote_opt = del /"?/ "\""
An optional double quote, default to nothing
let dquote_opt_nil = del /"?/ ""
let dquote_opt_nil = let body = store Quote.double_opt_re in [ label "dquote_opt_nil" . Quote.do_dquote_opt_nil body ]?
Make double quotes mandatory if value contains spaces, and optional if value doesn’t contain spaces.
let dquote_spaces (lns1:lens) (lns2:lens) =
Make double quotes mandatory if value contains spaces, and optional if value doesn’t contain spaces.
let dquote_spaces (lns:lens) =
let driver = entry_str "Driver" /[dD]river/
The duration filter definition
let duration = [ key "DURATION" . [ label "operator" . comparison ] . [ label "value" . store_word ] ]