#!/bin/bash

echo "This will remove all Archman packages, repos, and branding."
while true; do
    read -p "Continue? [y/n]" yn
    case $yn in
        [Yy]* ) echo "Scrubbing...."; break;;
        [Nn]* ) exit;;
        * ) echo "Please answer yes or no.";;
    esac
done

yes|pacman -S grub
pacman -R gedit-code-assistance --noconfirm
grub-mkconfig -o /boot/grub/grub.cfg
pacman -R --noconfirm $(comm -12 <(pacman -Qq | sort) <(pacman -Slq archmanrepo | sort))
systemctl disable lightdm
systemctl enable gdm

sed -i '/^\['"archmanrepo"'\]/,/^$/{d;}' /etc/pacman.conf

sed -i 's/Archman/Arch/g' /etc/os-release

sed -i 's/archman/arch/g' /etc/os-release

sed -i 's/Archman/Arch/g' /etc/lsb-release

while true; do
    read -p "Update all packages? [y/n]" yn
    case $yn in
        [Yy]* ) echo "Updating...."; pacman -Syyu; break;;
        [Nn]* ) exit;;
        * ) echo "Please answer yes or no.";;
    esac
done


echo " "
echo "Done! Please reboot"
