Skip to content

Commit 6d1c786

Browse files
Mic92mergify[bot]
authored andcommitted
test that the remote system has the cpio command
1 parent bf4c0c5 commit 6d1c786

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/get-facts.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ isInstaller=$(if [ "$isNixos" = "y" ] && grep -Eq 'VARIANT_ID="?installer"?' /et
1313
isContainer=$(if [ "$(has systemd-detect-virt)" = "y" ]; then systemd-detect-virt --container; else echo "none"; fi)
1414
hasIpv6Only=$(if [ "$(has ip)" = "n" ] || ip r g 1 >/dev/null 2>/dev/null || ! ip -6 r g :: >/dev/null 2>/dev/null; then echo "n"; else echo "y"; fi)
1515
hasTar=$(has tar)
16+
hasCpio=$(has cpio)
1617
hasSudo=$(has sudo)
1718
hasDoas=$(has doas)
1819
hasWget=$(has wget)

src/nixos-anywhere.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ isInstaller=
4545
isContainer=
4646
hasIpv6Only=
4747
hasTar=
48+
hasCpio=
4849
hasSudo=
4950
hasDoas=
5051
hasWget=
@@ -434,7 +435,7 @@ importFacts() {
434435
# shellcheck disable=SC2046
435436
export $(echo "$filteredFacts" | xargs)
436437

437-
for var in isOs isArch isKexec isInstaller isContainer hasIpv6Only hasTar hasSudo hasDoas hasWget hasCurl hasSetsid; do
438+
for var in isOs isArch isKexec isInstaller isContainer hasIpv6Only hasTar hasCpio hasSudo hasDoas hasWget hasCurl hasSetsid; do
438439
if [[ -z ${!var} ]]; then
439440
abort "Failed to retrieve fact $var from host"
440441
fi
@@ -673,6 +674,10 @@ main() {
673674
abort "no tar command found, but required to unpack kexec tarball"
674675
fi
675676

677+
if [[ ${hasCpio-n} == "n" ]]; then
678+
abort "no cpio command found, but required to build the new initrd"
679+
fi
680+
676681
if [[ ${hasSetsid-n} == "n" ]]; then
677682
abort "no setsid command found, but required to run the kexec script under a new session"
678683
fi

0 commit comments

Comments
 (0)