Files

35 lines
693 B
Bash
Executable File

#!/bin/bash
if [[ $1 == "get" ]]; then
mv $GVM_ROOT/git.bak $GVM_ROOT/.git
if [ $? -ne 0 ]; then
echo "Couldn't find git info"
exit 1
fi
cd $GVM_ROOT && git checkout -f
if [ $? -ne 0 ]; then
echo "Failed to clean install"
exit 1
fi
if [[ -n $2 ]]; then
cd $GVM_ROOT && git checkout $2 -f
if [ $? -ne 0 ]; then
echo "Failed to checkout $2 branch"
exit 1
fi
fi
cd $GVM_ROOT && git pull
if [ $? -ne 0 ]; then
echo "Failed to update"
exit 1
fi
mv $GVM_ROOT/.git $GVM_ROOT/git.bak
if [ $? -ne 0 ]; then
echo "Couldn't backup git info"
exit 1
fi
else
echo "Please use gvm [action] to call this file"
exit 1
fi