-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nixos/logrotate: Copy default configFile to /etc
When running logrotate in a user namespaced environment, such as an nspawn container with PrivateUsers=pick, logrotate may refuse to start as its config file is not owned by root. Using environment.etc we can copy the file from the store and set the proper permissions during activation.
- Loading branch information
Showing
2 changed files
with
20 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,15 +103,13 @@ import ./make-test-python.nix ({ pkgs, ... }: rec { | |
machine.succeed("systemctl cat logrotate.service | grep -- --mail") | ||
with subtest("check generated config matches expectation"): | ||
machine.succeed( | ||
# copy conf to /tmp/logrotate.conf for easy grep | ||
"conf=$(systemctl cat logrotate | grep -oE '/nix/store[^ ]*logrotate.conf'); cp $conf /tmp/logrotate.conf", | ||
"! grep weekly /tmp/logrotate.conf", | ||
"grep -E '^delaycompress' /tmp/logrotate.conf", | ||
"tail -n 1 /tmp/logrotate.conf | grep shred", | ||
"sed -ne '/\"sendmail\" {/,/}/p' /tmp/logrotate.conf | grep 'mail [email protected]'", | ||
"sed -ne '/\"postrotate\" {/,/}/p' /tmp/logrotate.conf | grep endscript", | ||
"grep '\"file1\"\n\"file2\" {' /tmp/logrotate.conf", | ||
"sed -ne '/\"import\" {/,/}/p' /tmp/logrotate.conf | grep noolddir", | ||
"! grep weekly /etc/logrotate.conf", | ||
"grep -E '^delaycompress' /etc/logrotate.conf", | ||
"tail -n 1 /etc/logrotate.conf | grep shred", | ||
"sed -ne '/\"sendmail\" {/,/}/p' /etc/logrotate.conf | grep 'mail [email protected]'", | ||
"sed -ne '/\"postrotate\" {/,/}/p' /etc/logrotate.conf | grep endscript", | ||
"grep '\"file1\"\n\"file2\" {' /etc/logrotate.conf", | ||
"sed -ne '/\"import\" {/,/}/p' /etc/logrotate.conf | grep noolddir", | ||
) | ||
# also check configFile option | ||
failingMachine.succeed( | ||
|