Files
gvm/scripts/get
T
2012-02-02 03:22:24 -08:00

27 lines
549 B
Bash
Executable File

#!/bin/bash
display_error() {
tput sgr0
tput setaf 1
echo "ERROR: $1"
tput sgr0
exit 1
}
[[ -d $GVM_ROOT/.git ]] || mv $GVM_ROOT/git.bak $GVM_ROOT/.git &> /dev/null ||
display_error "Couldn't find git info"
cd $GVM_ROOT && git checkout -f ||
display_error "Failed to clean install"
if [[ -n $1 ]]; then
cd $GVM_ROOT && git checkout $1 -f ||
display_error "Failed to checkout $1 branch"
fi
cd $GVM_ROOT && git pull ||
display_error "Failed to update"
mv $GVM_ROOT/.git $GVM_ROOT/git.bak ||
display_error "Couldn't backup git info"