If you are looking at this, you know who you are Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
30 lines
674 B
Bash
Executable File
30 lines
674 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -o errexit
|
|
set -o nounset
|
|
set -o pipefail
|
|
|
|
if [[ "$#" -ne 1 ]]; then
|
|
echo "Usage: $0 <host>"
|
|
exit 1
|
|
fi
|
|
|
|
host="$1"
|
|
|
|
age_key=$(ssh-to-age < "./submodules/secrets/hosts/$host/ssh_host_ed25519_key.pub")
|
|
|
|
find . -type f -name "sops.yaml" | while IFS= read -r sops_file; do
|
|
sed -i "/ - &$host $age_key/d" "$sops_file"
|
|
sed -i "/ - \*$host/d" "$sops_file"
|
|
done
|
|
|
|
sed -i "/$host = mkNixosConfiguration/d" flake.nix
|
|
sed -i "/\`$host\`/d" ./README.md
|
|
|
|
rm -rf "./hosts/$host"
|
|
|
|
"$(dirname "$0")/update-keys.sh"
|
|
|
|
echo "Please remove SSH key pairs for any users that used to connect to $host."
|
|
echo "Host $host has been successfully removed."
|