#!/bin/bash
# - bof - #



<<'comment'

sudo apt install curl figlet lolcat -y;
bash <(curl -s https://www.education.isdevelopment.us/Ubuntu.Ins/01-Ubuntu_Gnome-FinalConfiguration.sh)



# -  - #
# - Dash to Dock extension final configuration - #
source <(curl -s https://www.education.isdevelopment.us/Functions/Functions.sh)
uDashToDockFinalConfiguration_;



# :A
# -  - #
# - Ubuntu programs list installation - #

# - Method   # 1 - #
bash <(curl -s https://www.education.isdevelopment.us/Ubuntu.Ins/01-Ubuntu_Gnome-FinalConfiguration.sh)

# - Method   # 2 - #
cd ~/; uGfc_=uGFinalConfiguration.sh;
curl -o ~/$uGfc_ "https://www.education.isdevelopment.us/Ubuntu.Ins/01-Ubuntu_Gnome-FinalConfiguration.sh"
chmod +x ~/$uGfc_; ~/./$uGfc_;
nvim ~/$uGfc_;

# - Method   # 3 - #
cd ~/; rm -rf ~/uGFinalConfiguration.sh; nvim ~/uGFinalConfiguration.sh;
copy & paste this content
chmod +x ~/uGFinalConfiguration.sh; ~/./uGFinalConfiguration.sh;



# - Configured - #

# -  - #
# - Vim commands - #
https://vim.rtorr.com/

rm -rf ~/.bashrc;
nvim ~/.bashrc;

rm -rf ~/.zshrc;
nvim ~/.zshrc;

ssh-keygen -R 192.168.1.1

# - On client - #
cd ~/.ssh;
ssh-keygen -t rsa;

cat ~/.ssh/id_rsa.pub;

# - On server - #
nvim ~/.ssh/authorized_keys;

sudo apt install curl git htop inxi net-tools neovim screenfetch tree -y;
sudo pacman -S curl git htop inxi net-tools neovim screenfetch tree --noconfirm --needed;
comment



# -  - #
# - Global variables - #



# -  - #
# - Overwrite checkComputer - #
 overwriteCc_="No";
#overwriteCc_="Yes";

logF_=~/.noInstalled-Ubuntu_Gnome-FinalConfiguration_$(date +%Y-%m-%d_%H-%M-%S).log;
sF_=~/uGFinalConfiguration.sh;



# -  - #
# - Greetings_ - #
function Greetings_(){
  Header_;
  echo -e "\n  Warning: This script is going to install the ubuntu programs list"
  echo -e "\nImportant: This procedure will take a few minutes.";
  echo -e "\nProcedure: Open terminal & paste next command:\n";

cat <<"EOF"
  bash <(curl -s https://www.education.isdevelopment.us/Ubuntu.Ins/01-Ubuntu_Gnome-FinalConfiguration.sh)
EOF

  echo -e "\n\n";

  while true; do
    read -p "Do you want to start the installation now? (Yy/Nn): " yn
    case $yn in
        [Yy]* )
          echo -e "\n\n\nInstallation starting...\n\n"
          break;;
        [Nn]* )
          rm -rf $sF_;
          exit;
          break;;
        * ) echo "Please answer (y)es or (n)o.";;
    esac
done
}



# -  - #
# - Header_ - #
function Header_(){
  clear;
  echo "";
  figlet "Ubuntu desktop" | lolcat;
  figlet -f small "Final configuration" | lolcat;
  echo -e "\nby Djalmar Enrique Rayo (2025) - GNU General Public License (GPL)";
  echo "-----------------------------------------------------------------------------";

  # -  - #
  # - Check if runnnin on ssh - #
  sshC_=$SSH_CONNECTION;
  if [ "$sshC_" != "" ]; then
        rm -rf $sF_;
        echo -e "\n\n\nThis process can not be executed through ssh...\n\n"
        sleep 10;
        exit;
  fi;
}



# -  - #
# - installPrograms_ - #
function installPrograms_(){
  case $Opt in
    1)
      uInstallProgramsList_; 
      ;;
    2)
      aInstallProgramsList_;
      ;;
    3)
      fInstallProgramsList_;
      ;;
  esac
  sleep 10;
}



