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
|
fi
|
||||||
|
|
||||||
# - Cloning Repo -
|
# - Cloning Repo -
|
||||||
echo "-- Cloning repo --"
|
|
||||||
cd $HOME
|
cd $HOME
|
||||||
git init
|
if [ -d ".git" ] || git rev-parse --git-dir > /dev/null 2>&1; then
|
||||||
git remote add origin https://github.com/jim-fx/.dotfiles.git
|
# Get the remote URL
|
||||||
git checkout -f main
|
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 -
|
# - Executing the script -
|
||||||
echo "-- starting script --"
|
echo "-- starting setup script --"
|
||||||
chmod +x ~/.dotfiles/setup.sh
|
|
||||||
~/.dotfiles/setup.sh
|
~/.dotfiles/setup.sh
|
||||||
|
Loading…
Reference in New Issue
Block a user