Enable tests, fix wrong ARCH condition and improve post install detection

This commit is contained in:
Igor Pecovnik
2025-05-09 07:25:13 +02:00
committed by Igor
parent 8fe43deedd
commit 7e075f19fa
2 changed files with 33 additions and 15 deletions

View File

@@ -1,9 +1,10 @@
ENABLED=false
ENABLED=true
RELEASE="bookworm"
TESTNAME="Home Assistant install"
testcase() {(
set -e
./bin/armbian-config --api module_armbian_firmware repository rolling
./bin/armbian-config --api module_haos install
./bin/armbian-config --api module_haos status
)}

View File

@@ -37,7 +37,7 @@ function module_haos() {
srv_disable systemd-networkd
# hack to force install
sed -i 's/^PRETTY_NAME=".*/PRETTY_NAME="Debian GNU\/Linux 12 (bookworm)"/g' "${SDCARD}/etc/os-release"
# sed -i 's/^PRETTY_NAME=".*/PRETTY_NAME="Debian GNU\/Linux 12 (bookworm)"/g' "${SDCARD}/etc/os-release"
# we host packages at our repository and version for both is determined:
# https://github.com/armbian/os/blob/main/external/haos-agent.conf
@@ -48,7 +48,7 @@ function module_haos() {
# determine machine type
case "${ARCH}" in
armhf) MACHINE="tinker";;
amd64) MACHINE="generic-x86-64";;
x86_64) MACHINE="generic-x86-64";;
arm64) MACHINE="odroid-n2";;
*) exit 1;;
esac
@@ -94,16 +94,29 @@ function module_haos() {
echo "extraargs=apparmor=1 security=apparmor" >> "/boot/armbianEnv.txt"
fi
sleep 5
for s in {1..50};do
for i in {0..100..10}; do
j=$i
echo "$i"
sleep 2
if [[ -t 1 ]]; then
# We have a terminal, use dialog
for s in {1..30}; do
for i in {0..100..10}; do
echo "$i"
sleep 1
done
if curl -sf http://localhost:${module_options["module_haos,port"]}/ > /dev/null; then
break
fi
done | $DIALOG --gauge "Preparing Home Assistant Supervised\n\nPlease wait! (can take a few minutes) " 10 50 0
else
# No terminal, fallback to echoing progress
echo "Waiting for Home Assistant Supervised to become available..."
for s in {1..30}; do
sleep 10
if curl -sf http://localhost:${module_options["module_haos,port"]}/ > /dev/null; then
echo "✅ Home Assistant Supervised is responding."
break
fi
done
if [[ -n "$(ss | grep ${module_options["module_haos,port"]})" ]]; then
break;
fi
done | $DIALOG --gauge "Preparing Home Assistant Supervised\n\nPlease wait! (can take 15 minutes) " 10 50 0
fi
# enable service
srv_enable supervisor-fix
@@ -113,9 +126,13 @@ function module_haos() {
sed -i "s/^PRETTY_NAME=\".*/PRETTY_NAME=\"${VENDOR} ${REVISION} ($VERSION_CODENAME)\"/g" "/etc/os-release"
# reboot is mandatory
if $DIALOG --title " Reboot required " --yes-button "Reboot" --no-button "Cancel" --yesno \
"A reboot is required to enable AppArmor. Shall we reboot now?" 7 68; then
reboot
if [[ -t 1 ]]; then
if $DIALOG --title " Reboot required " --yes-button "Reboot" --no-button "Cancel" --yesno \
"A reboot is required to enable AppArmor. Shall we reboot now?" 7 68; then
reboot
fi
else
reboot
fi
;;