Skip to content

Commit

Permalink
Merge pull request #150 from monstermunchkin/fixes/opensuse-leap-42.3…
Browse files Browse the repository at this point in the history
…-support

openSUSE fixes
  • Loading branch information
stgraber committed Mar 6, 2019
2 parents c9f549d + fa10c70 commit 7031511
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
6 changes: 6 additions & 0 deletions distrobuilder/chroot.go
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"
"strings"

lxd "github.com/lxc/lxd/shared"

Expand Down Expand Up @@ -71,6 +72,11 @@ func managePackages(def shared.DefinitionPackages, actions []shared.DefinitionAc
}
}

// TODO: Remove this once openSUSE Tumbleweed builds properly without it.
if strings.ToLower(release) == "tumbleweed" {
manager.SetInstallFlags("install", "--allow-downgrade")
}

err = manager.Install(installablePackages)
if err != nil {
return err
Expand Down
5 changes: 5 additions & 0 deletions managers/manager.go
Expand Up @@ -116,3 +116,8 @@ func (m Manager) Update() error {

return shared.RunCommand(m.command, args...)
}

// SetInstallFlags overrides the default install flags.
func (m *Manager) SetInstallFlags(flags ...string) {
m.flags.install = flags
}
1 change: 0 additions & 1 deletion managers/zypper.go
Expand Up @@ -15,7 +15,6 @@ func NewZypper() *Manager {
},
install: []string{
"install",
"--allow-downgrade",
},
remove: []string{
"remove",
Expand Down
21 changes: 13 additions & 8 deletions sources/opensuse-http.go
Expand Up @@ -131,15 +131,20 @@ func (s *OpenSUSEHTTP) getPathToTarball(baseURL string, release string, arch str
} else {
u.Path = path.Join(u.Path, fmt.Sprintf("openSUSE-Leap-%s", release))

switch arch {
case "x86_64":
u.Path = path.Join(u.Path, "containers")
case "aarch64", "ppc64le":
u.Path = path.Join(u.Path, "containers_ports")
if release == "42.3" {
u.Path = path.Join(u.Path, "containers",
fmt.Sprintf("openSUSE-Leap-%s-container-image.%s-lxc.tar.xz", release, arch))
} else {
switch arch {
case "x86_64":
u.Path = path.Join(u.Path, "containers")
case "aarch64", "ppc64le":
u.Path = path.Join(u.Path, "containers_ports")
}

u.Path = path.Join(u.Path, fmt.Sprintf("opensuse-leap-image.%s-lxc.tar.xz",
arch))
}

u.Path = path.Join(u.Path, fmt.Sprintf("opensuse-leap-image.%s-lxc.tar.xz",
arch))
}

return u.String()
Expand Down

0 comments on commit 7031511

Please sign in to comment.