dotfiles/update.sh

25 lines
561 B
Bash
Raw Normal View History

2024-09-04 15:20:16 +02:00
#!/bin/bash
cd ~/.dotfiles
2024-09-04 15:30:06 +02:00
echo "Checking for dotfile updates..."
2024-09-04 15:20:16 +02:00
git fetch
2024-09-04 19:33:39 +02:00
if [ $(git rev-parse HEAD) != $(git rev-parse @{u}) ]
2024-09-04 15:20:16 +02:00
then
2024-09-04 19:33:39 +02:00
if [ "$1" == -y ]
then
echo "Updating..."
git pull >> /dev/null
echo "Updated successfully"
else
read -p "Dotfiles can be updated. Do you want to proceed? (y/n) " choice
if [ "$choice" = "y" ]
then
echo "Updating..."
git pull >> /dev/null
echo "Updated successfully"
fi
fi
2024-09-04 15:30:06 +02:00
else
echo "Dotfiles are up-to-date"
2024-09-04 19:33:39 +02:00
fi