nixos-rebuild: fix --specialisation with remote builder and target

Fixes #286066.
This commit is contained in:
Sylvain Fankhauser 2024-02-13 17:54:48 +01:00
parent b5a1977546
commit a77bfd0f15
No known key found for this signature in database
GPG Key ID: 4228AB9EC0612ADA
1 changed files with 7 additions and 1 deletions

View File

@ -791,7 +791,13 @@ if [[ "$action" = switch || "$action" = boot || "$action" = test || "$action" =
else
cmd+=("$pathToConfig/specialisation/$specialisation/bin/switch-to-configuration")
if [[ ! -f "${cmd[-1]}" ]]; then
if [ -z "$targetHost" ]; then
specialisationExists=$(test -f "${cmd[-1]}")
else
specialisationExists=$(targetHostCmd test -f "${cmd[-1]}")
fi
if ! $specialisationExists; then
log "error: specialisation not found: $specialisation"
exit 1
fi