fix: install script
This commit is contained in:
parent
f7b41b0b30
commit
666b66cd0c
26
install.sh
26
install.sh
@ -7,13 +7,27 @@ if [ "$(which git)" = "" ]; then
|
||||
fi
|
||||
|
||||
# - Cloning Repo -
|
||||
echo "-- Cloning repo --"
|
||||
cd $HOME
|
||||
git init
|
||||
git remote add origin https://github.com/jim-fx/.dotfiles.git
|
||||
git checkout -f main
|
||||
if [ -d ".git" ] || git rev-parse --git-dir > /dev/null 2>&1; then
|
||||
# Get the remote URL
|
||||
remote_url=$(git config --get remote.origin.url)
|
||||
|
||||
# Check if the remote URL contains a certain word
|
||||
if [[ $remote_url != *jim-fx/.dotfiles* ]]; then
|
||||
echo "Error: There is already a git repository setup at $HOME that is not pointing to the dotfiles"
|
||||
else
|
||||
echo "-- updating dotfiles --"
|
||||
git fetch
|
||||
git checkout -f main
|
||||
fi
|
||||
else
|
||||
echo "-- initializing dotfiles --"
|
||||
git init
|
||||
git remote add origin https://github.com/jim-fx/.dotfiles.git
|
||||
git fetch
|
||||
git checkout -f main
|
||||
fi
|
||||
|
||||
# - Executing the script -
|
||||
echo "-- starting script --"
|
||||
chmod +x ~/.dotfiles/setup.sh
|
||||
echo "-- starting setup script --"
|
||||
~/.dotfiles/setup.sh
|
||||
|
Loading…
Reference in New Issue
Block a user