#!/bin/bash

## This script takes care of the sddm configuration

if [ -z "$BASE_DIR" ]; then
  echo "BASE_DIR wasn't set."
  exit 1
fi
if [ -z "$GITHUB_DOTFILES" ]; then
  echo "GITHUB_DOTFILES wasn't set."
  exit 1
fi

# Install required packages {{{

if [ "$OS" = 'arch' ]; then
  sudo pacman -S --needed sddm
elif [ "$OS" = 'debian' ]; then
  sudo apt install sddm
else
  echo "${RED}The OS wasn't defined. Quitting...${NC}"
  exit 1
fi

# }}}

# Add clones from GitHub {{{

mkdir -p "$GITHUB_DOTFILES"

if [ -e "$GITHUB_DOTFILES"/delicious-sddm-theme ]; then
  if [ "$UPDATE" = 'true' ]; then
    cd "$GITHUB_DOTFILES"/delicious-sddm-theme && git pull
  fi
else
  cd "$GITHUB_DOTFILES" && git clone https://github.com/stuomas/delicious-sddm-theme.git && /bin/bash/ "$GITHUB_DOTFILES"/delicious-sddm-theme/install.sh
fi

# }}}
