Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse and apply tmpfiles config file before writing out any content #72

Merged
merged 11 commits into from
Jul 27, 2017

Conversation

bcl
Copy link
Contributor

@bcl bcl commented Jul 26, 2017

No description provided.

@clumens
Copy link
Contributor

clumens commented Jul 27, 2017

You may want to check out the hlint suggestions that travis printed out. Otherwise, that hint should get disabled locally. It's sometimes useful.

bcl added 9 commits July 27, 2017 13:58
Only the tmpfile types needed for Export are supported, all others will
be parsed as tfeType = Unsupported

Use it like so:

    import TmpFiles(parseConfString)
    cfg <- readFile "data/tmpfiles-default.conf"
    parseConfString cfg

Output will look like:

Right [TmpFileEntry {tfeType = NewFile,
                     tfePath = "path",
                     tfeMode = Just 384,
                     tfeUid = Just "root",
                     tfeGid = Just "root",
                     tfeAge = Just "5d",
                     tfeArg = Nothing}]
When records are sorted the directory ones should be first, followed by
symlink, file and then the rest. Sort by path within each type.
This implements limited support for tmpfiles.d file and directory
creation. Only the following are supported:

f    Create a new file and optionally write the arg to it. Will not overwrite.
F    Remove existing file and make a new one, optionally writing arg to it.
d    Create a new directory, only if it doesn't exist.
e    Modify an existing directory's ownership and permissions
L    Create a new symlink. Do nothing if it already exists.
L+   Remove file, directory tree, or symlink before creating it.
     WARNING this will remove a whole directory tree.
If the parser fails it will now print out the error string.
If an entry is skipped it will now print that instead of being silent.
The tmpfiles.d snippet in data/tmpfiles-default.conf will now be
processed before the content is written to the target directory when
creating qcow2 images and directory trees.
Remove unneeded entries, and sort them for easier reading.
(They don't need to be in order for processing, setupFilesystem takes
care of that, this is purely cosmetic).
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.8%) to 77.235% when pulling 9512d88 on bcl:master-parse-tmpfiles into 2094638 on weldr:master.

@bcl bcl merged commit 9512d88 into weldr:master Jul 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants