Refactor sudo git and sources setup scripts
This commit is contained in:
parent
5b1c384051
commit
0a88ff887b
69
scripts/system-setup/install-pkgs.sh
Normal file
69
scripts/system-setup/install-pkgs.sh
Normal file
|
@ -0,0 +1,69 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ $1 == "Debian" ]]; then
|
||||
|
||||
# Setup sources
|
||||
echo "$1 Sources Setup"
|
||||
echo "apt-get update && apt-get -y upgrade"
|
||||
|
||||
while true; do
|
||||
read -rp "Would you like to use Debian Unstable? (y/n): " answer
|
||||
answer="${answer,,}"
|
||||
|
||||
if [[ "$answer" = "y" ]]; then
|
||||
echo "Changing apt sources"
|
||||
echo "cp -v ./debian-assets/debian-sid-sources.list /etc/apt/sources.list"
|
||||
echo "apt-get update && apt-get -y dist-upgrade"
|
||||
break
|
||||
elif [[ "$answer" = "n" ]]; then
|
||||
echo "Proceeding with Debian Stable"
|
||||
break
|
||||
else
|
||||
echo "Invalid Input. Please enter 'y' or 'n'."
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
# Sudo Setup
|
||||
echo "$1 Sudo Setup"
|
||||
echo "apt-get -y install sudo"
|
||||
|
||||
while true; do
|
||||
if [[ ! -z $(grep $2 /etc/passwd) ]]; then
|
||||
echo "usermod -aG sudo $2"
|
||||
break
|
||||
else
|
||||
read -p "Invalid Username. Use an valid existing username." username
|
||||
fi
|
||||
done
|
||||
|
||||
echo "apt-get -y install "
|
||||
fi
|
||||
|
||||
if [[ $1 == "Arch" ]]; then
|
||||
|
||||
# Setup Sources
|
||||
echo "$1 Sources Setup"
|
||||
|
||||
echo "$1 Sudo Setup"
|
||||
fi
|
||||
|
||||
if [[ $1 == "Debian" ]]; then
|
||||
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
|
|
@ -1,14 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
read -p "Enter the user to add to Sudo: " username
|
||||
|
||||
if [[ $1 == "Debian" ]]; then
|
||||
|
||||
echo "$1 Sudo Setup"
|
||||
while [[ true ]]; do
|
||||
if [[ ! -z $(grep $username /etc/passwd) ]]; then
|
||||
echo "usermod -aG sudo $username"
|
||||
if [[ -f /home/$username/ ]]; then
|
||||
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"
|
||||
|
@ -23,9 +21,9 @@ elif [[ $1 == "Arch" ]]; then
|
|||
|
||||
echo "$1 Sudo Setup"
|
||||
while [[ true ]]; do
|
||||
if [[ ! -z $(grep $username /etc/passwd) ]]; then
|
||||
echo "usermod -aG wheel $username"
|
||||
if [[ -f /home/$username/ ]]; then
|
||||
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"
|
||||
|
|
|
@ -2,6 +2,46 @@
|
|||
|
||||
# Parent installer for all System Setup Scripts.
|
||||
|
||||
# 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
|
||||
|
||||
case $answer in
|
||||
1) windowmanager=i3wm && break;;
|
||||
2) windowmanager=awesomewm && break;;
|
||||
3) windowmanager=hyprland && break;;
|
||||
*) echo "invalid option";;
|
||||
esac
|
||||
done
|
||||
|
||||
# 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=Debian
|
||||
echo "System Identified: $system"
|
||||
|
@ -13,13 +53,18 @@ else
|
|||
break
|
||||
fi
|
||||
|
||||
systemsetup="./scripts/system-setup"
|
||||
|
||||
for FILE in "$systemsetup"/*
|
||||
do
|
||||
if [[ -f "$FILE" ]]; then
|
||||
bash $FILE $system
|
||||
fi
|
||||
done
|
||||
|
||||
script_path="$(pwd)/scripts/system-setup/"
|
||||
username=$(whoami)
|
||||
|
||||
if [ $username == "root" ]; then
|
||||
echo "Error: Do not run script as root."
|
||||
break
|
||||
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"
|
||||
|
||||
echo "done"
|
||||
|
|
Loading…
Reference in a new issue