Complete system setup part of script

This commit is contained in:
Rodolfo 2024-06-29 03:13:14 +08:00
parent 3f93fd90de
commit 11bc672f97
10 changed files with 260 additions and 113 deletions

View file

@ -0,0 +1,8 @@
deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
deb http://deb.debian.org/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian bookworm-updates main contrib nonfree non-free-firmware

View file

@ -0,0 +1,15 @@
#!/bin/bash
# Setup Audio Drivers
if [[ $1 == "Debian" ]]; then
if [[ $2 == "pipewire" ]]; then
echo "apt-get -y install pipewire-audio"
fi
if [[ $2 == "pulseaudio" ]]; then
echo "Skipping: No further action required"
fi
fi
if [[ $1 == "Arch" ]]; then
echo "audio setup"
fi

View file

@ -1,19 +1,36 @@
#!/bin/bash
home_dir="/home/""$(ls /home/)"
# Set Home directory for the current user
repos_dir=/home/$1/Repos
if [[ -d $home_dir ]]; then
echo "Has valid home directory"
while [[ true ]]; do
if [[ -d $home_dir/Repos ]]; then
echo "Has valid Repos directory"
read -p "Enter your dotfiles repo: " repo
echo "git clone $repo $home_dir/Repos"
if [[ ! -d $repos_dir ]]; then
echo "mkdir $repos_dir"
fi
if [[ ! -d /home/$1/.config ]]; then
echo "mkdir /home/$1/.config"
fi
while true; do
read -p "Do you have a dotfiles repository you would like to clone? (y/n): " answer
answer="${answer,,}"
if [[ $answer == "y" ]]; then
while true; do
read -p "Enter your dotfiles repo (<branch> <url>): " repo
echo "git clone -b $repo $repos_dir/dotfiles"
if [[ $? = 0 ]]; then
for file in $repos_dir/dotfiles/*; do
echo "ln -s $file /home/$1/.config/"
done
break
else
mkdir $home_dir/Repos
echo "Invalid Repo or Authentication"
fi
done
else
echo "no valid home directory"
fi
break
elif [[ $answer == "n" ]]; then
echo "Skipping dotfiles setup..."
break
else
echo "Invalid Input. Please enter 'y' or 'n'"
fi
done

View file

@ -1,24 +1,9 @@
#!/bin/bash
if [[ $1 == "Debian" ]]; then
echo "$1 git-setup"
echo "apt-get install git"
echo "apt-get -y install git"
elif [[ $1 == "Arch" ]]; then
echo "$1 git-setup"
echo "pacman -S git"
while [[ true ]]; do
read -p "Git Setup: Enter your full name: " name
read -p "Git Setup: Enter your email address: " email
if [[ ! -z $name && ! -z $email ]]; then
break
else
echo "Invalid name or address, Please re-enter"
fi
done
echo "git config --global user.name $name"
echo "git config --global user.email $email"
fi

View file

@ -0,0 +1,27 @@
#!/bin/bash
if [[ $1 == "Debian" ]]; then
if cat /etc/apt/sources.list | grep -E "sid|unstable"; then
if [[ $3 == "xorg" ]]; then
echo "apt-get -y install xorg"
fi
if [[ $3 == "wayland" ]]; then
echo "Error: Wayland not available on Debian"
exit 2
fi
if [[ $2 == "vm" ]]; then
echo "Skipping: No further action required"
fi
if [[ $2 == "nvidia" ]]; then
echo "apt-get -y install nvidia-driver firmware-misc-nonfree"
fi
else
if [[$2 == "nvidia" ]]; then
echo "apt-get -y install nvidia-driver firmware-misc-nonfree"
fi
fi
fi
if [[ $1 == "Arch" ]]; then
echo "gpu setup"
fi

View file

@ -0,0 +1,15 @@
#!/bin/bash
if [[ ! -d /home/$2/Software ]]; then
echo "mkdir /home/$2/Software"
fi
if [[ $1 == "Debian" ]]; then
echo "sudo apt-get -y install fzf ripgrep ninja-build gettext cmake unzip curl build-essential"
echo "git clone -b stable https://github.com/neovim/neovim /home/$2/Software"
echo "cd /home/$2/Software/neovim/ && make CMAKE_BUILD_TYPE=RelWithDebInfo && cd build && cpack -G DEB && sudo dpkg -i nvim-linux64.deb"
fi
if [[ $1 == "Arch" ]]; then
echo "pacman -S neovim"
fi

View file

@ -14,6 +14,8 @@ if [[ $1 == "Debian" ]]; then
break
elif [[ "$answer" = "n" ]]; then
echo "Proceeding with Debian Stable"
echo "cp -v ./debian-assets/debian-stable-sources.list /etc/apt/sources.list"
echo "apt-get update && apt-get -y dist-upgrade"
break
else
echo "Invalid Input. Please enter 'y' or 'n'."

View file

@ -2,36 +2,23 @@
if [[ $1 == "Debian" ]]; then
echo "$1 Sudo Setup"
while [[ true ]]; do
if [[ ! -z $(grep $2 /etc/passwd) ]]; then
echo "usermod -aG sudo $2"
if [[ -f /home/$2/ ]]; then
echo "Home exists"
else
echo "Home doesn't Exist"
echo "Username is Invalid"
exit 1
fi
fi
if [[ $1 == "Arch" ]]; then
if [[ ! -z $(grep $2 /etc/passwd) ]]; then
echo "usermod -aG wheel $2"
break
else
echo "Username is Invalid"
exit 1
fi
break
else
read -p "Invalid Username. Use an valid existing username." username
fi
done
elif [[ $1 == "Arch" ]]; then
echo "$1 Sudo Setup"
while [[ true ]]; do
if [[ ! -z $(grep $2 /etc/passwd) ]]; then
echo "usermod -aG wheel $2"
if [[ -f /home/$2/ ]]; then
echo "Home exists"
else
echo "Home doesn't Exist"
fi
break
else
read -p "Invalid Username. Use a valid existing username:" username
fi
done
fi

View file

@ -0,0 +1,13 @@
#!/bin/bash
if [[ $1 == "Debian" ]];then
echo "apt-get -y install ufw"
fi
if [[$1 == "Arch" ]];then
echo "ufw setup"
fi
echo "ufw default deny incoming"
echo "ufw default allow outgoing"
echo "ufw allow ssh"

View file

@ -1,70 +1,148 @@
#!/bin/bash
# Parent installer for all System Setup Scripts.
#{{{### Pre-Setup ###
# Select Window Manager
while true; do
printf %"s\n\n" "Window Manager Selection(1-3):"
printf %"s\n" "1) i3wm"
printf %"s\n" "2) AwesomeWM"
printf %"s\n\n" "3) Hyprland"
read -p "Enter your Selection: " answer
# User Identification
username=$(whoami)
if [[ $username == "root" ]]; then
echo "Do not run this script as root"
exit 2
fi
case $answer in
1) windowmanager=i3wm && break;;
2) windowmanager=awesomewm && break;;
3) windowmanager=hyprland && break;;
*) echo "invalid option";;
esac
done
# Verify Home Directory
home_dir=/home/$username
if [[ ! -d /home/$username ]]; then
echo "Error: No valid home directory for $username"
exit 2
fi
# Select Graphics Drivers
while true; do
printf %"s\n\n" "Select Graphics Environment(1-6):"
printf %"s\n" "1) Nvidia GPU Proprietary"
printf %"s\n" "2) Nvidia GPU Nouveau"
printf %"s\n" "3) AMD GPU"
printf %"s\n" "4) Integrated Intel GPU"
printf %"s\n" "5) Integrated AMD GPU"
printf %"s\n\n" "6) Virtual Box"
read -p "Enter your Selection: " answer
case $answer in
1) GPUDriver=hyprland && break;;
2) GPUDriver=hyprland && break;;
3) GPUDriver=hyprland && break;;
4) GPUDriver=hyprland && break;;
5) GPUDriver=hyprland && break;;
6) GPUDriver=hyprland && break;;
*) echo "invalid option";;
esac
done
echo "$GPUDriver"
if [[ ! -z $(which apt-get) ]]; then
# System Identification
if [[ -d /etc/apt/ ]]; then
system=Debian
echo "System Identified: $system"
elif [[ ! -z $(which pacman) ]]; then
system=Arch
echo "System Identified: $system"
else
echo "System Misconfigured"
break
echo "System could not Identified"
exit 2
fi
script_path="$(pwd)/scripts"
# Window Manager Selection
if [[ $system == "Debian" ]]; then
echo -ne "
Window Manager Selection:
script_path="$(pwd)/scripts/system-setup/"
username=$(whoami)
"
printf %"s\n" "1) i3wm"
printf %"s\n\n" "2) AwesomeWM"
while true; do
read -p "Enter your Selection (1-2): " answer
if [ $username == "root" ]; then
echo "Error: Do not run script as root."
break
case $answer in
1) windowmanager=i3wm && displayserver=xorg && break;;
2) windowmanager=awesomewm && displayserver=xorg && break;;
*) echo "invalid option";;
esac
done
fi
echo "su - -c "$script_path/install-pkgs.sh $system $username""
echo "su - -c "$script_path/sources-setup.sh $system && $script_path/sudo-setup.sh $system $username && $script_path/git-setup.sh $system""
echo "bash $script_path/dotfiles-setup.sh $system"
if [[ $system == "Arch" ]]; then
echo -ne "
Window Manager Selection:
echo "done"
"
printf %"s\n" "1) i3wm"
printf %"s\n" "2) AwesomeWM"
printf %"s\n\n" "3) Hyprland"
while true; do
read -p "Enter your Selection (1-3): " answer
case $answer in
1) windowmanager=i3wm && displayserver=xorg && break;;
2) windowmanager=awesomewm && displayserver=xorg && break;;
3) windowmanager=hyprland && displayserver=wayland && break;;
*) echo "invalid option";;
esac
done
fi
# GPU Driver Identification
echo -ne "
GPU Drivers Selection:
"
printf %"s\n" "1) Virtual Machine"
#printf %"s\n" "1) Integrated Intel Graphics"
#printf %"s\n" "2) Integrated AMD Graphics"
printf %"s\n\n" "2) Nvidia GPU"
#printf %"s\n" "5) AMD GPU"
#printf %"s\n\n" "6) Intel GPU"
while true; do
read -p "Enter your Selection (1-2): " answer
case $answer in
1) gpu=vm && break;;
2) gpu=nvidia && break;;
*) echo "invalid option";;
esac
done
# Select Audio Server
echo -ne "
Audio Drivers Selection:
"
printf %"s\n" "1) Pipewire"
printf %"s\n\n" "2) PulseAudioGPU"
while true; do
read -p "Enter your Selection (1-2): " answer
case $answer in
1) audioserver=pipewire && break;;
1) audioserver=pulseaudio && break;;
*) echo "invalid option";;
esac
done
echo -e "
"
#}}}
#{{{### Sudo Setup ###
echo -e "Sudo Setup
Enter your Root Accout Password:"
su - -c "bash $script_path/system-setup/sudo-setup.sh $system $username"
if [[ $? != 0 ]]; then
exit 2
fi
echo -e "
"
#}}}
#{{{### System Setup ###
echo -e "System Setup
Enter $username's Password:"
sudo bash "$script_path/system-setup/git-setup.sh" $system
if [[ $? != 0 ]]; then
exit 2
fi
sudo bash "$script_path/system-setup/gpu-setup.sh" $system $gpu $server
sudo bash "$script_path/system-setup/audio-setup.sh" $system $audioserver
sudo bash "$script_path/system-setup/ufw-setup.sh" $system
bash "$script_path/system-setup/dotfiles-setup.sh" $username
bash "$script_path/system-setup/neovim-setup.sh" $system $username
echo "
System Setup Done
"
#}}}
# {{{### Desktop Environment Setup ###
# }}}