mirror of
https://github.com/wahyd4/gvm.git
synced 2026-08-09 04:46:19 +10:00
27 lines
553 B
Bash
Executable File
27 lines
553 B
Bash
Executable File
#!/bin/bash
|
|
display_error() {
|
|
tput sgr0
|
|
tput setaf 1
|
|
echo "ERROR: $1" >&2
|
|
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"
|
|
|