systemd-parse/README.org
J S 3eb4b2d5d8
feat[license,split-line,readme] Added docs.
I added a documentation readme.
I added a license (GPLv3)

SPLIT-LINE now deletes SETTING from the hash-table if it is passed "SETTING=nil".
READ-SYSTEM now explicitly uses string= to identify sections in the
associative list.
2023-12-19 23:12:10 -05:00

1.3 KiB

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)