Imported Upstream version 0.10.0
[platform/upstream/augeas.git] / lenses / kdump.aug
1 (*
2 Module: Kdump
3   Parses /etc/kdump.conf
4
5 Author: Roman Rakus <rrakus@redhat.com>
6
7 About: References
8   manual page kdump.conf(5)
9
10 About: License
11    This file is licenced under the LGPLv2+, like the rest of Augeas.
12
13 About: Configuration files
14    This lens applies to /etc/kdump.conf. See <filter>.
15 *)
16
17 module Kdump =
18   autoload xfm
19
20 let empty = Util.empty
21 let comment = Util.comment
22 let value_to_eol = store Rx.space_in
23 let delimiter = Util.del_ws_spc
24 let eol = Util.eol
25 let value_to_spc = store Rx.no_spaces
26 let key_to_space = key /[A-Za-z0-9_.\$-]+/
27 let eq = Util.del_str "="
28
29 let simple_entry (kw:string) = [ key kw . delimiter . value_to_eol . eol ]
30
31 (* Got from mount(8) *)
32 let fs_types = "adfs" | "affs" | "autofs" | "cifs" | "coda" | "coherent"
33              | "cramfs" | "debugfs" | "devpts" | "efs" | "ext" | "ext2"
34              | "ext3" | "ext4" | "hfs" | "hfsplus" | "hpfs" | "iso9660"
35              | "jfs" | "minix" | "msdos" | "ncpfs" | "nfs" | "nfs4" | "ntfs"
36              | "proc" | "qnx4" | "ramfs" | "reiserfs" | "romfs" | "squashfs"
37              | "smbfs" | "sysv" | "tmpfs" | "ubifs" | "udf" | "ufs" | "umsdos"
38              | "usbfs" | "vfat" | "xenix" | "xfs" | "xiafs"
39
40 let fs = [ key fs_types . delimiter . value_to_eol . eol ]
41
42 let bin = [ seq "bin" . delimiter . value_to_spc ]
43 let extra_bins = [ key "extra_bins" . (bin)+ . eol ]
44
45 let mdl = [ seq "module" . delimiter . value_to_spc ]
46 let extra_modules = [ key "extra_modules" . (mdl)+ . eol ]
47
48
49 let mdl_key_value = [ delimiter . key_to_space . ( eq . value_to_spc)? ]
50 let mdl_options = [ key_to_space . mdl_key_value+ ]
51 let mod_options = [ key "options" . delimiter . mdl_options . eol ]
52
53
54 let option = simple_entry "raw"
55            | simple_entry "net"
56            | simple_entry "path"
57            | simple_entry "disk_timeout"
58            | simple_entry "core_collector"
59            | simple_entry "link_delay"
60            | simple_entry "kdump_post"
61            | simple_entry "kdump_pre"
62            | simple_entry "default"
63            | fs
64            | extra_bins
65            | extra_modules
66            | mod_options
67
68 (* View: lns
69    The options lens
70 *)
71 let lns = ( empty | comment | option )*
72
73 let filter = incl "/etc/kdump.conf"
74
75 let xfm = transform lns filter