Skip to content

Instantly share code, notes, and snippets.

@raphink
Forked from mat813/freebsd_update.aug
Last active December 10, 2015 00:48
Show Gist options
  • Save raphink/4353731 to your computer and use it in GitHub Desktop.
Save raphink/4353731 to your computer and use it in GitHub Desktop.
(*
Module: FreeBSD Update
parses /etc/freebsd-update.conf
Author: Mathieu Arnold <[email protected]>
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 comment = Util.comment_eol
let eol = Util.eol
let empty = Util.empty
let word = /[A-Za-z0-9]+/
let single_parameters = ( "KeyPrint" | "ServerName" )
let multiple_parameters = ( "Components" | "IgnorePaths" | "IDSIgnorePaths" | "UpdateIfUnmodified" )
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 = ( comment | 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
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" }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment