#!/bin/bash

cp -vf "/etc/pacman.d/mirrorlist" "./airootfs/etc/pacman.d/"

sudo pacman -Sy

sudo pacman -Sw --config pacman_sys.conf --noconfirm --cachedir "./airootfs/opt/extra-drivers" r8168

packs=(
  dracut
  grub-dracut
  grub
  systemd-boot-dracut
  libxvmc
  linux
  linux-api-headers
  linux-headers
  linux-xanmod-anbox
  linux-xanmod-anbox-headers
  melawy-dracut-initramfs
  melawy-dracut-ukify
  melawy-refind-menu-generator
  melawy-refind-theme-nier-a2
  melawy-plymouth-theme-nier-a2
  os-prober
  refind
  update-grub
  xf86-video-intel
)

for pack in ${packs[@]}
do
  sudo pacman -Sw --config pacman_sys.conf --noconfirm --cachedir "./airootfs/usr/share/packages" $pack
done

sudo paccache -rvk 1 --cachedir "./airootfs/opt/extra-drivers"
sudo paccache -rvk 1 --cachedir "./airootfs/usr/share/packages"

notify-send -a "$(basename $(pwd)): Prepare" -t 999999999 "finished" "$(date '+%Y.%m.%d %H:%M:%S')"

echo "Ready"
