diff --git a/pmctl/main.go b/pmctl/main.go index 0252a799..01644c31 100644 --- a/pmctl/main.go +++ b/pmctl/main.go @@ -35,7 +35,7 @@ var ( }, Beta: false, DevMode: false, - Online: false, + Online: true, // is disabled later based on command } rootCmd = &cobra.Command{ @@ -182,17 +182,12 @@ func cmdSetup(cmd *cobra.Command, args []string) (err error) { Beta: false, }) - registry.AddIndex(updater.Index{ - Path: "beta.json", - Stable: false, - Beta: true, - }) - - registry.AddIndex(updater.Index{ - Path: "all/intel/intel.json", - Stable: true, - Beta: false, - }) + // TODO: enable loading beta versions + // registry.AddIndex(updater.Index{ + // Path: "beta.json", + // Stable: false, + // Beta: true, + // }) updateRegistryIndex() } diff --git a/pmctl/run.go b/pmctl/run.go index c1cad7f8..eb5fc367 100644 --- a/pmctl/run.go +++ b/pmctl/run.go @@ -104,12 +104,10 @@ func handleRun(cmd *cobra.Command, opts *Options) (err error) { return } -func run(cmd *cobra.Command, opts *Options) (err error) { +func run(cmd *cobra.Command, opts *Options) (err error) { //nolint:gocognit // set download option - if opts.AllowDownload { - registry.Online = true - } + registry.Online = opts.AllowDownload // parse identifier opts.ShortIdentifier = path.Dir(opts.Identifier) @@ -187,8 +185,16 @@ func run(cmd *cobra.Command, opts *Options) (err error) { log.Println("error seems to be permanent, giving up...") return err } + // resilience + time.Sleep(time.Duration(tries) * 2 * time.Second) + if tries >= 2 { + // try updating + updateRegistryIndex() + } log.Println("trying again...") case tryAgain && err == nil: + // reset error count + tries = 0 // upgrade log.Println("restarting by request...") // update index