# - bof - #

#!/bin/bash



<<'comment'

# -  - #
# - File name - #
Btrfs-FileSystemConfiguration.sh

cd ~/; rm -rf ~/ArchBase2_Ermanno_Btrfs.sh; vim ~/ArchBase2_Ermanno_Btrfs.sh;
copy & paste this content
chmod +x ~/ArchBase2_Ermanno_Btrfs.sh; ~/./ArchBase2_Ermanno_Btrfs.sh;

cd ~/.ssh;
ssh-keygen -t rsa;

# -  - #
# - Fixing ssh error - #
ssh-keygen -R "you server hostname or ip"
ssh-keygen -R 10.0.0.1
ssh-keygen -R 192.168.1.1;

comment



#: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 "ArchBtrfs" >> /etc/hostname;
hostnamectl set-hostname ArchBtrfs;

# -  - #
# - Set local ip address - #
echo "127.0.0.1 localhost" >> /etc/hosts;
echo "::1       localhost" >> /etc/hosts;
echo "127.0.1.1 ArchBtrfs.localdomain ArchBtrfs" >> /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 - #
# - Prepare grub configuration - #
sed -i 's/MODULES=()/MODULES=(btrfs)/' /etc/mkinitcpio.conf;
mkinitcpio -p linux;


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

#:3.2
# -  - #
# - NOT UEFI - #
# -  - #
#grub-install /dev/sda;

# -  - #
# - 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;
#echo is_derayo:password | chpasswd
#useradd -m is_derayo -p Administrator2;
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 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 root - #
printf "\e[1;32mDone! Type exit, umount -a and shutdown now.\e[0m"
echo "";
echo "exit;";
echo "umount -a;";
echo "shutdown now;";

rm -rf /ArchBase2_Ermanno_Btrfs.sh



# - eof - #
