mirror of
https://github.com/wahyd4/gvm.git
synced 2026-08-09 04:46:19 +10:00
* Use $(..) instead of deprecated .., which can produce unknown behaviors on posix systems
* No need to change path when git cloning - use --quiet instead of redirecting stdout
This commit is contained in:
@@ -10,7 +10,7 @@ display_error() {
|
||||
update_profile() {
|
||||
[ -f $1 ] || return 1
|
||||
|
||||
cat $1 | grep "$source_line" > /dev/null 2>&1
|
||||
grep "$source_line" "$1" > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "$source_line" >> $1
|
||||
fi
|
||||
@@ -52,13 +52,14 @@ fi
|
||||
[ "$GVM_DEST" == "" ] && display_error "No destination specified!"
|
||||
[ -d $GVM_DEST/$GVM_NAME ] && display_error "Already installed!"
|
||||
[ -d $GVM_DEST ] || mkdir -p $GVM_DEST > /dev/null 2>&1 || display_error "Failed to create $GVM_DEST"
|
||||
[ -z `which git` ] && display_error "Could not find git
|
||||
[ -z "$(which git)" ] && display_error "Could not find git
|
||||
|
||||
linux: apt-get install git
|
||||
debina/ubuntu: apt-get install git
|
||||
redhat/centos: yum install git
|
||||
mac: brew install git
|
||||
"
|
||||
|
||||
cd $GVM_DEST && git clone $SRC_REPO $GVM_NAME > /dev/null 2>&1 ||
|
||||
git clone --quiet $SRC_REPO "$GVM_DEST/$GVM_NAME" 2> /dev/null ||
|
||||
display_error "Failed to clone from $SRC_REPO into $GVM_DEST/$GVM_NAME"
|
||||
|
||||
if [ "$BRANCH" != "" ]; then
|
||||
@@ -78,9 +79,9 @@ fi
|
||||
|
||||
if [ -n "$ZSH_NAME" ]; then
|
||||
update_profile $HOME/.zshrc
|
||||
elif [ "`uname`" == "Linux" ]; then
|
||||
elif [ "$(uname)" == "Linux" ]; then
|
||||
update_profile $HOME/.bashrc || update_profile $HOME/.bash_profile
|
||||
elif [ "`uname`" == "Darwin" ]; then
|
||||
elif [ "$(uname)" == "Darwin" ]; then
|
||||
update_profile $HOME/.profile || update_profile $HOME/.bash_profile
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user