Create rclone
syncs during setup
This commit is contained in:
parent
3135643d3f
commit
aa2e535968
|
@ -8,6 +8,11 @@
|
|||
syncType = types.submodule (
|
||||
{ ... }: {
|
||||
options = {
|
||||
dirName = mkOption {
|
||||
type = types.str;
|
||||
description = "The name of the directory to sync the remote files to.";
|
||||
};
|
||||
|
||||
cacheDuration = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "The amount of time to keep cached files.";
|
||||
|
|
|
@ -49,8 +49,13 @@
|
|||
|
||||
rclone = {
|
||||
configurations = {
|
||||
nextcloud = {};
|
||||
proton = {};
|
||||
nextcloud = {
|
||||
dirName = "Nextcloud";
|
||||
};
|
||||
|
||||
proton = {
|
||||
dirName = "Proton";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -37,7 +37,21 @@ begin
|
|||
rm ~"$name"/.config/plasma-welcomerc
|
||||
else
|
||||
echo "Please complete the setup of your rclone configurations!"
|
||||
rclone config || true
|
||||
|
||||
for config in (echo "$configs" | jq '.[]' --raw-output0 | string split0)
|
||||
set -l configKey "$key.$config"
|
||||
set -l duration "$configKey.cacheDuration"
|
||||
|
||||
set -l serviceName "rclone@$config:$(getConfig "$configKey.dirName")"
|
||||
|
||||
if isSet "$duration"
|
||||
set serviceName "$serviceName:$(getConfig "$duration")"
|
||||
end
|
||||
|
||||
echo "Please create a remote called `$config`."
|
||||
rclone config || true
|
||||
systemctl --user enable "$serviceName" --now || true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue