#!/bin/bash

# Armbian: dpkg version. Print the installed version of the desktop.

omarchy_path=${OMARCHY_PATH:-/usr/share/omarchy}
omarchy_path=${omarchy_path%/}

if [[ $omarchy_path != "/usr/share/omarchy" ]]; then
  hash=$(git -C "$omarchy_path" rev-parse --short HEAD 2>/dev/null || true)
  if [[ -n $hash ]]; then
    echo "dev ($hash)"
  else
    echo "dev"
  fi
  exit 0
fi

version=$(dpkg-query -W -f='${Version}' armbian-hyprland-shell 2>/dev/null)
[[ -n $version ]] || exit 1
echo "$version"
