#!/usr/bin/env bash
# Only this explicit target changes the host package database.
set -euo pipefail
[[ $# == 0 ]] || { printf 'Usage: tools/install-workstation\n' >&2; exit 2; }
cd "$(dirname -- "${BASH_SOURCE[0]}")/.."
package=$(cat out/workstation/package-path.txt)
[[ -f $package ]] || { printf 'Build fds-tools with make workstation first\n' >&2; exit 1; }
if (( EUID == 0 )); then
    exec pacman -U -- "$package"
else
    exec sudo pacman -U -- "$package"
fi
