mirror of
https://github.com/foo-dogsquared/website.git
synced 2025-01-31 01:57:54 +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";
|
Type = "oneshot";
|
||||||
RemainAfterExit = true;
|
RemainAfterExit = true;
|
||||||
# TODO: Complete this
|
ExecStart = let
|
||||||
ExecStart = "";
|
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" ];
|
Install.WantedBy = [ "default.target" ];
|
||||||
|
Loading…
Reference in New Issue
Block a user