dotfiles/update.sh
2024-09-06 08:31:54 +02:00

32 lines
796 B
Bash
Executable File

#!/bin/bash
cd ~/.dotfiles
echo "Checking for dotfile updates..."
git fetch
if [ $(git rev-parse HEAD) == $(git rev-parse @{u}) ]
then
if [ "$1" == -y ]
then
echo "Updating..."
git pull >> /dev/null
echo "Updated successfully"
echo "Sourcing new changes..."
source ./source
echo "Sourced new changes 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"
echo "Sourcing new changes..."
source ./source
echo "Sourced new changes successfully"
fi
fi
else
echo "Dotfiles are up-to-date"
fi