Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
update secman initializer and add ~/.secman dir checker
Browse files Browse the repository at this point in the history
  • Loading branch information
abdfnx committed Mar 18, 2022
1 parent 0dc1f4f commit dbeb27a
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions pkg/initx/init.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
package initx

import (
"os"
"fmt"
"log"
"os"
"path/filepath"
"time"
"runtime"
"path/filepath"

"github.com/abdfnx/gosh"
"github.com/spf13/viper"
"github.com/abdfnx/tran/dfs"
gapi "github.com/scmn-dev/get-latest/api"
"github.com/briandowns/spinner"
"github.com/charmbracelet/lipgloss"
"github.com/scmn-dev/secman/constants"
"github.com/spf13/viper"
gapi "github.com/scmn-dev/get-latest/api"
)

func Init() {
var err error

s := spinner.New(spinner.CharSets[11], 100*time.Millisecond)
s.Suffix = " 💿 Initializing..."
s.Start()

homeDir, err := dfs.GetHomeDirectory()

if err != nil {
Expand Down Expand Up @@ -72,7 +79,7 @@ func Init() {
uCmd := fmt.Sprintf(`
if ! [ -d %s/ui ]; then
wget %s
sudo chmod 755 smui.zip
chmod 755 smui.zip
unzip -qq smui.zip
mv ui %s/ui
rm smui.zip
Expand All @@ -90,4 +97,10 @@ func Init() {
`, constants.DotSecmanPath, fmt.Sprintf("\"%s\"", url), constants.DotSecmanPath)

gosh.RunMulti(uCmd, wCmd)

s.Stop()

if _, err := os.Stat(constants.DotSecmanPath); err == nil {
fmt.Println(lipgloss.NewStyle().PaddingLeft(2).SetString(constants.Checkmark + "Initialization Successful!").String())
}
}

0 comments on commit dbeb27a

Please sign in to comment.