37 lines
1,001 B
Bash
Executable file
37 lines
1,001 B
Bash
Executable file
#!/bin/bash
|
|
|
|
# Set Home directory for the current user
|
|
repos_dir=/home/$1/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
|
|
echo "Invalid Repo or Authentication"
|
|
fi
|
|
done
|
|
break
|
|
elif [[ $answer == "n" ]]; then
|
|
echo "Skipping dotfiles setup..."
|
|
break
|
|
else
|
|
echo "Invalid Input. Please enter 'y' or 'n'"
|
|
fi
|
|
done
|