diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f891af0..164b291 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -137,7 +137,7 @@ jobs: path: ${{ github.workspace }}/publish - name: Get Commits since last Release - id: changes + id: changelog uses: simbo/changes-since-last-release-action@v1 with: line-prefix: "* " @@ -152,5 +152,5 @@ jobs: tag: "${{ needs.build.outputs.bump_tag }}" token: ${{ secrets.GITHUB_TOKEN }} body: | - Changes since ${{ steps.changes.outputs.last-tag }}: - ${{ steps.changes.outputs.log }} + Changes since ${{ steps.changelog.outputs.last-tag }}: + ${{ steps.changelog.outputs.log }} diff --git a/cmd/init_linux.go b/cmd/init_linux.go index 2dca09b..2f40145 100644 --- a/cmd/init_linux.go +++ b/cmd/init_linux.go @@ -7,6 +7,7 @@ import ( "os" "os/exec" "strings" + "time" "github.com/spf13/cobra" ) @@ -54,18 +55,34 @@ func CheckRequirement() { } fmt.Println("Update apt repositories, please wait...") - err = exec.Command("sudo", "apt-get", "update").Run() - if err != nil { - Logger.Fatalln("Failed to update repositories: ", err) + doneProcess := false + for !doneProcess { + err = exec.Command("sudo", "apt-get", "update").Run() + if err != nil { + if !strings.Contains(err.Error(), "exit status 100") { + doneProcess = true + Logger.Fatalln("Failed to update repositories: ", err) + } + Logger.Println("Update repositories: ", err) + time.Sleep(500 * time.Millisecond) + } } fmt.Println("Installing dependencies, please wait...") - cmdAptInstall := []string{"apt-get", "install", "-y"} + cmdAptInstall := []string{"apt-get", "install", "-y", "--no-install-recommends"} cmdAptInstall = utils.PrependCommand(notInstalledDeps, cmdAptInstall) - err = exec.Command("sudo", cmdAptInstall...).Run() - if err != nil { - Logger.Fatalln("Install dependencies: ", err) + doneProcess = false + for !doneProcess { + err = exec.Command("sudo", cmdAptInstall...).Run() + if err != nil { + if !strings.Contains(err.Error(), "exit status 100") { + doneProcess = true + Logger.Fatalln("Failed to install dependencies: ", err) + } + Logger.Println("Install dependencies: ", err) + time.Sleep(500 * time.Millisecond) + } } fmt.Println("Dependencies installed") diff --git a/utils/helper.go b/utils/helper.go index a55a6a5..8ab2414 100644 --- a/utils/helper.go +++ b/utils/helper.go @@ -128,18 +128,21 @@ addons_path = ./addons, ./odoo/addons`, dbUser, dbPass, dbName) } func PyenvInfoBash() { + rcfile := "~/.bashrc" + if strings.Contains(os.Getenv("SHELL"), "zsh") { + rcfile = "~/.zshrc" + } fmt.Println() - fmt.Println("One more thing you need to do, please add this line to your ~/.bashrc file:") + fmt.Printf("One more thing you need to do, please add this line to your %s file:\n", rcfile) fmt.Println("(Just copy and paste to your terminal line per line)") fmt.Println() - fmt.Println(`echo 'PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc`) - fmt.Println(`echo 'PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc`) - fmt.Println(`echo 'eval "$(pyenv init -)"' >> ~/.bashrc`) - fmt.Println(`echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc`) + fmt.Printf(`echo 'PYENV_ROOT="$HOME/.pyenv"' >> %s\n`, rcfile) + fmt.Printf(`echo 'PATH="$PYENV_ROOT/bin:$PATH"' >> %s\n`, rcfile) + fmt.Printf(`echo 'eval "$(pyenv init -)"' >> %s\n`, rcfile) + fmt.Printf(`echo 'eval "$(pyenv virtualenv-init -)"' >> %s\n`, rcfile) fmt.Println() - fmt.Println("Then run this command to reload your bashrc file") - fmt.Println("source ~/.bashrc") - fmt.Printf("\n\nIf you have zsh as your shell, changes '~/.bashrc' here with '~/.zshrc'\n\n") + fmt.Println("Then run this command to reload your shell") + fmt.Printf("source %s\n", rcfile) } func IsPyenvConfigured() bool { @@ -170,6 +173,8 @@ func ValidateOdooVer(odooVer string) bool { return true case "16.0": return true + case "17.0": + return true default: return false }