#! /bin/bash

RPI="$(jq -r '.rpi' /home/iont.tech/config.json)"

if [ "$RPI" = "zero" ]; then
    sudo jq --arg ver "rpi-ecarwall" '.version = $ver' /home/iont.tech/config.json | sudo tee /home/iont.tech/config.json.tmp

    mv /home/iont.tech/config.json.tmp /home/iont.tech/config.json

    sudo chown iont.tech:iont.tech /home/iont.tech/config.json
fi
