2024-11-06 02:32:45 +00:00
|
|
|
#!/bin/env fish
|
|
|
|
begin
|
2024-11-07 10:54:50 +00:00
|
|
|
set -l name anki
|
2024-11-06 02:32:45 +00:00
|
|
|
set -l dir (status dirname)
|
2024-11-27 01:54:44 +00:00
|
|
|
set -l source "$dir/docker-compose.overrides.yml"
|
2024-11-06 02:32:45 +00:00
|
|
|
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"
|
2024-11-19 23:30:08 +00:00
|
|
|
set -l user (yq "$userKey" "$source" | sed "s/:.*\$/:$pw/")
|
2024-11-07 01:39:37 +00:00
|
|
|
initializeServiceInstallation $argv
|
2024-11-13 15:22:57 +00:00
|
|
|
sudo cp "$dir/docker-compose.base.yml" (getServiceRoot $argv)
|
2024-11-06 02:32:45 +00:00
|
|
|
|
2024-11-19 23:30:08 +00:00
|
|
|
USER=$user yq "$userKey = env(USER)" "$source" | \
|
2024-11-27 01:54:44 +00:00
|
|
|
sudo tee (getServiceOverrides $argv) >/dev/null
|
2024-11-06 02:32:45 +00:00
|
|
|
|
|
|
|
installDockerService $argv
|
|
|
|
end
|
|
|
|
|
|
|
|
function configureSW -V dir
|
|
|
|
configureDockerService $argv
|
|
|
|
end
|
|
|
|
|
2024-11-07 10:54:50 +00:00
|
|
|
function getServiceServers -V name
|
|
|
|
printf "$name" ""
|
|
|
|
end
|
|
|
|
|
|
|
|
function getServiceLocations -V name
|
|
|
|
printf "%s\0" "$name" /
|
2024-11-06 02:32:45 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
runInstaller --force $argv
|
|
|
|
end
|