dotfiles/update.sh

32 lines
796 B
Bash
Raw Permalink 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-06 08:31:54 +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"
2024-09-06 08:31:54 +02:00
echo "Sourcing new changes..."
source ./source
echo "Sourced new changes successfully"
2024-09-04 19:33:39 +02:00
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"
2024-09-06 08:31:54 +02:00
echo "Sourcing new changes..."
source ./source
echo "Sourced new changes successfully"
2024-09-04 19:33:39 +02:00
fi
fi
2024-09-04 15:30:06 +02:00
else
echo "Dotfiles are up-to-date"
2024-09-06 08:31:54 +02:00
fi