#!/usr/bin/bash

DEST=${1:-/etc/skel}

# Moving away from all things and all peaple 'systemd'
#
sudo apt remove elogind

sudo apt update
sudo apt install seatd

sudo rc-update add seatd default
sudo rc-service seatd start

sudo gpasswd -a "$USER" video
sudo gpasswd -a "$USER" input
sudo gpasswd -a "$USER" _seatd  # Devuan's seatd group name may vary

conf_print_seatd_zsh() {
  cat << EOF
export SEAT_DAEMON=seatd
export SEATD_SOCK=/run/seatd.sock
EOF
}
conf_print_seatd_zsh | "${DEST}/.zshrc.d/003_seatd.zsh"

# openrc
if [[ $(command -v openrc) ]]; then
  sudo rc-service elogind stop
  sudo rc-update del elogind default
fi
