Skip to content

Commit

Permalink
feat: assume remote is flathub if not flatpak remote is set
Browse files Browse the repository at this point in the history
  • Loading branch information
femnad committed Jun 14, 2024
1 parent 58da75e commit a7f0372
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions provision/flatpak.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
)

const (
defaultRemote = "flathub"
flatpakExec = "flatpak"
launcherScript = `#!/usr/bin/env bash
flatpak run %s
Expand Down Expand Up @@ -46,6 +47,17 @@ func findRequiredRemote(pkg entity.FlatpakPkg, remotes []entity.FlatpakRemote) (
}

func ensurePkgRemote(pkg entity.FlatpakPkg, remotes []entity.FlatpakRemote) error {
if pkg.Remote == "" {
for _, remote := range remotes {
if remote.Name != defaultRemote {
continue
}
return ensureRemote(remote)
}

return fmt.Errorf("unable to determine remote for %s", pkg.Name)
}

remote, err := findRequiredRemote(pkg, remotes)
if err != nil {
return err
Expand Down

0 comments on commit a7f0372

Please sign in to comment.