From 1cce3f24035d91de1af904dd3e8a06ff05dd2c33 Mon Sep 17 00:00:00 2001 From: abdfnx Date: Fri, 5 Mar 2021 14:07:40 +0300 Subject: [PATCH] fix shell errors, rename test_detect_os.rb -> upg_test.rb --- core/core.go | 12 ++++++------ fetch/fetch.go | 4 +--- go.sum | 1 + plugins/shell | 2 +- upgrade/upg.go | 15 ++------------- upgrade/{test_detect_os.rb => upg_test.rb} | 0 6 files changed, 11 insertions(+), 23 deletions(-) rename upgrade/{test_detect_os.rb => upg_test.rb} (100%) diff --git a/core/core.go b/core/core.go index 53db2346..753b0ed4 100644 --- a/core/core.go +++ b/core/core.go @@ -221,10 +221,6 @@ func init() { RootCmd.AddCommand(verxCmd) } -const clone string = "git clone https://github.com/secman-team/" -const winCmd string = clone + "sm-win ~/sm" -const cmd string = clone + "sm /home/sm" - func loading(text string) { s := spinner.New(spinner.CharSets[35], 100*time.Millisecond) s.Suffix = " " + text @@ -232,6 +228,10 @@ func loading(text string) { s.Stop() } +const clone string = "git clone https://github.com/secman-team/" +const winCmd string = clone + "sm-win ~/sm" +const cmd string = clone + "sm /home/sm" + // main func main() { if runtime.GOOS == "windows" { @@ -241,7 +241,7 @@ func main() { } else { loading("installing windows deps...") - SHCore(cmd, winCmd) + shell.SHCore(cmd, winCmd) RootCmd.Execute() } @@ -253,7 +253,7 @@ func main() { } else { loading("installing linux/macos deps...") - SHCore(cmd, winCmd) + shell.SHCore(cmd, winCmd) RootCmd.Execute() } diff --git a/fetch/fetch.go b/fetch/fetch.go index 07ff0070..c6a1a16d 100644 --- a/fetch/fetch.go +++ b/fetch/fetch.go @@ -1,8 +1,6 @@ package fetch import ( - "fmt" - "os/exec" "time" "github.com/briandowns/spinner" @@ -14,7 +12,7 @@ func FetchSECDIR() { s.Suffix = " Fetching..." s.Start() - SHCore("secman-sync pl", "bash ssc pl") + shell.SHCore("secman-sync pl", "bash ssc pl") s.Stop() } diff --git a/go.sum b/go.sum index b0ba2b0d..1df43d5a 100644 --- a/go.sum +++ b/go.sum @@ -148,6 +148,7 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/secman-team/shell v0.1.0 h1:cTqRgG7Oqhst/s/z/CERg/+ZgSOxE/qK9ctM/B9wHdQ= github.com/secman-team/shell v0.1.0/go.mod h1:+kAfttTSmyjzVbKIksunNkDxJONomZp52cwY/PgCHHs= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= diff --git a/plugins/shell b/plugins/shell index 2a177447..d929c012 160000 --- a/plugins/shell +++ b/plugins/shell @@ -1 +1 @@ -Subproject commit 2a17744710fb8679fcbcae7dcaeb237bfa7048fe +Subproject commit d929c0128cbe110f8a9f558f2e89c7f3244e32c2 diff --git a/upgrade/upg.go b/upgrade/upg.go index c869e180..bc47451f 100644 --- a/upgrade/upg.go +++ b/upgrade/upg.go @@ -1,18 +1,7 @@ package upg -import ( - "fmt" - "os/exec" -) +import "github.com/secman-team/shell" func Upgrade() { - cmd := exec.Command("verx", "--upg") - stdout, err := cmd.Output() - - if err != nil { - fmt.Println(err.Error()) - return - } - - fmt.Print(string(stdout)) + shell.SHCore("verx --upg", "bash vx --upg") } diff --git a/upgrade/test_detect_os.rb b/upgrade/upg_test.rb similarity index 100% rename from upgrade/test_detect_os.rb rename to upgrade/upg_test.rb