mirror of
https://github.com/foo-dogsquared/website.git
synced 2025-01-30 22:57:59 +00:00
fetch-mutable-files: add the shell script for the service
This commit is contained in:
parent
99e69636fc
commit
bed7a26c7f
@ -77,8 +77,22 @@ in
|
||||
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
# TODO: Complete this
|
||||
ExecStart = "";
|
||||
ExecStart = let
|
||||
curl = "${lib.getBin pkgs.curl}/bin/curl";
|
||||
git = "${lib.getBin pkgs.curl}/bin/git";
|
||||
fetchCmds = lib.mapAttrsToList (file: value:
|
||||
let
|
||||
inherit (value) type;
|
||||
path = lib.escapeShellArg value.path;
|
||||
url = lib.escapeURL value.url;
|
||||
in ''
|
||||
${lib.optionalString (type == "git") "[ -d ${path} ] || ${git} clone ${url} ${path}"}
|
||||
${lib.optionalString (type == "fetch") "[ -d ${path} ] || ${curl} ${url} --output ${path}"}
|
||||
'') cfg;
|
||||
shellScript = pkgs.writeShellScript "fetch-mutable-files" ''
|
||||
${lib.concatStringsSep "\n" fetchCmds}
|
||||
'';
|
||||
in builtins.toString shellScript;
|
||||
};
|
||||
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
|
Loading…
Reference in New Issue
Block a user