# -  - #
# - aInstallProgramsList_ - #
function aInstallProgramsList_(){
  local aDpl_='Arch desktop programs';
  local sFp_=flatpak;
  sudo pacman -S $sFp_ --noconfirm --needed;
  echo -e "\n\n$aDpl_ were installed successfully...\n\n\n";
}



# -  - #
# - fInstallProgramsList_ - #
function fInstallProgramsList_(){
  local fDpl_='Fedora desktop programs';
  local sFp_=flatpak;
  sudo dnf install $sFp_ -y;

  echo -e "\n\n$fDpl_ were installed successfully...\n\n\n";
}



# -  - #
# - uInstallProgramsList_ - #
function uInstallProgramsList_(){
  Header_;
  echo -e "\n\n\n  Select the ubuntu program list to be installed"
  echo -e "\n\n        1. Basic programs list"
  echo -e "\n        2. Medium programs list";
  echo -e "\n        3. Full programs list";

  echo -e "\n\n";

  while true; do
    read -p "Which program list would you like to install? (1-3): " nProg_;
    case $nProg_ in
      1 )
        uBasicProgramsList_; 
        break;;
      2 )
        uMediumProgramsList_;
        break;;
      3 )
        uFullProgramsList_;
        break;;
      * ) echo "Please enter (1-3) options.";;
    esac
  done
  AdditionalPrograms_;
}



# -  - #
# - uBasicProgramsList_ - #
function uBasicProgramsList_(){
  local uPl_='Ubuntu basic programs list';
  echo -e "\n\nInstalling $uPl_...\n\n";

  Log_ 7;

  lPrograms1_="arc-theme bindfs curl duf evince extlinux fastfetch figlet filelight file-roller flatpak \
               gedit git gparted gvfs gvfs-backends gvfs-fuse htop lolcat lsb-release mhddfs neovim net-tools \
               openssh-client openssh-server pv screenfetch sshfs synaptic testdisk tilix thunar tree unzip viewnior \
               wget whois zip";
  tInstall_=$(sPackages_ "$lPrograms1_");
  sudo apt install $tInstall_ -y;

  installAdditionalSoftware_;

  echo -e "\n\n$uPl_ was installed successfully...\n\n\n";
}



# -  - #
# - removeSnapFirefox_ - #
function removeSnapFirefox_(){
  sudo snap remove --purge firefox;
}



# -  - #
# - installAdditionalSoftware_ - #
function installAdditionalSoftware_(){

  if [ "$( which libreoffice )" == "" ]; then
    sudo apt install libreoffice -y; fi;

  if [ "$( which firefox )" == "" ]; then
    sudo apt install firefox -y; fi;
}



# -  - #
# - uMediumProgramsList_ - #
function uMediumProgramsList_(){
  local uPl_='Ubuntu medium programs list';
  echo -e "\n\nInstalling $uPl_...\n\n";

  Log_ 7;

  lPrograms1_="arc-theme bindfs bleachbit duf curl evince extlinux fastfetch filelight file-roller filezilla \
               flatpak gcc gdebi gedit geeqie git gnome-disk-utility gnome-multi-writer gnome-screenshot gnupg gpart \
               gparted gvfs gvfs-backends gpicview gvfs-fuse htop kde-spectacle kpat lsb-release \
               mhddfs moka-icon-theme mysql-client nautilus ncdu neovim net-tools network-manager \
               nmap openssh-client openssh-server plank pv samba screenfetch simple-scan sshfs synaptic \
               testdisk tilix thunar transmission-gtk tree usb-creator-gtk unzip viewnior \
               vlc wget whois zip";
  tInstall_=$(sPackages_ "$lPrograms1_");
  sudo apt install $tInstall_ -y;

  installAdditionalSoftware_;

  echo -e "\n\n$uPl_ was installed successfully...\n\n\n";
}



