Last active
December 10, 2015 00:48
-
-
Save mat813/4353607 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
Module: FreeBSD Update | |
parses /etc/freebsd-update.conf | |
Author: Mathieu Arnold <[email protected]> | |
About: Reference | |
This lens tries to keep as close as possible to `man 5 freebsd-update.conf`. | |
An online source being : | |
http://www.freebsd.org/cgi/man.cgi?query=freebsd-update.conf&sektion=5 | |
About: Licence | |
This file is licensed under the BSD License. | |
About: Lens Usage | |
To be documented | |
About: Configuration files | |
This lens applies to /etc/freebsd-update.conf. See <filter>. | |
*) | |
module Freebsd_Update = | |
autoload xfm | |
let empty = Util.empty | |
let word = /[A-Za-z0-9]+/ | |
let single_parameters = ( "KeyPrint" | "ServerName" | "WorkDir" | | |
"MailTo" | "AllowAdd" | "AllowDelete" | "KeepModifiedMetadata" | | |
"KeepModifiedMetadata" | "StrictComponents" | "BackupKernel" | | |
"BackupKernelDir" | "BackupKernelSymbolFiles" ) | |
let multiple_parameters = ( "Components" | "IgnorePaths" | | |
"IDSIgnorePaths" | "UpdateIfUnmodified" | "MergeChanges" ) | |
let key_value = Build.key_value_line_comment single_parameters Sep.space (store Rx.neg1) Util.comment_eol | |
let key_list = | |
let item = [ label "item" . store Rx.neg1 ] | |
in [ key multiple_parameters . (Sep.space . Build.opt_list item Sep.space)? . Util.comment_or_eol ] | |
(* View: lns | |
*) | |
let lns = ( Util.comment | Util.empty | key_value | key_list )* | |
(* Variable: filter | |
all you need is /etc/freebsd-update.conf | |
*) | |
let filter = incl "/etc/freebsd-update.conf" | |
let xfm = transform lns filter | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Test_freebsd_update = | |
let conf="# $FreeBSD: src/etc/freebsd-update.conf,v 1.6.2.2.8.1 2012/03/03 06:15:13 kensmith Exp $ | |
# Trusted keyprint. Changing this is a Bad Idea unless you've received | |
# a PGP-signed email from <[email protected]> telling you to | |
# change it and explaining why. | |
KeyPrint 800651ef4b4c71c27e60786d7b487188970f4b4169cc055784e21eb71d410cc5 | |
# Components of the base system which should be kept updated. | |
Components src world kernel | |
# Paths which start with anything matching an entry in an IgnorePaths | |
# statement will be ignored. | |
IgnorePaths | |
IDSIgnorePaths /usr/share/man/cat | |
IDSIgnorePaths /usr/share/man/whatis | |
IDSIgnorePaths /var/db/locate.database | |
IDSIgnorePaths /var/log | |
# modified by the user (unless changes are merged; see below). | |
UpdateIfUnmodified /etc/ /var/ /root/ /.cshrc /.profile | |
" | |
test Freebsd_Update.lns get conf = | |
{ "#comment" = "$FreeBSD: src/etc/freebsd-update.conf,v 1.6.2.2.8.1 2012/03/03 06:15:13 kensmith Exp $" } | |
{ } | |
{ "#comment" = "Trusted keyprint. Changing this is a Bad Idea unless you've received" } | |
{ "#comment" = "a PGP-signed email from <[email protected]> telling you to" } | |
{ "#comment" = "change it and explaining why." } | |
{ "KeyPrint" = "800651ef4b4c71c27e60786d7b487188970f4b4169cc055784e21eb71d410cc5" } | |
{ } | |
{ "#comment" = "Components of the base system which should be kept updated." } | |
{ "Components" | |
{ "item" = "src" } | |
{ "item" = "world" } | |
{ "item" = "kernel" } | |
} | |
{ } | |
{ "#comment" = "Paths which start with anything matching an entry in an IgnorePaths" } | |
{ "#comment" = "statement will be ignored." } | |
{ "IgnorePaths" } | |
{ } | |
{ "IDSIgnorePaths" | |
{ "item" = "/usr/share/man/cat" } | |
} | |
{ "IDSIgnorePaths" | |
{ "item" = "/usr/share/man/whatis" } | |
} | |
{ "IDSIgnorePaths" | |
{ "item" = "/var/db/locate.database" } | |
} | |
{ "IDSIgnorePaths" | |
{ "item" = "/var/log" } | |
} | |
{ } | |
{ "#comment" = "modified by the user (unless changes are merged; see below)." } | |
{ "UpdateIfUnmodified" | |
{ "item" = "/etc/" } | |
{ "item" = "/var/" } | |
{ "item" = "/root/" } | |
{ "item" = "/.cshrc" } | |
{ "item" = "/.profile" } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment