From c1ec392bdd3fb4a2d8139cb473af8c6eb1ed1587 Mon Sep 17 00:00:00 2001 From: Ali Abbas Date: Sat, 12 Apr 2014 12:01:41 +0200 Subject: [PATCH 1/3] - Double quoting to avoid globbing - Remove unecessary $(cat) - switch * to ./* to avoid entries with dashes to be treated as options - replace $* with "$@" - repeating change path serial calls - unecessary if change path is called one (get script) --- binscripts/gvm-installer | 4 +- scripts/alias | 4 +- scripts/alias-create | 10 ++--- scripts/alias-delete | 8 ++-- scripts/alias-list | 4 +- scripts/cross | 12 +++--- scripts/diff | 6 +-- scripts/env/gvm | 26 ++++++------ scripts/env/pkgset-use | 8 ++-- scripts/env/use | 8 ++-- scripts/function/gvm_export_path | 2 +- scripts/function/tools | 8 ++-- scripts/functions | 2 +- scripts/get | 19 ++++----- scripts/gvm-default | 16 ++++---- scripts/install | 70 ++++++++++++++++---------------- scripts/linkthis | 4 +- scripts/list | 6 +-- scripts/listall | 8 ++-- scripts/pkgset | 4 +- scripts/pkgset-create | 14 +++---- scripts/pkgset-delete | 6 +-- scripts/pkgset-empty | 4 +- scripts/pkgset-list | 4 +- scripts/templates/binary | 10 ++--- scripts/uninstall | 10 ++--- scripts/update | 7 ++-- 27 files changed, 140 insertions(+), 144 deletions(-) diff --git a/binscripts/gvm-installer b/binscripts/gvm-installer index 3738bcf..5af0350 100755 --- a/binscripts/gvm-installer +++ b/binscripts/gvm-installer @@ -68,9 +68,9 @@ then else if [[ $GVM_DEST == *"$GIT_ROOT"* ]] then - ln -s $GIT_ROOT $GVM_DEST + ln -s "$GIT_ROOT" "$GVM_DEST" else - cp -r $GIT_ROOT $GVM_DEST/$GVM_NAME + cp -r "$GIT_ROOT" "$GVM_DEST/$GVM_NAME" fi fi diff --git a/scripts/alias b/scripts/alias index c47e762..ec500bf 100755 --- a/scripts/alias +++ b/scripts/alias @@ -1,10 +1,10 @@ #!/usr/bin/env bash -. $GVM_ROOT/scripts/functions +. "$GVM_ROOT/scripts/functions" command=$1 if [[ -f $GVM_ROOT/scripts/alias-$command ]]; then shift - $GVM_ROOT/scripts/alias-$command $@ + "$GVM_ROOT/scripts/alias-$command" "$@" elif [[ -n $command ]]; then display_fatal "Unrecognized command line argument: '$command'" else diff --git a/scripts/alias-create b/scripts/alias-create index 04648ad..c1ab988 100755 --- a/scripts/alias-create +++ b/scripts/alias-create @@ -1,5 +1,5 @@ #!/usr/bin/env bash -. $GVM_ROOT/scripts/functions +. "$GVM_ROOT/scripts/functions" [[ $1 != "" ]] || display_fatal "Please specifiy the alias name" @@ -12,12 +12,12 @@ [[ -f "$GVM_ROOT/environments/$2" ]] || display_fatal "Target doesn't exist!" -mkdir -p $GVM_ROOT/environments || +mkdir -p "$GVM_ROOT/environments" || display_fatal "Could not create folder" -mkdir -p $GVM_ROOT/gos/$1 || +mkdir -p "$GVM_ROOT/gos/$1" || display_fatal "Could not create folder" -cp $GVM_ROOT/environments/$2 $GVM_ROOT/environments/$1 || +cp "$GVM_ROOT/environments/$2" "$GVM_ROOT/environments/$1" || display_fatal "Could copy environment" -echo "export gvm_alias_name=\"$1\"" >> $GVM_ROOT/environments/$1 || +echo "export gvm_alias_name=\"$1\"" >> "$GVM_ROOT/environments/$1" || display_fatal "Could not extend environment" diff --git a/scripts/alias-delete b/scripts/alias-delete index 1efffd1..064dbf6 100755 --- a/scripts/alias-delete +++ b/scripts/alias-delete @@ -1,5 +1,5 @@ #!/usr/bin/env bash -. $GVM_ROOT/scripts/functions +. "$GVM_ROOT/scripts/functions" [[ $1 != "" ]] || display_fatal "Please specifiy the name" @@ -7,12 +7,12 @@ [[ -f $GVM_ROOT/environments/$1 ]] || display_fatal "Alias doesn't exist!" -cat $GVM_ROOT/environments/$1 | $GREP_PATH "gvm_alias_name" > /dev/null || +$GREP_PATH "gvm_alias_name" "$GVM_ROOT/environments/$1" > /dev/null || display_fatal "$1 is not an alias!" -rm -rf $GVM_ROOT/environments/$1 || +rm -rf "$GVM_ROOT/environments/$1" || display_fatal "Could not delete alias" -rm -rf $GVM_ROOT/gos/$1 || +rm -rf "$GVM_ROOT/gos/$1" || display_fatal "Could not delete alias" diff --git a/scripts/alias-list b/scripts/alias-list index 160444f..6054c1a 100755 --- a/scripts/alias-list +++ b/scripts/alias-list @@ -1,11 +1,11 @@ #!/usr/bin/env bash -. $GVM_ROOT/scripts/functions +. "$GVM_ROOT/scripts/functions" echo display_message "gvm go aliases" echo -for a in $(cd $GVM_ROOT/environments ; grep -l "gvm_alias_name" *); do +for a in $(cd "$GVM_ROOT/environments" ; grep -l "gvm_alias_name" ./*); do t=$(sh -c ". $GVM_ROOT/environments/$a ; echo \$gvm_go_name") echo " $a ($t)" done diff --git a/scripts/cross b/scripts/cross index b32c901..a107401 100755 --- a/scripts/cross +++ b/scripts/cross @@ -1,5 +1,5 @@ #!/usr/bin/env bash -. $GVM_ROOT/scripts/functions +. "$GVM_ROOT/scripts/functions" display_usage() { display_message "Usage: gvm cross [os] [arch]" @@ -13,9 +13,9 @@ display_list() { echo display_message "Installed platforms:" echo - $LS_PATH $GOROOT/pkg | $GREP_PATH windows_ | sed 's/^/ /g' - $LS_PATH $GOROOT/pkg | $GREP_PATH darwin_ | sed 's/^/ /g' - $LS_PATH $GOROOT/pkg | $GREP_PATH linux_ | sed 's/^/ /g' + $LS_PATH "$GOROOT/pkg" | $GREP_PATH windows_ | sed 's/^/ /g' + $LS_PATH "$GOROOT/pkg" | $GREP_PATH darwin_ | sed 's/^/ /g' + $LS_PATH "$GOROOT/pkg" | $GREP_PATH linux_ | sed 's/^/ /g' echo exit 1 } @@ -33,7 +33,7 @@ if [ ! -f "$GOROOT/pkg/tool/cross" ]; then display_fatal "Couldn't compile tool: $arch$cmd" done done - touch $GOROOT/pkg/tool/cross + touch "$GOROOT/pkg/tool/cross" fi export GOOS=$1 @@ -47,7 +47,7 @@ if [ ! -d "$GOROOT/pkg/${GOOS}_${GOARCH}" ]; then export CGO_ENABLED=0 fi - cd $GOROOT/src + cd "$GOROOT/src" go tool dist install -v pkg/runtime || display_fatal "Couldn't compile runtime library for $GOOS $GOARCH" go install -v -a std || diff --git a/scripts/diff b/scripts/diff index 1961ed2..a57a199 100755 --- a/scripts/diff +++ b/scripts/diff @@ -1,10 +1,10 @@ #!/usr/bin/env bash -. $GVM_ROOT/scripts/functions +. "$GVM_ROOT/scripts/functions" version=$1 if [ "$version" != "" ]; then - fuzzy_match=`$LS_PATH $GVM_ROOT/gos | $SORT_PATH | $GREP_PATH "$version" | $HEAD_PATH -n 1 | $GREP_PATH "$version"` || + fuzzy_match=$($LS_PATH "$GVM_ROOT/gos" | $SORT_PATH | $GREP_PATH "$version" | $HEAD_PATH -n 1 | $GREP_PATH "$version") || display_fatal "Invalid version $version" foldername=$GVM_ROOT/gos/$fuzzy_match @@ -17,7 +17,7 @@ else fi if [[ -d $foldername ]]; then - cd $foldername + cd "$foldername" find . > /tmp/manifest.test diff manifest /tmp/manifest.test if [[ "$?" == "0" ]]; then diff --git a/scripts/env/gvm b/scripts/env/gvm index f7af9b1..0a6702f 100644 --- a/scripts/env/gvm +++ b/scripts/env/gvm @@ -1,5 +1,5 @@ #!/usr/bin/env bash -. $GVM_ROOT/scripts/functions || return 1 +. "$GVM_ROOT/scripts/functions" || return 1 function gvm() { if [[ "$GVM_ROOT" == "" ]]; then @@ -7,7 +7,7 @@ function gvm() { return $? fi if [[ -d $GVM_ROOT/.git ]]; then - mv $GVM_ROOT/.git $GVM_ROOT/git.bak || + mv "$GVM_ROOT/.git" "$GVM_ROOT/git.bak" || display_error "Failed to move git info out of the way" fi if [[ ! -d $GVM_ROOT ]]; then @@ -15,25 +15,25 @@ function gvm() { return $? fi - mkdir -p $GVM_ROOT/logs > /dev/null 2>&1 - mkdir -p $GVM_ROOT/gos > /dev/null 2>&1 - mkdir -p $GVM_ROOT/archive > /dev/null 2>&1 - mkdir -p $GVM_ROOT/archive/package > /dev/null 2>&1 - mkdir -p $GVM_ROOT/environments > /dev/null 2>&1 + mkdir -p "$GVM_ROOT/logs" > /dev/null 2>&1 + mkdir -p "$GVM_ROOT/gos" > /dev/null 2>&1 + mkdir -p "$GVM_ROOT/archive" > /dev/null 2>&1 + mkdir -p "$GVM_ROOT/archive/package" > /dev/null 2>&1 + mkdir -p "$GVM_ROOT/environments" > /dev/null 2>&1 if [[ "$1" == "use" ]]; then - . $GVM_ROOT/scripts/env/use + . "$GVM_ROOT/scripts/env/use" shift - gvm_use $@ + gvm_use "$@" elif [[ "$1" == "implode" ]]; then - rm -rf $GVM_ROOT + rm -rf "$GVM_ROOT" elif [[ "$1" == "pkgset" ]] && [[ "$2" == "use" ]]; then - . $GVM_ROOT/scripts/env/pkgset-use + . "$GVM_ROOT/scripts/env/pkgset-use" shift shift - gvm_pkgset_use $@ + gvm_pkgset_use "$@" else - $GVM_ROOT/bin/gvm $@ + "$GVM_ROOT/bin/gvm" "$@" fi } diff --git a/scripts/env/pkgset-use b/scripts/env/pkgset-use index c052d44..2d390dd 100644 --- a/scripts/env/pkgset-use +++ b/scripts/env/pkgset-use @@ -7,14 +7,14 @@ function gvm_pkgset_use() { display_error "No Go version selected" || return 1 if [[ "$1" == "--local" ]]; then - . $GVM_ROOT/scripts/function/find_local_pkgset + . "$GVM_ROOT/scripts/function/find_local_pkgset" local LOCAL_TOP=$(find_local_pkgset) unset -f find_local_pkgset [[ -d $LOCAL_TOP ]] || display_error "Caonnt find local pakcage set" || return 1 LOCAL_TOP=$LOCAL_TOP/.gvm_local - fuzzy_match=`$LS_PATH $LOCAL_TOP/environments | $SORT_PATH | $GREP_PATH "$gvm_go_name@" | $GREP_PATH "local" | $HEAD_PATH -n 1` || + fuzzy_match=$($LS_PATH "$LOCAL_TOP/environments" | $SORT_PATH | $GREP_PATH "$gvm_go_name@" | $GREP_PATH "local" | $HEAD_PATH -n 1) || display_error "Cannot find local package set" || return 1 [[ "$2" != "--default" ]] || @@ -27,7 +27,7 @@ function gvm_pkgset_use() { echo "Now using version $gvm_go_name in local package set" echo "Local GOPATH is now $LOCAL_TOP" else - fuzzy_match=`$LS_PATH $GVM_ROOT/environments | $SORT_PATH | $GREP_PATH "$gvm_go_name@" | $GREP_PATH "$1" | $HEAD_PATH -n 1` || + fuzzy_match=$($LS_PATH "$GVM_ROOT/environments" | $SORT_PATH | $GREP_PATH "$gvm_go_name@" | $GREP_PATH "$1" | $HEAD_PATH -n 1) || display_error "Invalid package set" || return 1 gvm_export_path @@ -35,7 +35,7 @@ function gvm_pkgset_use() { display_error "Failed to source the package set environment" || return 1 if [[ "$2" == "--default" ]]; then - cp $GVM_ROOT/environments/$fuzzy_match $GVM_ROOT/environments/default + cp "$GVM_ROOT/environments/$fuzzy_match" "$GVM_ROOT/environments/default" fi echo "Now using version $fuzzy_match" diff --git a/scripts/env/use b/scripts/env/use index 33b5be2..417f732 100644 --- a/scripts/env/use +++ b/scripts/env/use @@ -3,10 +3,10 @@ function gvm_use() { [[ "$1" != "" ]] || display_error "Please specifiy the version" || return 1 local VERSION=$1 - fuzzy_match=`$LS_PATH $GVM_ROOT/gos | $SORT_PATH | $GREP_PATH "$1" | $HEAD_PATH -n 1 | $GREP_PATH "$1"` + fuzzy_match=$($LS_PATH "$GVM_ROOT/gos" | $SORT_PATH | $GREP_PATH "$1" | $HEAD_PATH -n 1 | $GREP_PATH "$1") if [[ "$?" != "0" ]]; then GO_CACHE_PATH=$GVM_ROOT/archive/go - version=`hg tags -R $GO_CACHE_PATH | awk '{print $1}' | $SORT_PATH | $GREP_PATH "$VERSION" | $HEAD_PATH -n 1 | $GREP_PATH "$VERSION"` + version=$(hg tags -R "$GO_CACHE_PATH" | awk '{print $1}' | $SORT_PATH | $GREP_PATH "$VERSION" | $HEAD_PATH -n 1 | $GREP_PATH "$VERSION") if [[ "x$version" == "x" ]]; then display_error "Version not found locally. Try 'gvm install $1'" || return 1 else @@ -15,9 +15,9 @@ function gvm_use() { fi gvm_export_path - . $GVM_ROOT/environments/$fuzzy_match &> /dev/null || display_error "Couldn't source environment" || return 1 + . "$GVM_ROOT/environments/$fuzzy_match" &> /dev/null || display_error "Couldn't source environment" || return 1 if [[ "$2" == "--default" ]]; then - cp $GVM_ROOT/environments/$fuzzy_match $GVM_ROOT/environments/default || display_error "Couldn't make $fuzzy_match default" + cp "$GVM_ROOT/environments/$fuzzy_match" "$GVM_ROOT/environments/default" || display_error "Couldn't make $fuzzy_match default" fi display_message "Now using version $fuzzy_match" diff --git a/scripts/function/gvm_export_path b/scripts/function/gvm_export_path index b1f518d..7f8e4cb 100644 --- a/scripts/function/gvm_export_path +++ b/scripts/function/gvm_export_path @@ -1,6 +1,6 @@ #!/usr/bin/env bash function gvm_export_path() { - export PATH="$GVM_ROOT/bin:`echo "$PATH" | tr ":" "\n" | grep -v '^$' | egrep -v "$GVM_ROOT/(pkgsets|gos|bin)" | tr "\n" ":" | sed 's/:*$//'`" + export PATH="$GVM_ROOT/bin:$(echo "$PATH" | tr ":" "\n" | grep -v '^$' | egrep -v "$GVM_ROOT/(pkgsets|gos|bin)" | tr "\n" ":" | sed 's/:*$//')" export GVM_PATH_BACKUP="$PATH" } diff --git a/scripts/function/tools b/scripts/function/tools index 93442bb..8210129 100644 --- a/scripts/function/tools +++ b/scripts/function/tools @@ -4,8 +4,8 @@ GREP_ERROR="GVM couldn't find grep" SORT_ERROR="GVM couldn't find sort" HEAD_ERROR="GVM couldn't find head" -LS_PATH=`unalias ls &> /dev/null; which ls` || display_error "$LS_ERROR" || return 1 -GREP_PATH=`unalias grep &> /dev/null; which grep` || display_error "$GREP_ERROR" || return 1 -SORT_PATH=`unalias sort &> /dev/null; which sort` || display_error "$SORT_ERROR" || return 1 -HEAD_PATH=`unalias head &> /dev/null; which head` || display_error "$HEAD_ERROR" || return 1 +LS_PATH=$(unalias ls &> /dev/null; which ls) || display_error "$LS_ERROR" || return 1 +GREP_PATH=$(unalias grep &> /dev/null; which grep) || display_error "$GREP_ERROR" || return 1 +SORT_PATH=$(unalias sort &> /dev/null; which sort) || display_error "$SORT_ERROR" || return 1 +HEAD_PATH=$(unalias head &> /dev/null; which head) || display_error "$HEAD_ERROR" || return 1 diff --git a/scripts/functions b/scripts/functions index ff3117b..de26447 100644 --- a/scripts/functions +++ b/scripts/functions @@ -1,4 +1,4 @@ #!/usr/bin/env bash for function in $GVM_ROOT/scripts/function/*; do - . $function + . "$function" done diff --git a/scripts/get b/scripts/get index 56cb7aa..9f5cc88 100755 --- a/scripts/get +++ b/scripts/get @@ -1,20 +1,17 @@ #!/usr/bin/env bash -. $GVM_ROOT/scripts/functions +. "$GVM_ROOT/scripts/functions" -[[ -d $GVM_ROOT/.git ]] || mv $GVM_ROOT/git.bak $GVM_ROOT/.git &> /dev/null || +[[ -d $GVM_ROOT/.git ]] || mv "$GVM_ROOT/git.bak" "$GVM_ROOT/.git" &> /dev/null || display_fatal "Couldn't find git info" -cd $GVM_ROOT && git checkout -f || - display_fatal "Failed to clean install" +cd "$GVM_ROOT" if [[ -n $1 ]]; then - cd $GVM_ROOT && git checkout $1 -f || - display_fatal "Failed to checkout $1 branch" + git checkout "$1" -f || display_fatal "Failed to checkout $1 branch" +else + git checkout -f || display_fatal "Failed to clean install" fi -cd $GVM_ROOT && git pull || - display_fatal "Failed to update" - -mv $GVM_ROOT/.git $GVM_ROOT/git.bak || - display_fatal "Couldn't backup git info" +git pull || display_fatal "Failed to update" +mv ".git" "git.bak" || display_fatal "Couldn't backup git info" diff --git a/scripts/gvm-default b/scripts/gvm-default index 5f9c0e0..f77fa65 100644 --- a/scripts/gvm-default +++ b/scripts/gvm-default @@ -7,15 +7,15 @@ unset GOBIN unset gvm_go_name unset gvm_pkgset_name -mkdir -p $GVM_ROOT/logs > /dev/null 2>&1 -mkdir -p $GVM_ROOT/gos > /dev/null 2>&1 -mkdir -p $GVM_ROOT/archive > /dev/null 2>&1 -mkdir -p $GVM_ROOT/archive/package > /dev/null 2>&1 -mkdir -p $GVM_ROOT/environments > /dev/null 2>&1 +mkdir -p "$GVM_ROOT/logs" > /dev/null 2>&1 +mkdir -p "$GVM_ROOT/gos" > /dev/null 2>&1 +mkdir -p "$GVM_ROOT/archive" > /dev/null 2>&1 +mkdir -p "$GVM_ROOT/archive/package" > /dev/null 2>&1 +mkdir -p "$GVM_ROOT/environments" > /dev/null 2>&1 -export GVM_VERSION=`cat $GVM_ROOT/VERSION` +export GVM_VERSION=$(cat "$GVM_ROOT/VERSION") export PATH="$GVM_ROOT/bin:$PATH" export GVM_PATH_BACKUP="$PATH" -[ -f $GVM_ROOT/environments/default ] && . $GVM_ROOT/environments/default -. $GVM_ROOT/scripts/env/gvm +[ -f "$GVM_ROOT/environments/default" ] && . "$GVM_ROOT/environments/default" +. "$GVM_ROOT/scripts/env/gvm" diff --git a/scripts/install b/scripts/install index 2b8a9f6..a9cc18e 100755 --- a/scripts/install +++ b/scripts/install @@ -1,5 +1,5 @@ #!/usr/bin/env bash -. $GVM_ROOT/scripts/functions +. "$GVM_ROOT/scripts/functions" function show_usage() { echo "Usage: gvm install [version] [options]" @@ -20,13 +20,13 @@ read_command_line() { exit 1 fi GO_SOURCE_URL=https://go.googlecode.com/hg/ - for i in $*; do + for i in "$@"; do case $i in -s=*|--source=*) - GO_SOURCE_URL=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` + GO_SOURCE_URL=$(echo "$i" | sed 's/[-a-zA-Z0-9]*=//') ;; -n=*|--name=*) - GO_NAME=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` + GO_NAME=$(echo "$i" | sed 's/[-a-zA-Z0-9]*=//') ;; -pb|--with-protobuf) INSTALL_PB="true" @@ -51,22 +51,22 @@ download_source() { GO_CACHE_PATH=$GVM_ROOT/archive/go [[ -d $GO_CACHE_PATH ]] && return display_message "Downloading Go source..." - hg clone $GO_SOURCE_URL $GO_CACHE_PATH >> $GVM_ROOT/logs/go-download.log 2>&1 || + hg clone "$GO_SOURCE_URL" "$GO_CACHE_PATH" >> "$GVM_ROOT/logs/go-download.log" 2>&1 || display_fatal "Couldn't download Go source\nCheck the logs $GVM_ROOT/logs/go-download.log" } check_tag() { - version=`hg tags -R $GO_CACHE_PATH | awk '{print $1}' | $SORT_PATH | $GREP_PATH "$VERSION" | $HEAD_PATH -n 1 | $GREP_PATH -w "$VERSION"` + version=$(hg tags -R "$GO_CACHE_PATH" | awk '{print $1}' | $SORT_PATH | $GREP_PATH "$VERSION" | $HEAD_PATH -n 1 | $GREP_PATH -w "$VERSION") } update_source() { display_message "Updating Go source..." - hg pull -R $GO_CACHE_PATH >> $GVM_ROOT/logs/go-download.log 2>&1 || + hg pull -R "$GO_CACHE_PATH" >> "$GVM_ROOT/logs/go-download.log" 2>&1 || display_fatal "Couldn't get latest Go version info\nCheck the logs $GVM_ROOT/logs/go-download.log" } copy_source() { - hg clone -u $version $GO_CACHE_PATH $GO_INSTALL_ROOT >> $GVM_ROOT/logs/go-$GO_NAME-install.log 2>&1 || + hg clone -u "$version" "$GO_CACHE_PATH" "$GO_INSTALL_ROOT" >> "$GVM_ROOT/logs/go-$GO_NAME-install.log" 2>&1 || display_fatal "Couldn't copy source to target folder,\nCheck the logs $GVM_ROOT/logs/go-$GO_NAME-install.log" } @@ -78,24 +78,24 @@ compile_go() { export PATH=$GOBIN:$PATH && export GOROOT=$GO_INSTALL_ROOT && #cd $GO_INSTALL_ROOT/src && ./all.bash &> $GVM_ROOT/logs/go-$GO_NAME-compile.log || - cd $GO_INSTALL_ROOT/src && ./make.bash &> $GVM_ROOT/logs/go-$GO_NAME-compile.log || - (rm -rf $GO_INSTALL_ROOT && display_fatal "Failed to compile\nCheck the logs at $GVM_ROOT/logs/go-$GO_NAME-compile.log") + cd "$GO_INSTALL_ROOT/src" && ./make.bash &> "$GVM_ROOT/logs/go-$GO_NAME-compile.log" || + (rm -rf "$GO_INSTALL_ROOT" && display_fatal "Failed to compile\nCheck the logs at $GVM_ROOT/logs/go-$GO_NAME-compile.log") } create_enviroment() { new_env_file=$GVM_ROOT/environments/$GO_NAME - echo "export GVM_ROOT; GVM_ROOT=\"$GVM_ROOT\"" > $new_env_file - echo "export gvm_go_name; gvm_go_name=\"$GO_NAME\"" >> $new_env_file - echo "export gvm_pkgset_name; gvm_pkgset_name=\"global\"" >> $new_env_file - echo "export GOROOT; GOROOT=\"\$GVM_ROOT/gos/$GO_NAME\"" >> $new_env_file - echo "export GOPATH; GOPATH=\"\$GVM_ROOT/pkgsets/$GO_NAME/global\"" >> $new_env_file - echo "export GVM_OVERLAY_PREFIX; GVM_OVERLAY_PREFIX=\"\${GVM_ROOT}/pkgsets/${GO_NAME}/global/overlay\"" >> $new_env_file - echo "export PATH; PATH=\"\${GVM_ROOT}/pkgsets/${GO_NAME}/global/bin:\${GVM_ROOT}/gos/${GO_NAME}/bin:\${GVM_OVERLAY_PREFIX}/bin:\${GVM_ROOT}/bin:\${PATH}\"" >> $new_env_file - echo "export LD_LIBRARY_PATH; LD_LIBRARY_PATH=\"\${GVM_OVERLAY_PREFIX}/lib:\${LD_LIBRARY_PATH}\"" >> $new_env_file - echo "export DYLD_LIBRARY_PATH; DYLD_LIBRARY_PATH=\"\${GVM_OVERLAY_PREFIX}/lib:\${DYLD_LIBRARY_PATH}\"" >> $new_env_file - echo "export PKG_CONFIG_PATH; PKG_CONFIG_PATH=\"\${GVM_OVERLAY_PREFIX}/lib/pkgconfig:\${PKG_CONFIG_PATH}\"" >> $new_env_file - . $GVM_ROOT/scripts/env/use - gvm_use $GO_NAME &> /dev/null || + echo "export GVM_ROOT; GVM_ROOT=\"$GVM_ROOT\"" > "$new_env_file" + echo "export gvm_go_name; gvm_go_name=\"$GO_NAME\"" >> "$new_env_file" + echo "export gvm_pkgset_name; gvm_pkgset_name=\"global\"" >> "$new_env_file" + echo "export GOROOT; GOROOT=\"\$GVM_ROOT/gos/$GO_NAME\"" >> "$new_env_file" + echo "export GOPATH; GOPATH=\"\$GVM_ROOT/pkgsets/$GO_NAME/global\"" >> "$new_env_file" + echo "export GVM_OVERLAY_PREFIX; GVM_OVERLAY_PREFIX=\"\${GVM_ROOT}/pkgsets/${GO_NAME}/global/overlay\"" >> "$new_env_file" + echo "export PATH; PATH=\"\${GVM_ROOT}/pkgsets/${GO_NAME}/global/bin:\${GVM_ROOT}/gos/${GO_NAME}/bin:\${GVM_OVERLAY_PREFIX}/bin:\${GVM_ROOT}/bin:\${PATH}\"" >> "$new_env_file" + echo "export LD_LIBRARY_PATH; LD_LIBRARY_PATH=\"\${GVM_OVERLAY_PREFIX}/lib:\${LD_LIBRARY_PATH}\"" >> "$new_env_file" + echo "export DYLD_LIBRARY_PATH; DYLD_LIBRARY_PATH=\"\${GVM_OVERLAY_PREFIX}/lib:\${DYLD_LIBRARY_PATH}\"" >> "$new_env_file" + echo "export PKG_CONFIG_PATH; PKG_CONFIG_PATH=\"\${GVM_OVERLAY_PREFIX}/lib/pkgconfig:\${PKG_CONFIG_PATH}\"" >> "$new_env_file" + . "$GVM_ROOT/scripts/env/use" + gvm_use "$GO_NAME" &> /dev/null || display_fatal "Failed to use installed version" gvm pkgset create global unset GOPATH @@ -112,7 +112,7 @@ install_go() { exit 0 fi display_warning "Removing corrupt install..." - gvm uninstall $GO_NAME + gvm uninstall "$GO_NAME" fi if [[ "$version" != "$GO_NAME" ]]; then @@ -122,7 +122,7 @@ install_go() { fi # Create the global package set folder - mkdir -p $GVM_ROOT/pkgsets/$GO_NAME >> $GVM_ROOT/logs/go-$GO_NAME-install.log 2>&1 || + mkdir -p "$GVM_ROOT/pkgsets/$GO_NAME" >> "$GVM_ROOT/logs/go-$GO_NAME-install.log" 2>&1 || display_fatal "Couldn't create global package set folder\nCheck the logs at ${GVM_ROOT}/logs/go-${GO_NAME}-install.log" GVM_OVERLAY_ROOT="${GVM_ROOT}/pkgsets/${GO_NAME}/global/overlay" mkdir -p "${GVM_OVERLAY_ROOT}/lib/pkgconfig" >> "${GVM_ROOT}/logs/go-${GO_NAME}-install.log" 2>&1 || @@ -136,12 +136,12 @@ install_go() { install_gpkg() { display_message " * Installing gpkg..." - $GVM_GOINSTALL github.com/moovweb/gpkg > $GVM_ROOT/logs/$GO_NAME-gpkg.log 2>&1 || return 1 + $GVM_GOINSTALL github.com/moovweb/gpkg > "$GVM_ROOT/logs/$GO_NAME-gpkg.log" 2>&1 || return 1 } install_gb() { display_message " * Installing gb..." - $GVM_GOINSTALL github.com/jbussdieker/go-gb/gb > $GVM_ROOT/logs/$GO_NAME-gb.log 2>&1 || return 1 + $GVM_GOINSTALL github.com/jbussdieker/go-gb/gb > "$GVM_ROOT/logs/$GO_NAME-gb.log" 2>&1 || return 1 } install_goprotobuf() { @@ -152,24 +152,24 @@ install_goprotobuf() { " display_message " * Installing goprotobuf..." if [[ "$GVM_GOINSTALL" == "goinstall" ]]; then - $GVM_GOINSTALL goprotobuf.googlecode.com/hg/proto > $GVM_ROOT/logs/$GO_NAME-pb-compiler.log 2>&1 + $GVM_GOINSTALL goprotobuf.googlecode.com/hg/proto > "$GVM_ROOT/logs/$GO_NAME-pb-compiler.log" 2>&1 if [[ $? -ne 0 ]]; then display_warning "Failed to install goprotobuf\nCheck the logs at $GVM_ROOT/logs/$GO_NAME-pb-compiler.log" return 1 fi - cd $GVM_ROOT/gos/$GO_NAME/src/pkg/goprotobuf.googlecode.com/hg/compiler - make install >> $GVM_ROOT/logs/$GO_NAME-pb-compiler.log 2>&1 + cd "$GVM_ROOT/gos/$GO_NAME/src/pkg/goprotobuf.googlecode.com/hg/compiler" + make install >> "$GVM_ROOT/logs/$GO_NAME-pb-compiler.log" 2>&1 if [[ $? -ne 0 ]]; then display_warning "Failed to install goprotobuf compiler\nCheck the logs at $GVM_ROOT/logs/$GO_NAME-pb-compiler.log" return 1 fi else - $GVM_GOINSTALL code.google.com/p/goprotobuf/proto > $GVM_ROOT/logs/$GO_NAME-pb-compiler.log 2>&1 + $GVM_GOINSTALL code.google.com/p/goprotobuf/proto > "$GVM_ROOT/logs/$GO_NAME-pb-compiler.log" 2>&1 if [[ $? -ne 0 ]]; then display_warning "Failed to install goprotobuf\nCheck the logs at $GVM_ROOT/logs/$GO_NAME-pb-compiler.log" return 1 fi - $GVM_GOINSTALL code.google.com/p/goprotobuf/protoc-gen-go > $GVM_ROOT/logs/$GO_NAME-pb-compiler.log 2>&1 + $GVM_GOINSTALL code.google.com/p/goprotobuf/protoc-gen-go > "$GVM_ROOT/logs/$GO_NAME-pb-compiler.log" 2>&1 if [[ $? -ne 0 ]]; then display_warning "Failed to install goprotobuf compiler\nCheck the logs at $GVM_ROOT/logs/$GO_NAME-pb-compiler.log" return 1 @@ -179,7 +179,7 @@ install_goprotobuf() { main() { trap 'display_fatal "Canceled!"' INT - read_command_line $@ + read_command_line "$@" [[ "$VERSION" == "" ]] && display_fatal "No version specified" download_source check_tag @@ -196,7 +196,7 @@ main() { which goinstall &> /dev/null || GVM_GOINSTALL="go get" - x="`hg tags -R $GO_CACHE_PATH`"; echo ${x#*b0819469a6df} | $GREP_PATH "$version " &> /dev/null + x="$(hg tags -R "$GO_CACHE_PATH")"; echo "${x#*b0819469a6df}" | $GREP_PATH "$version " &> /dev/null if [[ "$?" == "1" ]]; then if [[ "$INSTALL_BUILD_TOOLS" == "true" ]]; then install_gb || display_warning "Failed to install gb" @@ -207,7 +207,7 @@ main() { fi fi - cd $GO_INSTALL_ROOT && find . > manifest + cd "$GO_INSTALL_ROOT" && find . > manifest } -main $@ +main "$@" diff --git a/scripts/linkthis b/scripts/linkthis index 3dfaf4e..643b130 100755 --- a/scripts/linkthis +++ b/scripts/linkthis @@ -1,5 +1,5 @@ #!/usr/bin/env bash -. $GVM_ROOT/scripts/functions +. "$GVM_ROOT/scripts/functions" function show_usage() { echo "Usage: gvm linkthis [package-name] [options]" @@ -15,7 +15,7 @@ function show_usage() { } function read_command_line() { - for i in $*; do + for i in "$@"; do case $i in -h|--help*) show_usage diff --git a/scripts/list b/scripts/list index 210380a..670f0e3 100755 --- a/scripts/list +++ b/scripts/list @@ -1,14 +1,14 @@ #!/usr/bin/env bash -. $GVM_ROOT/scripts/functions +. "$GVM_ROOT/scripts/functions" echo display_message "gvm gos (installed)" echo if [[ -d $GVM_ROOT/gos ]]; then if [[ "$gvm_go_name" != "" ]]; then - $LS_PATH -1 $GVM_ROOT/gos | sed 's/^/ /g' | sed 's/^ '$gvm_go_name\$'/=> '$gvm_go_name'/g' + $LS_PATH -1 "$GVM_ROOT/gos" | sed 's/^/ /g' | sed 's/^ '$gvm_go_name\$'/=> '$gvm_go_name'/g' else - $LS_PATH -1 $GVM_ROOT/gos | sed 's/^/ /g' + $LS_PATH -1 "$GVM_ROOT/gos" | sed 's/^/ /g' fi fi echo diff --git a/scripts/listall b/scripts/listall index c2f41f2..5a8c94d 100755 --- a/scripts/listall +++ b/scripts/listall @@ -1,5 +1,5 @@ #!/usr/bin/env bash -. $GVM_ROOT/scripts/functions +. "$GVM_ROOT/scripts/functions" function show_usage() { echo "Usage: gvm listall [options]" @@ -9,7 +9,7 @@ function show_usage() { function read_command_line() { tag_filter="release" - for i in $*; do + for i in "$@"; do case $i in -a|--all) tag_filter="" @@ -27,12 +27,12 @@ function read_command_line() { done } -read_command_line $@ +read_command_line "$@" echo display_message "gvm gos (available)" echo -versions=`curl -s https://go.googlecode.com/hg/.hgtags | awk '{ print $2 }' | $SORT_PATH` +versions=$(curl -s https://go.googlecode.com/hg/.hgtags | awk '{ print $2 }' | $SORT_PATH) if [[ $? -ne 0 ]]; then display_fatal "Failed to get version list from Google" fi diff --git a/scripts/pkgset b/scripts/pkgset index 0cc2262..6f97235 100755 --- a/scripts/pkgset +++ b/scripts/pkgset @@ -1,5 +1,5 @@ #!/usr/bin/env bash -. $GVM_ROOT/scripts/functions +. "$GVM_ROOT/scripts/functions" [[ $gvm_go_name != "" ]] || display_fatal "No Go version selected" @@ -11,7 +11,7 @@ command=$1 if [[ -f $GVM_ROOT/scripts/pkgset-$command ]]; then shift - $GVM_ROOT/scripts/pkgset-$command $@ + "$GVM_ROOT/scripts/pkgset-$command" "$@" elif [[ -n $command ]]; then display_fatal "Unrecognized command line argument: '$command'" else diff --git a/scripts/pkgset-create b/scripts/pkgset-create index 36c3857..b2c8025 100755 --- a/scripts/pkgset-create +++ b/scripts/pkgset-create @@ -1,5 +1,5 @@ #!/usr/bin/env bash -. $GVM_ROOT/scripts/functions +. "$GVM_ROOT/scripts/functions" [[ $1 != "" ]] || display_fatal "Please specifiy the name" @@ -27,17 +27,17 @@ fi [[ ! -f "$target_top/environments/$gvm_go_name@$target_set_name" ]] || display_fatal "Packageset already exists!" -mkdir -p $target_top/environments || +mkdir -p "$target_top/environments" || display_fatal "Could not create environments folder" -mkdir -p $target_top/pkgsets/$gvm_go_name/$target_set_name || +mkdir -p "$target_top/pkgsets/$gvm_go_name/$target_set_name" || display_fatal "Could not create packageset folder" -cp $GVM_ROOT/environments/$gvm_go_name $target_top/environments/$gvm_go_name@$target_set_name || +cp "$GVM_ROOT/environments/$gvm_go_name" "$target_top/environments/$gvm_go_name@$target_set_name" || display_fatal "Could copy environment" -echo "export gvm_pkgset_name=\"$target_set_name_str\"" >> $target_top/environments/$gvm_go_name@$target_set_name || +echo "export gvm_pkgset_name=\"$target_set_name_str\"" >> "$target_top/environments/$gvm_go_name@$target_set_name" || display_fatal "Could not extend environment" -echo "export GOPATH; GOPATH=\"$add_gopath:\$GOPATH\"" >> $target_top/environments/$gvm_go_name@$target_set_name || +echo "export GOPATH; GOPATH=\"$add_gopath:\$GOPATH\"" >> "$target_top/environments/$gvm_go_name@$target_set_name" || display_fatal "Could not extend environment" -echo "export PATH; PATH=\"$add_path:\$PATH\"" >> $target_top/environments/$gvm_go_name@$target_set_name || +echo "export PATH; PATH=\"$add_path:\$PATH\"" >> "$target_top/environments/$gvm_go_name@$target_set_name" || display_fatal "Could not extend environment" if [ "${target_set_name}" != "global" ]; then diff --git a/scripts/pkgset-delete b/scripts/pkgset-delete index 8021579..1937282 100755 --- a/scripts/pkgset-delete +++ b/scripts/pkgset-delete @@ -1,5 +1,5 @@ #!/usr/bin/env bash -. $GVM_ROOT/scripts/functions +. "$GVM_ROOT/scripts/functions" [[ $gvm_go_name != "" ]] || display_fatal "No Go version selected" @@ -17,9 +17,9 @@ fi [[ -d $target_top/pkgsets/$gvm_go_name/$target_set_name ]] || display_fatal "Packageset doesn't exist!" -rm -rf $target_top/pkgsets/$gvm_go_name/$target_set_name || +rm -rf "$target_top/pkgsets/$gvm_go_name/$target_set_name" || display_fatal "Could not delete package set" -rm -rf $target_top/environments/$gvm_go_name@$target_set_name || +rm -rf "$target_top/environments/$gvm_go_name@$target_set_name" || display_fatal "Could not delete package set" diff --git a/scripts/pkgset-empty b/scripts/pkgset-empty index a942bb5..073839d 100755 --- a/scripts/pkgset-empty +++ b/scripts/pkgset-empty @@ -1,8 +1,8 @@ #!/usr/bin/env bash -. $GVM_ROOT/scripts/functions +. "$GVM_ROOT/scripts/functions" [[ $gvm_pkgset_name != "" ]] || display_fatal "No Package set selected" -rm -rf $GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/* || +rm -rf "$GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/"* || display_fatal "Could not delete package set files" diff --git a/scripts/pkgset-list b/scripts/pkgset-list index e189f31..918d97f 100755 --- a/scripts/pkgset-list +++ b/scripts/pkgset-list @@ -1,5 +1,5 @@ #!/usr/bin/env bash -. $GVM_ROOT/scripts/functions +. "$GVM_ROOT/scripts/functions" echo display_message "gvm go package sets ($gvm_go_name)" @@ -17,7 +17,7 @@ if [[ -d $GVM_ROOT/pkgsets/$gvm_go_name ]]; then for cur_dir in $GVM_ROOT/pkgsets/$gvm_go_name/*; do [[ "$cur_dir" == "$GVM_ROOT/pkgsets/$gvm_go_name/*" ]] && exit - pkgset=`basename $cur_dir` + pkgset=$(basename "$cur_dir") if [[ "$gvm_pkgset_name" == "$pkgset" ]]; then echo "=> $pkgset" else diff --git a/scripts/templates/binary b/scripts/templates/binary index 80fef9f..d6ba181 100644 --- a/scripts/templates/binary +++ b/scripts/templates/binary @@ -1,15 +1,15 @@ #!/usr/bin/env bash -. $GVM_ROOT/scripts/functions/tools -echo $1 | sed -n -e '/_.*_/ p' | $GREP_PATH "_" &> /dev/null +. "$GVM_ROOT/scripts/functions/tools" +echo "$1" | sed -n -e '/_.*_/ p' | $GREP_PATH "_" &> /dev/null if [ "$?" == "0" ]; then - version=`echo $1 | sed 's/_\(.*\)_/\1/'` + version=$(echo $1 | sed 's/_\(.*\)_/\1/') if [[ ! -f $GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/pkg.gvm/{{package_name}}/$version/bin/{{binary_name}} ]]; then echo "GVM: Invalid version" exit 1 fi shift - $GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/pkg.gvm/{{package_name}}/$version/bin/{{binary_name}} $@ + "$GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/pkg.gvm/{{package_name}}/$version/bin/{{binary_name}}" "$@" else - $GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/pkg.gvm/{{package_name}}/current/bin/{{binary_name}} $@ + "$GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/pkg.gvm/{{package_name}}/current/bin/{{binary_name}}" "$@" fi diff --git a/scripts/uninstall b/scripts/uninstall index c4cfebe..587b008 100755 --- a/scripts/uninstall +++ b/scripts/uninstall @@ -1,20 +1,20 @@ #!/usr/bin/env bash -. $GVM_ROOT/scripts/functions +. "$GVM_ROOT/scripts/functions" [[ "$1" == "" ]] && display_fatal "Please specifiy the version" -fuzzy_match=`$LS_PATH $GVM_ROOT/gos | $SORT_PATH | $GREP_PATH "$1" | $HEAD_PATH -n 1 | $GREP_PATH "$1"` || +fuzzy_match=$($LS_PATH "$GVM_ROOT/gos" | $SORT_PATH | $GREP_PATH "$1" | $HEAD_PATH -n 1 | $GREP_PATH "$1") || display_fatal "Invalid version $1" if [[ -d $GVM_ROOT/gos/$fuzzy_match ]]; then - rm -rf $GVM_ROOT/pkgsets/$fuzzy_match &> /dev/null || + rm -rf "$GVM_ROOT/pkgsets/$fuzzy_match" &> /dev/null || display_fatal "Couldn't remove pkgsets" - rm -f $GVM_ROOT/environments/$fuzzy_match &> /dev/null || + rm -f "$GVM_ROOT/environments/$fuzzy_match" &> /dev/null || display_fatal "Couldn't remove environment files" rm -f "$GVM_ROOT/environments/$fuzzy_match@"* &> /dev/null || display_fatal "Couldn't remove pkgset environment files" - rm -rf $GVM_ROOT/gos/$fuzzy_match &> /dev/null || + rm -rf "$GVM_ROOT/gos/$fuzzy_match" &> /dev/null || display_fatal "Couldn't remove Go folder" display_message "Uninstalled version $fuzzy_match" else diff --git a/scripts/update b/scripts/update index 9952029..f32d2d3 100755 --- a/scripts/update +++ b/scripts/update @@ -1,9 +1,8 @@ #!/usr/bin/env bash -. $GVM_ROOT/scripts/functions +. "$GVM_ROOT/scripts/functions" -cd $GVM_ROOT/archive/go &> /dev/null || +cd "$GVM_ROOT/archive/go" &> /dev/null || display_fatal "Failed to find local Go source" -cd $GVM_ROOT/archive/go && hg pull || - display_fatal "Failed to update" +hg pull || display_fatal "Failed to update" From b38be0c606e17eb906a348c8eaa29e17f8b7698c Mon Sep 17 00:00:00 2001 From: Ali Abbas Date: Sat, 12 Apr 2014 12:19:27 +0200 Subject: [PATCH 2/3] use GREP_PATH variable instead --- scripts/alias-list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/alias-list b/scripts/alias-list index 6054c1a..4db4527 100755 --- a/scripts/alias-list +++ b/scripts/alias-list @@ -5,7 +5,7 @@ echo display_message "gvm go aliases" echo -for a in $(cd "$GVM_ROOT/environments" ; grep -l "gvm_alias_name" ./*); do +for a in $(cd "$GVM_ROOT/environments" ; $GREP_PATH -l "gvm_alias_name" ./*); do t=$(sh -c ". $GVM_ROOT/environments/$a ; echo \$gvm_go_name") echo " $a ($t)" done From e27f83653f5b24fce1b60def83a01af3938bc4d2 Mon Sep 17 00:00:00 2001 From: Ali Abbas Date: Sat, 12 Apr 2014 12:49:28 +0200 Subject: [PATCH 3/3] - implode function + confirmation prompt when invoking gvm implode - test case --- bin/gvm | 2 +- scripts/env/gvm | 3 ++- scripts/env/implode | 11 +++++++++++ scripts/install | 1 + tests/zzgvm_implode_comment_test.sh | 3 +++ 5 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 scripts/env/implode create mode 100644 tests/zzgvm_implode_comment_test.sh diff --git a/bin/gvm b/bin/gvm index f55682a..9957ea8 100755 --- a/bin/gvm +++ b/bin/gvm @@ -15,7 +15,7 @@ fi command=$1 if [[ $command == "implode" ]]; then - rm -rf "$GVM_ROOT" + gvm_implode exit 0 fi diff --git a/scripts/env/gvm b/scripts/env/gvm index 0a6702f..879d119 100644 --- a/scripts/env/gvm +++ b/scripts/env/gvm @@ -26,7 +26,8 @@ function gvm() { shift gvm_use "$@" elif [[ "$1" == "implode" ]]; then - rm -rf "$GVM_ROOT" + . "$GVM_ROOT/scripts/env/implode" + gvm_implode elif [[ "$1" == "pkgset" ]] && [[ "$2" == "use" ]]; then . "$GVM_ROOT/scripts/env/pkgset-use" shift diff --git a/scripts/env/implode b/scripts/env/implode new file mode 100644 index 0000000..1125157 --- /dev/null +++ b/scripts/env/implode @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +function gvm_implode() { + read -p "Are you sure? [Y/n] " -n 1 -r + echo + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + display_message "Action cancelled" + else + (rm -rf "$GVM_ROOT" && display_message "GVM successfully removed") || display_error "Failed to uninstall gvm" + fi +} diff --git a/scripts/install b/scripts/install index a9cc18e..5bf54ef 100755 --- a/scripts/install +++ b/scripts/install @@ -95,6 +95,7 @@ create_enviroment() { echo "export DYLD_LIBRARY_PATH; DYLD_LIBRARY_PATH=\"\${GVM_OVERLAY_PREFIX}/lib:\${DYLD_LIBRARY_PATH}\"" >> "$new_env_file" echo "export PKG_CONFIG_PATH; PKG_CONFIG_PATH=\"\${GVM_OVERLAY_PREFIX}/lib/pkgconfig:\${PKG_CONFIG_PATH}\"" >> "$new_env_file" . "$GVM_ROOT/scripts/env/use" + . "$GVM_ROOT/scripts/env/implode" gvm_use "$GO_NAME" &> /dev/null || display_fatal "Failed to use installed version" gvm pkgset create global diff --git a/tests/zzgvm_implode_comment_test.sh b/tests/zzgvm_implode_comment_test.sh new file mode 100644 index 0000000..6324ccf --- /dev/null +++ b/tests/zzgvm_implode_comment_test.sh @@ -0,0 +1,3 @@ +source $GVM_ROOT/scripts/gvm +yes n | gvm implode # status=0; match=/Action cancelled/ +yes | gvm implode # status=0; match=/GVM successfully removed/