J S
283997b609
I updated the regex used in split-line to account for and discard comments. I also updated it to account for multiple = signs, such as in environment variable definitions. |
||
---|---|---|
src | ||
LICENSE | ||
packages.lisp | ||
README.org | ||
systemd-parse.asd |
Readme
Systemd-parse is a common lisp library to parse .service
files into useable data structures, and vice versa.
It currently provides two functions: read-service
and write-service
Read-service
read-service
takes a .service
file and returns an association list.
The list associates section names with a hash table of the options under each section.
(read-service "dbus.service")
The following sample is taken from dbus.service
:
[Unit] Description=D-Bus System Message Bus Documentation=man:dbus-broker-launch(1) [Service] Type=notify Sockets=dbus.socket OOMScoreAdjust=-900 [Install] Alias=dbus.service
This file is parsed into the following lisp structure: (I illustrate each table as "<table /content/>")
(("Unit" . <table "Description" -> "D-Bus System Message Bus"
"Documentation" -> "man:dbus-broker-launch(1)">)
("Service" . <table "Type" -> "notify"
"Sockets" -> "dbus.socket"
"OOMScoreAdjust" -> "-900">)
("Install" . <table "Alias" -> "dbus.service">))
Write-service
write-service
translates the association list back into a .service
file.
(write-service "test.service" my-service-options-list)