Skip to content

Commit

Permalink
Print haos-flash output on console
Browse files Browse the repository at this point in the history
Print haos-flash stdout on the console. This allows to follow the
flashing progress via serial console. Also print what the script
is doing to stdout.

Signed-off-by: Stefan Agner <[email protected]>
  • Loading branch information
agners committed Jul 27, 2022
1 parent 5075eb1 commit f5be821
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions rootfs-overlay/usr/bin/haos-flash
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ then
fi

if [ "$1" = "dev" ]; then
echo "Getting latest Home Assistant OS version from channel dev..."
channel="https://version.home-assistant.io/dev.json"
else
echo "Getting latest Home Assistant OS version from channel stable..."
channel="https://version.home-assistant.io/stable.json"
fi

version=$(curl "${channel}" | jq -r '.hassos.yellow')
version=$(curl --no-progress-meter -L "${channel}" | jq -r '.hassos.yellow')
echo -n "Installing Home Assitant OS ${version} to "

if [ "$1" = "dev" ]; then
url="https://os-builds.home-assistant.io/${version}/haos_yellow-${version}.img.xz"
Expand All @@ -27,16 +30,20 @@ fi

if [ -b /dev/mmcblk0 ]
then
echo "mmcblk0."
device=/dev/mmcblk0
else
echo "nvme0n1."
device=/dev/nvme0n1
fi

echo timer > /sys/class/leds/led2/trigger
if curl -L "$url" | unxz --stdout | dd of=${device} bs=4M
if curl --no-progress-meter -L "$url" | unxz --stdout | dd of=${device} bs=4M
then
echo "Successfully installed Home Assistant OS, shutting down the system"
echo default-on > /sys/class/leds/led2/trigger
poweroff
else
echo "Error during Home Assistnat OS installation"
echo none > /sys/class/leds/led2/trigger
fi
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ DefaultDependencies=no
Type=idle
ExecStartPre=/usr/bin/sleep 3
ExecStart=-/usr/bin/haos-flash stable
StandardOutput=journal+console

[Install]
WantedBy=basic.target

0 comments on commit f5be821

Please sign in to comment.