#!/bin/bash

# - bof - #



# vim ~/DTs_ArchBase2.sh;
# copy & paste this content
# chmod +x ~/DTs_ArchBase2.sh; ~/./DTs_ArchBase2.sh;



# -  - #
# - scp command - #
# scp is_derayo@192.168.1.100:/DataPool/Images/Programs/Linux.Img/Linux_Arch.Img/Arch_Install/DTs_Arch.Ins/DTs_ArchBase2.sh .;



# -  - #
# - When this error happen on ssh command - #
#
#  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#  @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
#  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#  # -  - #
#  # - Fixing this error - #
#  ssh-keygen -R "you server hostname or ip"
#  ssh-keygen -R 192.168.1.100;
#  ssh-keygen -R 192.168.1.200;
#  ssh-keygen -R 192.168.122.100;
#  ssh-keygen -R 192.168.122.200;



#:1
# -  - #
# - Initial configuration - #

#:1.1
# -  - #
# - Setting some alias - #
#alias cls='clear;';
#alias la='ls -lah';
#alias lb='lsblk -f;';
#alias fs='cat /etc/fstab;';

#:1.2
# -  - #
# - Set localtime - #
ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime;

# -  - #
# - Set hardware clock - #
hwclock --systohc;

#:1.3
# -  - #
# - Activate language - #

# -  - #
# - generate locate - #
#sed -i '177s/.//' /etc/locale.gen;
sed -i 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen;
locale-gen;

# -  - #
# - Set language - #
echo "LANG=en_US.UTF-8" >> /etc/locale.conf;

# -  - #
# - Set keyboard layout - #
echo "KEYMAP=en" >> /etc/vconsole.conf;

#:1.4
# -  - #
# - Set hostname - #
echo "Arch" >> /etc/hostname;
hostnamectl set-hostname Arch;

# -  - #
# - Set local ip address - #
echo "127.0.0.1 localhost" >> /etc/hosts;
echo "::1       localhost" >> /etc/hosts;
echo "127.0.1.1 Arch.localdomain Arch" >> /etc/hosts;



#:2
# -  - #
# - Install additional software - #

# -  - #
# - All video cards (generics) - #
pacman -S xf86-video-vesa xf86-video-ati xf86-video-intel xf86-video-amdgpu xf86-video-nouveau --noconfirm;

# -  - #
# - Audio - #
pacman -S pulseaudio pulseaudio-alsa pulseaudio-bluetooth --noconfirm;

# -  - #
# - Intel, AMD & nvidia - #
pacman -S intel-ucode amd-ucode nvidia nvidia-utils --noconfirm;

# -  - #
# - Utilitary software - #
pacman -S acpi acpi_call alsa-utils dnsutils inetutils powertop reflector \
          tlp xdg-utils xdg-user-dirs --noconfirm; 
pacman -S bluez bluez-utils wireless_tools --noconfirm; 

# -  - #
# - UEFI Only - #
pacman -S efibootmgr dosfstools os-prober mtools --noconfirm;

# -  - #
# - Double boot activation - #
#pacman -S os-prober --noconfirm;
sed -i 's/#GRUB_DISABLE_OS_PROBER=false/GRUB_DISABLE_OS_PROBER=false/' /etc/default/grub;



#:3
# -  - #
# - Install grub - #

#:3.1
# - UEFI Only (Arch alone install) - #
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub_uefi --recheck;

# -  - #
# - Create grub.cfg file - #
grub-mkconfig -o /boot/grub/grub.cfg;



#:4
# -  - #
# - Enable ssh & NetworkManager - #
systemctl enable sshd;
systemctl enable NetworkManager;



#:5
# -  - #
# - Root password & create new user & password - #

# -  - #
# - root password - #
echo " "
echo "root password: "
passwd root;

# -  - #
# - Create my user & password - #
useradd -m is_derayo;
usermod -aG wheel,audio,video,optical,storage is_derayo;
usermod -c 'Djalmar Enrique Rayo' is_derayo; 

echo " ";
echo "is_derayo password: "
passwd is_derayo;

echo " ";
read -t 5 -p "5 Seconds pause...";
echo " ";



#:6
# -  - #
# - Authorize wheel to sudo - #
sed -i 's/# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/' /etc/sudoers;



#:7
# -  - #
# - Printer - #
sudo pacman -S cups cups-pdf hplip libcups system-config-printer --noconfirm;
sudo systemctl enable cups;



#:8
# -  - #
# - Additional software - #

#:8.1
# -  - #
# - Programs - #
sudo pacman -S audacious bash-completion bleachbit bpytop curl dolphin evince filelight file-roller \
               filezilla firefox gcc geeqie gimp gnome-disk-utility gnome-calculator gnome-multi-writer \
               gnome-packagekit gnome-terminal gnome-system-monitor gpart gparted gpicview grub-customizer \
               gvfs htop kpat libreoffice man mysql-clients neofetch nmap ntfs-3g pavucontrol pinta plank \
               postgresql pv python p7zip reflector rsync screenfetch simple-scan smplayer spectacle \
               testdisk thunar transmission-gtk tree unrar unzip viewnior vlc whois wget yajl --noconfirm;

# -  - #
# - Picture viewer programs - #
sudo pacman -S gpicview viewnior --noconfirm;

#:8.2
# -  - #
# - Media utilities - #
sudo pacman -S brasero clementine xfburn --noconfirm;

#:8.3
# -  - #
# - To install yay & yaourt - #
sudo pacman -S binutils fakeroot gcc make --noconfirm;

#:8.4
# -  - #
# - Arch themes - #
sudo pacman -S adapta-gtk-theme arc-gtk-theme arc-icon-theme archlinux-wallpaper gtkmm3 \
               papirus-icon-theme ttf-freefont --noconfirm;



# -  - #
# - Exit & reboot - #
printf "\e[1;32mDone! Type exit, umount -a and shutdown now.\e[0m"
echo "";

rm -rf ~/DTs_ArchBase2.sh

echo "exit;";
echo "umount -a;";
echo "shutdown now;";

echo "Process completed successfully... ";
echo " ";



# - eof - #
