arch-automated-installer/scripts/system-setup/dotfiles-setup.sh

37 lines
1,001 B
Bash
Raw Normal View History

#!/bin/bash
2024-06-28 19:13:14 +00:00
# Set Home directory for the current user
repos_dir=/home/$1/Repos
2024-06-28 19:13:14 +00:00
if [[ ! -d $repos_dir ]]; then
echo "mkdir $repos_dir"
fi
2024-06-28 19:13:14 +00:00
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