fix(guanghu-os): bound BusyBox repository readback
This commit is contained in:
parent
62d1bed778
commit
27286d54f5
3 changed files with 9 additions and 5 deletions
|
|
@ -35,7 +35,7 @@ mkdir -p "${staging}/bin" "${staging}/sbin" "${staging}/usr/lib/guanghu" \
|
|||
"${staging}/usr/share/guanghu/repository-service-equivalence" \
|
||||
"$(dirname "${output}")"
|
||||
install -m 0755 /bin/busybox "${staging}/bin/busybox"
|
||||
for applet in sh sleep cat grep tr stat mkdir mv chmod readlink kill sync poweroff sed id httpd wget rm ip; do
|
||||
for applet in sh sleep cat grep tr stat mkdir mv chmod readlink kill sync poweroff sed id httpd wget rm ip timeout; do
|
||||
ln -s busybox "${staging}/bin/${applet}"
|
||||
done
|
||||
install -m 0755 "${supervisor}" "${staging}/usr/lib/guanghu/guanghu-root-supervisor"
|
||||
|
|
@ -68,7 +68,7 @@ if [ -x /usr/lib/guanghu/guanghu-repository-bridge-lifecycle ]; then
|
|||
/usr/lib/guanghu/guanghu-repository-bridge-lifecycle run REQ-QEMU-CROSS-ROOT-001
|
||||
grep -Fq '"result":"PASS_100"' /guanghu/receipts/repository-bridge-lifecycle/REQ-QEMU-CROSS-ROOT-001.json
|
||||
grep -Fq '"final_state":"DORMANT"' /guanghu/receipts/repository-bridge-lifecycle/REQ-QEMU-CROSS-ROOT-001.json
|
||||
if wget -q -T 1 -O /dev/null http://127.0.0.1:39301/main; then
|
||||
if timeout 1 wget -q -O /dev/null http://127.0.0.1:39301/main; then
|
||||
echo 'GUANGHU_CROSS_ROOT_REPOSITORY_SERVICE_FAIL_0: repository service remained ready after reclaim' >&2
|
||||
poweroff -f
|
||||
while :; do sleep 30; done
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ process_alive() {
|
|||
}
|
||||
|
||||
observe() {
|
||||
if process_alive && wget -q -T 1 -O /dev/null "${url}"; then
|
||||
if process_alive && timeout 1 wget -q -O /dev/null "${url}"; then
|
||||
echo ready
|
||||
else
|
||||
echo dormant
|
||||
|
|
@ -62,11 +62,11 @@ case "${1:-}" in
|
|||
;;
|
||||
execute)
|
||||
[ "$(observe)" = ready ] || die "service is not ready"
|
||||
wget -q -T 2 -O "${readback_file}" "${url}"
|
||||
timeout 2 wget -q -O "${readback_file}" "${url}"
|
||||
;;
|
||||
verify)
|
||||
[ "$(cat "${readback_file}")" = "$(cat "${expected_file}")" ] || die "repository main readback mismatch"
|
||||
[ "$(wget -q -T 2 -O - "${url}")" = "$(cat "${expected_file}")" ] || die "live repository main mismatch"
|
||||
[ "$(timeout 2 wget -q -O - "${url}")" = "$(cat "${expected_file}")" ] || die "live repository main mismatch"
|
||||
;;
|
||||
reclaim)
|
||||
if process_alive; then
|
||||
|
|
|
|||
|
|
@ -11,6 +11,10 @@ sh -n "${controller}"
|
|||
grep -Fq 'httpd -f -p 127.0.0.1:39301' "${backend}"
|
||||
grep -Fq 'repository-main-readback' "${backend}"
|
||||
grep -Fq 'service reclaim failed' "${backend}"
|
||||
if grep -Fq 'wget -q -T' "${backend}" "${builder}"; then
|
||||
echo 'BusyBox wget does not support -T in the JD initramfs baseline' >&2
|
||||
exit 1
|
||||
fi
|
||||
grep -Fq 'ip link set lo up' "${builder}"
|
||||
grep -Fq 'GUANGHU_CROSS_ROOT_REPOSITORY_SERVICE_EQUIVALENCE_VERIFIED' "${builder}"
|
||||
grep -Fq 'REQ-QEMU-CROSS-ROOT-001' "${builder}"
|
||||
|
|
|
|||
Loading…
Reference in a new issue