Skip to content

Commit 524a0c9

Browse files
bors[bot]Mic92
andauthored
Merge #38
38: also check cpu architecture r=Mic92 a=Mic92 Co-authored-by: Jörg Thalheim <joerg@thalheim.io>
2 parents 73ecd2e + eebada1 commit 524a0c9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/nixos-remote.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ abort() {
3636
exit 1
3737
}
3838

39-
kexec_url=https://github.com/nix-community/nixos-images/releases/download/nixos-22.11/nixos-kexec-installer-x86_64-linux.tar.gz
39+
default_kexec_url=https://github.com/nix-community/nixos-images/releases/download/nixos-22.11/nixos-kexec-installer-x86_64-linux.tar.gz
40+
kexec_url="$default_kexec_url"
4041
enable_debug=""
4142
maybereboot="sleep 6 && reboot"
4243
substitute_on_destination="--substitute-on-destination"
@@ -174,6 +175,7 @@ has(){
174175
}
175176
cat <<FACTS
176177
is_os=\$(uname)
178+
is_arch=\$(uname -m)
177179
is_kexec=\$(if test -f /etc/is_kexec; then echo "y"; else echo "n"; fi)
178180
has_tar=\$(has tar)
179181
has_sudo=\$(has sudo)
@@ -200,6 +202,10 @@ if [[ ${is_os-n} != "Linux" ]]; then
200202
abort "This script requires Linux as the operating system, but got $is_os"
201203
fi
202204

205+
if [[ ${is_arch-n} != "x86_64" ]] && [[ $kexec_url == "$default_kexec_url" ]]; then
206+
abort "The default kexec image only support x86_64 cpus. Checkout https://github.com/numtide/nixos-remote/#using-your-own-kexec-image for more information."
207+
fi
208+
203209
if [[ ${is_kexec-n} != "y" ]] && [[ ${no_ssh_copy-n} != "y" ]]; then
204210
ssh-copy-id -o ConnectTimeout=10 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$ssh_connection"
205211
fi

0 commit comments

Comments
 (0)