Elektra
0.8.23
|
The blockresolver
can be used to only resolve a tagged block inside a configuration file.
blockresolver
extracts the requested block from the configurations file and writes it into a temporary file. Afterwards Elektra will only work on the temporary file until kdbSet is called. On kdbSet the contents of the temporary file will be merged with parts outside of the requested block from the original file.
`kdb mount -R blockresolver /path/to/my/file /mountpoint -c identifier="identifier-tag"`
where identifier
specifies the tag blockresolver
will search for in the configuration file.
A block consists of 2 parts:
start
stop
Currently the identifier must be unique.
```
kdb set system/test/blockfile echo 'text' > $(kdb get system/test/blockfile) echo 'more text' >> $(kdb get system/test/blockfile) echo 'some more text' >> $(kdb get system/test/blockfile) echo '>>> block config start' >> $(kdb get system/test/blockfile) echo '[section1]' >> $(kdb get system/test/blockfile) echo 'key1 = val1' >> $(kdb get system/test/blockfile) echo '[section2]' >> $(kdb get system/test/blockfile) echo 'key2 = val2' >> $(kdb get system/test/blockfile) echo '>>> block config stop' >> $(kdb get system/test/blockfile) echo 'text again' >> $(kdb get system/test/blockfile) echo 'and more text' >> $(kdb get system/test/blockfile) echo 'text' >> $(kdb get system/test/blockfile)
sudo kdb mount -R blockresolver $(kdb get system/test/blockfile) system/examples/blockresolver -c identifier=">>> block config" ini
cat $(kdb get system/test/blockfile) #> text #> more text #> some more text #> >>> block config start #> [section1] #> key1 = val1 #> [section2] #> key2 = val2 #> >>> block config stop #> text again #> and more text #> text
kdb export system/examples/blockresolver ini #> [section1] #> key1 = val1 #> [section2] #> key2 = val2
kdb set system/examples/blockresolver/section1/key12 val12
cat $(kdb get system/test/blockfile) #> text #> more text #> some more text #> >>> block config start #> [section1] #> key1 = val1 #> key12 = val12 #> [section2] #> key2 = val2 #> >>> block config stop #> text again #> and more text #> text
kdb rm -r system/examples/blockresolver rm $(kdb get system/test/blockfile) kdb rm system/test/blockfile sudo kdb umount system/examples/blockresolver ```