#!/usr/bin/env bash

### Update dom0
logg info 'Updating dom0 via `qubesctl`'
sudo qubesctl --show-output state.sls update.qubes-dom0
logg info 'Updating dom0 via `qubes-dom0-update`'
sudo qubes-dom0-update --clean -y

### Install qubes-repo-contrib
logg info "Installing qubes-repo-contrib"
sudo qubes-dom0-update -y qubes-repo-contrib

### Install dependencies
for PACKAGE of latte-dock nautilus nautilus-gtkhash nautilus-search-tool kde-settings-qubes kdeplasma-addons konsole kscreen kvantum plymouth-kcm sssd-kcm sddm-kcm; do
  logg info "Installing $PACKAGE"
  sudo qubes-dom0-update -y "$PACKAGE" || true
done

### Ensure sys-whonix is running
logg info 'Ensuring `sys-whonix` is running'
qvm-start sys-whonix --skip-if-running
