pre_upgrade() {
  if [ $(vercmp $2 1:2025.3.0-1 ) -le 0 ]; then
    echo '==> home-assistant systemd service will be changed to static user'
    echo '==> files from /var/lib/private/hass/ will be moved to /var/lib/hass/'
    if [[ -L /var/lib/hass ]] && [[ -d /var/lib/private/hass ]] ; then
      unlink /var/lib/hass
      mv /var/lib/private/hass /var/lib/hass
      chown -R hass: /var/lib/hass
    fi
  fi
}

post_install() {
  cat <<- EOF

upstream is deprecating support for this particular installation method
 with release 2025.12, meaning that this will no longer be supported.

~1 month prior to this date, this package will be dropped to the AUR.

upstream news post:

https://www.home-assistant.io/blog/2025/05/22/deprecating-core-and-supervised-installation-methods-and-32-bit-systems

EOF
}

post_upgrade() {
  post_install
}
