2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-23 02:42:17 +00:00

fix(xcat-core): two Ubuntu root handler bats cases fail on an Ubuntu runner

"the online hook calls the handler with dracut's three arguments" and
"a second interface does not fetch the image again" fail in the GitHub
CI with "called: No such file or directory". Both cases source
xcat-online.sh from sh. On Ubuntu sh is dash, and the dash "." builtin
passes no arguments, so the hook sees no interface and returns before
it calls the stub handler.

The initramfs links sh to bash, so the cases now source the hook from
bash. Run on an Ubuntu host, both cases fail before this change and
pass after it.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-11-09 09:28:37 -03:00
parent 38f4e4e2e9
commit ed5c5b723c
@@ -74,7 +74,7 @@ SH
sed -e 's#/lib/dracut-lib.sh#${BATS_TEST_TMPDIR}/lib/dracut-lib.sh#' \
-e 's#/sbin/xcatroot#${bin}/sbin/xcatroot#g' \
-e 's#/tmp/xcat.rootimg.done#${BATS_TEST_TMPDIR}/done#' '$hook' > ./hook.sh
sh -c '. ./hook.sh eth0'"
bash -c '. ./hook.sh eth0'"
[ "$status" -eq 0 ]
[ "$(cat "${BATS_TEST_TMPDIR}/called")" = 'eth0 xcat /sysroot' ]
}
@@ -93,7 +93,7 @@ SH
sed -e 's#/lib/dracut-lib.sh#${BATS_TEST_TMPDIR}/lib/dracut-lib.sh#' \
-e 's#/sbin/xcatroot#${bin}/sbin/xcatroot#g' \
-e 's#/tmp/xcat.rootimg.done#${BATS_TEST_TMPDIR}/done#' '$hook' > ./hook.sh
sh -c '. ./hook.sh eth0; . ./hook.sh eth1'"
bash -c '. ./hook.sh eth0; . ./hook.sh eth1'"
[ "$status" -eq 0 ]
[ "$(wc -l < "${BATS_TEST_TMPDIR}/count")" -eq 1 ]
}