#!/bin/sh
set -eu

if ! command -v omarchy >/dev/null 2>&1; then
  echo "This bootstrap requires an installed Omarchy system." >&2
  exit 1
fi

if ! command -v git >/dev/null 2>&1; then
  echo "This bootstrap requires git." >&2
  exit 1
fi

if ! command -v keyd >/dev/null 2>&1; then
  echo "Installing required package: keyd"
  omarchy pkg add keyd
fi

sh -c "$(curl -fsLS https://get.chezmoi.io)" -- \
  -b "$HOME/.local/bin"

if [ -d "$HOME/.local/share/chezmoi/.git" ]; then
  "$HOME/.local/bin/chezmoi" update
else
  "$HOME/.local/bin/chezmoi" init --apply alivault/linux-dotfiles
fi

omarchy theme set ashen
