mirror of
https://github.com/safing/portmaster
synced 2025-09-02 02:29:12 +00:00
Merge pull request #80 from safing/fix/pmctl-download
Fix downloading of assets in pmctl
This commit is contained in:
commit
dc35964d8b
2 changed files with 17 additions and 16 deletions
|
@ -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()
|
||||
}
|
||||
|
|
14
pmctl/run.go
14
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
|
||||
|
|
Loading…
Add table
Reference in a new issue