Update: System Setup scripts
Add: dotfiles-setup.sh
This commit is contained in:
parent
de714d18e6
commit
5b1c384051
19
scripts/system-setup/dotfiles-setup.sh
Executable file
19
scripts/system-setup/dotfiles-setup.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
home_dir="/home/""$(ls /home/)"
|
||||
|
||||
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"
|
||||
break
|
||||
else
|
||||
mkdir $home_dir/Repos
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "no valid home directory"
|
||||
fi
|
|
@ -1,3 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "git-setup"
|
||||
if [[ $1 == "Debian" ]]; then
|
||||
|
||||
echo "$1 git-setup"
|
||||
echo "apt-get 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
|
||||
|
|
|
@ -1,19 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
APT_CMD=$(which apt-get)
|
||||
PACMAN_CMD=$(which pacman)
|
||||
if [[ $1 == "Debian" ]]; then
|
||||
|
||||
if [[ ! -z $APT_CMD ]]; then
|
||||
|
||||
echo "System Identified: Debian"
|
||||
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 "Change apt sources"
|
||||
echo "cp -v ./debian-assets/debian-sid-sources.list /etc/sources.list"
|
||||
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
|
||||
|
@ -24,6 +20,6 @@ if [[ ! -z $APT_CMD ]]; then
|
|||
fi
|
||||
done
|
||||
|
||||
elif [[ ! -z $PACMAN_CMD ]]; then
|
||||
echo "Arch"
|
||||
elif [[ $1 == "Arch" ]]; then
|
||||
echo "$1 Sources Setup"
|
||||
fi
|
||||
|
|
|
@ -1,3 +1,39 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "sudo setup"
|
||||
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
|
||||
echo "Home exists"
|
||||
else
|
||||
echo "Home doesn't Exist"
|
||||
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 $username /etc/passwd) ]]; then
|
||||
echo "usermod -aG wheel $username"
|
||||
if [[ -f /home/$username/ ]]; 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
|
||||
|
|
|
@ -2,24 +2,24 @@
|
|||
|
||||
# Parent installer for all System Setup Scripts.
|
||||
|
||||
APT_CMD=$(which apt-get)
|
||||
PACMAN_CMD=$(which pacman)
|
||||
|
||||
if [[ -z $APT_CMD ]]; then
|
||||
if [[ ! -z $(which apt-get) ]]; then
|
||||
system=Debian
|
||||
echo "System Identified: Debian"
|
||||
elif [[ -z $PACMAN_CMD ]]; then
|
||||
echo "System Identified: $system"
|
||||
elif [[ ! -z $(which pacman) ]]; then
|
||||
system=Arch
|
||||
echo "System Identified: Arch"
|
||||
echo "System Identified: $system"
|
||||
else
|
||||
echo "System Misconfigured"
|
||||
break
|
||||
fi
|
||||
|
||||
systemsetup="./scripts/"
|
||||
systemsetup="./scripts/system-setup"
|
||||
|
||||
bash $systemsetup/sources-setup.sh $system
|
||||
bash $systemsetup/sudo-setup.sh $system
|
||||
bash $systemsetup/git-setup.sh $system
|
||||
for FILE in "$systemsetup"/*
|
||||
do
|
||||
if [[ -f "$FILE" ]]; then
|
||||
bash $FILE $system
|
||||
fi
|
||||
done
|
||||
|
||||
echo "done"
|
||||
|
|
Loading…
Reference in a new issue