diff options
Diffstat (limited to 'modules/services')
-rw-r--r-- | modules/services/cgit/default.nix | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/services/cgit/default.nix b/modules/services/cgit/default.nix index 87cc72c..0ac6a58 100644 --- a/modules/services/cgit/default.nix +++ b/modules/services/cgit/default.nix @@ -55,11 +55,13 @@ in { serviceConfig.Type = "oneshot"; script = '' mkdir -p /var/lib/cgit/cache + tmplist=$(mktemp) # as per https://gerrit-review.googlesource.com/Documentation/rest-api.html#output we need to remove `)]}' from the response repos=$(${pkgs.curl}/bin/curl -s -H "Content-Type: application/json" "https://cl.fcuny.net/projects/?state=ACTIVE"|sed "s/^)]}'//"|${pkgs.jq}/bin/jq -r 'to_entries | .[] | .value | .id') for repo in ''${repos}; do - grep "/var/lib/gerrit/git/''${repo}.git" /var/lib/cgit/cache/projects.list || echo "/var/lib/gerrit/git/''${repo}.git" >> /var/lib/cgit/cache/projects.list + echo "/var/lib/gerrit/git/''${repo}.git" >> $tmplist done + mv $tmplist /var/lib/cgit/cache/projects.list ''; }; }; |