switch-prebuilt: check for existence before nix copy

This commit is contained in:
Luke Granger-Brown 2021-03-20 13:37:08 +00:00
parent 422c47c3e0
commit 5cf89fbc2f

View file

@ -10,8 +10,11 @@ pkgs.writeShellScriptBin "switch-prebuilt" ''
export AWS_SECRET_ACCESS_KEY="${depot.ops.secrets.nixCache.AWS_SECRET_ACCESS_KEY}" export AWS_SECRET_ACCESS_KEY="${depot.ops.secrets.nixCache.AWS_SECRET_ACCESS_KEY}"
system="''${1}" system="''${1}"
if [[ ! -e "$system" ]]; then
# We should be a trusted-user. # We should be a trusted-user.
nix copy -v --from 's3://lukegb-nix-cache?endpoint=storage.googleapis.com' --no-check-sigs "$system" nix copy -v --from 's3://lukegb-nix-cache?endpoint=storage.googleapis.com' --no-check-sigs "$system"
fi
diff "$system/etc/hostname" "/etc/hostname" diff "$system/etc/hostname" "/etc/hostname"
# The next phase requires sudo, but it's harmless to run the preceding commands twice. # The next phase requires sudo, but it's harmless to run the preceding commands twice.