git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/sks: Fix another regression from ab5dcc7068b

The two directories KDB and PTree do not exist before the SKS DB is build for the first time. If /var/db/sks is empty and the module is enabled via "services.sks.enable = true;" the following error will occur: ...-unit-script-sks-db-pre-start[xxx]: ln: failed to create symbolic link 'KDB/DB_CONFIG': No such file or directory To avoid this both links have to be created after the DB is build. Note: Creating the directories manually might be better but the initial build might be skipped as a result: unit-script-sks-db-pre-start[xxxxx]: KeyDB directory already exists. Exiting. unit-script-sks-db-pre-start[xxxxx]: PTree directory already exists. Exiting.

commit6852c080d8b5d2e88ca063b02de8bbdd5eb8970c authorMichael Weiss <dev.primeos@gmail.com> dateSun 28 Apr 2019, 14:18 (8 years ago) parent9dd1bbc
1 file changed+13−11
nixos/modules/services/security/sks.nix+13−11
nixos/modules/services/security/sks.nix+13−11
@@ -116,20 +116,22 @@ in {
116116 ${lib.optionalString (cfg.webroot != null)
117117 "ln -sfT \"${cfg.webroot}\" web"}
118118 mkdir -p dump
119− # Check that both database configs are symlinks before overwriting them
120− if [ -e KDB/DB_CONFIG ] && [ ! -L KDB/DB_CONFIG ]; then
121− echo "KDB/DB_CONFIG exists but is not a symlink." >&2
122− exit 1
123− fi
124− if [ -e PTree/DB_CONFIG ] && [ ! -L PTree/DB_CONFIG ]; then
125− echo "PTree/DB_CONFIG exists but is not a symlink." >&2
126− exit 1
127− fi
128− ln -sf ${dbConfig} KDB/DB_CONFIG
129− ln -sf ${dbConfig} PTree/DB_CONFIG
130119 ${sksPkg}/bin/sks build dump/*.gpg -n 10 -cache 100 || true #*/
131120 ${sksPkg}/bin/sks cleandb || true
132121 ${sksPkg}/bin/sks pbuild -cache 20 -ptree_cache 70 || true
122+ # Check that both database configs are symlinks before overwriting them
123+ # TODO: The initial build will be without DB_CONFIG, but this will
124+ # hopefully not cause any significant problems. It might be better to
125+ # create both directories manually but we have to check that this does
126+ # not affect the initial build of the DB.
127+ for CONFIG_FILE in KDB/DB_CONFIG PTree/DB_CONFIG; do
128+ if [ -e $CONFIG_FILE ] && [ ! -L $CONFIG_FILE ]; then
129+ echo "$CONFIG_FILE exists but is not a symlink." >&2
130+ echo "Please remove $PWD/$CONFIG_FILE manually to continue." >&2
131+ exit 1
132+ fi
133+ ln -sf ${dbConfig} $CONFIG_FILE
134+ done
133135 '';
134136 serviceConfig = {
135137 WorkingDirectory = "~";