#!/bin/bash

dotfiles=$1

scripts=$dotfiles/scripts

if command -v yay &>/dev/null; then
	echo "Yay is already installed, proceeding"
else
	echo "Installing yay..."
	$scripts/install/yay 
fi

packages=$dotfiles/packages

echo "Installing utils..."
utils=$packages/utils/arch
packages_list=$(sed '/^$|^#/d' $utils)

yay -S --needed --noconfirm $packages_list

$scripts/configuration/utils $dotfiles

echo "Installing applications"
applications=$packages/applications/arch
packages_list=$(sed '/^$|^#/d' $applications)

yay -S --needed --noconfirm $packages_list

$scripts/configuration/applications $dotfiles