# -  - #
# - uFullProgramsList_ - #
function uFullProgramsList_(){
  local uPl_='Ubuntu full programs list';
  echo -e "\n\nInstalling $uPl_...\n\n";

  Log_ 7;

  lPrograms1_="arc-theme bindfs bleachbit brasero clementine curl duf dolphin evince extlinux fastfetch filelight \
               file-roller filezilla flatpak gcc gdebi gedit geeqie gimp git gnome-disk-utility gnome-multi-writer \
               gnome-screenshot gnupg gpart gparted gvfs gvfs-backends gvfs-fuse gpicview htop inxi k3b kde-spectacle kpat \
               lsb-release makepkg mhddfs moka-icon-theme mysql-client nautilus ncdu neovim net-tools \
               network-manager nmap openssh-client openssh-server pinta plank pv rsync samba screenfetch simple-scan \
               snapd  software-properties-common sshfs synaptic testdisk tilix thunar transmission-gtk \
               tree usb-creator-gtk unzip viewnior vlc wget whois xfburn zip";
  tInstall_=$(sPackages_ "$lPrograms1_");
  sudo apt install $tInstall_ -y;

  installAdditionalSoftware_;

  echo -e "\n\n$uPl_ was installed successfully...\n\n\n";
}



# -  - #
# - AdditionalPrograms_ - #
function AdditionalPrograms_(){
  local uPl_='Ubuntu additional programs list';
  echo -e "\n\nInstalling $uPl_...\n\n";

  lPrograms1_="ca-certificates kde-spectacle snapd";
  tInstall_=$(sPackages_ "$lPrograms1_");
  sudo apt install $tInstall_ -y;

  # -  - #
  # - Printer manager - #
  lPrograms1_="cups printer-driver-cups-pdf hplip";
  tInstall_=$(sPackages_ "$lPrograms1_");
  sudo apt install $tInstall_ -y;

  sudo apt install system-config-printer -y;
  sudo systemctl enable cups;

  sudo snap install bpytop;

<<'comment'
  sudo apt install plank -y;
  sudo apt install qemu-guest-agent -y;
comment

  echo -e "\n\n$uPl_ was installed successfully...\n\n\n";
}



source <(curl -s https://www.education.isdevelopment.us/Functions/Functions.sh)



checkComputer_ uGFinalConfiguration.sh;
Greetings_;
distroVersion_;
update_;


installPrograms_;

installFlatpak_;
gnomeDesktopSoftware_;
wareHouse_;

Wallpapers_;
ubuntuIconsInstall_;
obsidianFlowShellTheme_;



rm -rf $sF_;
echo -e "\n\nPlease wait a moment to cotinue the system configuration...";
sleep 10;

eDashtoDock_;
screenResolution_;
dconfConfiguration_;



# -  - #
# - Mount /Data partition/folder - #
bash <(curl -s https://www.education.isdevelopment.us/Arch.Ins/Software.Ins/BashFiles.Ins/Data-To-fstab.sh)

# -  - #
# - Create Documents DataFoldersConfiguration - #
bash <(curl -s https://www.education.isdevelopment.us/Arch.Ins/Software.Ins/BashFiles.Ins/DataFoldersConfiguration.sh)

# -  - #
# - Installing fastfetch - #
bash <(curl -s https://www.education.isdevelopment.us/fastFetch/fastFetch.sh)

# -  - #
# - Installing & configuring Eza - #
bash <(curl -s https://www.education.isdevelopment.us/Eza/Eza.sh)



echo -e "\n\nGnome extensions were configured successfully...";
echo -e "\n\nComputer will shutdown now so all changes are applied...";

sleep 10;
sudo reboot now;



<<'comment'
eTilingShell_;
sudo shutdown now;

cd ~/; rm -rf ~/uGFinalConfiguration.sh; nvim ~/uGFinalConfiguration.sh;
copy & paste this content
chmod +x ~/uGFinalConfiguration.sh; ~/./uGFinalConfiguration.sh;
comment



# - eof - #