Strip user and domain name

This commit is contained in:
Sandro - 2021-10-02 20:28:46 +02:00
parent 3ed7b4e16f
commit d2746303b2
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
1 changed files with 6 additions and 3 deletions

View File

@ -26,7 +26,10 @@ while [[ $# -gt 0 ]]; do
build_local=true
;;
*)
target=$1
# strip hostname and user
host=$1
target=${1//.hq.c3d2.de/}
target=${target//.c3d2.de/}
;;
esac
shift
@ -35,8 +38,8 @@ done
if [[ -v build_local ]]; then
nix --experimental-features 'nix-command flakes' -Lv build ".#nixosConfigurations.$target.config.system.build.toplevel"
store_path=$(readlink -f result)
nix-copy-closure --to root@"$target" -v "$store_path"
ssh root@"$target" "$store_path/bin/switch-to-configuration" switch
nix-copy-closure --to root@"$host" -v "$store_path"
ssh root@"$host" "$store_path/bin/switch-to-configuration" switch
else
hostname=$(echo "$target" | cut -d . -f 1)