PortValhalla/scripts/Common/Software/docker/services/anki-sync/main.fish
2024-11-29 01:15:08 +01:00

34 lines
967 B
Fish
Executable file

#!/bin/env fish
begin
set -l name anki
set -l dir (status dirname)
set -l source "$dir/docker-compose.overrides.yml"
source "$dir/../service.fish"
function installSW -V dir -V source
set -l pw (nix-shell -p keepassxc --run "keepassxc-cli generate --length 32")
set -l userKey ".services.anki.environment.SYNC_USER1"
set -l user (yq "$userKey" "$source" | sed "s/:.*\$/:$pw/")
initializeServiceInstallation $argv
sudo cp "$dir/docker-compose.base.yml" (getServiceRoot $argv)
USER=$user yq "$userKey = env(USER)" "$source" |
sudo tee (getServiceOverrides $argv) >/dev/null
installDockerService $argv
end
function configureSW -V dir
configureDockerService $argv
end
function getServiceServers -V name
printf "$name" ""
end
function getServiceLocations -V name
printf "%s\0" "$name" /
end
runInstaller --force $argv
end