2
0
mirror of https://github.com/kazhala/dotbare synced 2024-11-04 06:00:45 +00:00
dotbare/scripts/fupgrade
2020-05-19 20:50:34 +10:00

39 lines
692 B
Bash
Executable File

#!/usr/bin/env bash
#
# update dotbare to latest master
set -e
set -f
mydir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
function usage() {
echo -e "Usage: dotbare fupgrade [-h] ...\n"
echo -e "Update dotbare to the latest version\n"
echo -e "optional arguments:"
echo -e " -h\t\tshow this help message and exit"
}
while getopts ":h" opt; do
case "$opt" in
h)
usage
exit 0
;;
*)
echo "Invalid option: ${OPTARG}" >&2
usage
exit 1
;;
esac
done
# change directory to dotbare folder
cd "${mydir}/.."
echo "Fetching latest changes ..."
git fetch
git checkout master &> /dev/null
git pull origin master
echo "Done"
exit 0