#!/bin/bash
# - bof - #



<<'comment'

bash <(curl -s https://www.education.isdevelopment.us/Arch.Ins/05-Arch_WareHouseInstall-FlatpakManager.sh)



# :A
# -  - #
# - Arch Xfce final configuration script - #

# - Method   # 1 - #
bash <(curl -s https://www.education.isdevelopment.us/Arch.Ins/05-Arch_WareHouseInstall-FlatpakManager.sh)

# - Method   # 2 - #
cd ~/; xfC_=WareHouseInstall.sh;
curl -o ~/$xfC_ "https://www.education.isdevelopment.us/Arch.Ins/05-Arch_WareHouseInstall-FlatpakManager.sh"
chmod +x ~/$xfC_; ~/./$xfC_;
nvim ~/$xfC_;

# - Method   # 3 - #
cd ~/; rm -rf ~/WareHouseInstall.sh; nvim ~/WareHouseInstall.sh;
copy & paste this content
chmod +x ~/WareHouseInstall.sh; ~/./WareHouseInstall.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 ntp neovim screenfetch tree -y;
sudo pacman -S curl git htop inxi net-tools ntp neovim screenfetch tree --noconfirm --needed;
comment



# -  - #
# - Global variables - #

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

sF_=~/WareHouseInstall.sh;



# -  - #
# - Greetings_ - #
function Greetings_(){
  Header_;
  echo -e "\nby Djalmar Enrique Rayo (2025) - GNU General Public License (GPL)";
  echo "----------------------- Light version: $lightVersion_ -----------------------";
  echo -e "\n  Warning: This script is going to install the Flatpak-WareHouse"
  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/Arch.Ins/05-Arch_WareHouseInstall-FlatpakManager.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 -f small "Arch Linux" | lolcat;
  figlet -f small "Flatpak WareHouse" | lolcat;


  # -  - #
  # - 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;

}



source <(curl -s https://www.education.isdevelopment.us/Functions/Functions.sh)
lightVersion_=$( lVersion_ );



checkComputer_ WareHouseInstall.sh;
Greetings_;
distroVersion_;
update_;

installFlatpak_;
wareHouse_;



rm -rf $sF_;

echo -e "\n\nComputer will reboot so all changes are applied...";
sleep 10;

sudo shutdown now;



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



# - eof - #