Merge pull request #7618 from hashicorp/build_on_solaris
allow building packer on solaris by removing progress bar and tty imports on solaris
This commit is contained in:
commit
c28ab292a4
|
@ -57,4 +57,4 @@ workflows:
|
||||||
- build_windows
|
- build_windows
|
||||||
- build_freebsd
|
- build_freebsd
|
||||||
- build_openbsd
|
- build_openbsd
|
||||||
|
- build_solaris
|
||||||
|
|
3
main.go
3
main.go
|
@ -22,7 +22,6 @@ import (
|
||||||
"github.com/hashicorp/packer/packer/plugin"
|
"github.com/hashicorp/packer/packer/plugin"
|
||||||
"github.com/hashicorp/packer/packer/tmp"
|
"github.com/hashicorp/packer/packer/tmp"
|
||||||
"github.com/hashicorp/packer/version"
|
"github.com/hashicorp/packer/version"
|
||||||
"github.com/mattn/go-tty"
|
|
||||||
"github.com/mitchellh/cli"
|
"github.com/mitchellh/cli"
|
||||||
"github.com/mitchellh/panicwrap"
|
"github.com/mitchellh/panicwrap"
|
||||||
"github.com/mitchellh/prefixedio"
|
"github.com/mitchellh/prefixedio"
|
||||||
|
@ -193,7 +192,7 @@ func wrappedMain() int {
|
||||||
}
|
}
|
||||||
ui = basicUi
|
ui = basicUi
|
||||||
if !inPlugin {
|
if !inPlugin {
|
||||||
if TTY, err := tty.Open(); err != nil {
|
if TTY, err := openTTY(); err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "No tty available: %s\n", err)
|
fmt.Fprintf(os.Stderr, "No tty available: %s\n", err)
|
||||||
} else {
|
} else {
|
||||||
basicUi.TTY = TTY
|
basicUi.TTY = TTY
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// +build !solaris
|
||||||
|
|
||||||
package packer
|
package packer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -78,12 +80,3 @@ type readCloser struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *readCloser) Close() error { return c.close() }
|
func (c *readCloser) Close() error { return c.close() }
|
||||||
|
|
||||||
// NoopProgressTracker is a progress tracker
|
|
||||||
// that displays nothing.
|
|
||||||
type NoopProgressTracker struct{}
|
|
||||||
|
|
||||||
// TrackProgress returns stream
|
|
||||||
func (*NoopProgressTracker) TrackProgress(_ string, _, _ int64, stream io.ReadCloser) io.ReadCloser {
|
|
||||||
return stream
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package packer
|
||||||
|
|
||||||
|
import "io"
|
||||||
|
|
||||||
|
// NoopProgressTracker is a progress tracker
|
||||||
|
// that displays nothing.
|
||||||
|
type NoopProgressTracker struct{}
|
||||||
|
|
||||||
|
// TrackProgress returns stream
|
||||||
|
func (*NoopProgressTracker) TrackProgress(_ string, _, _ int64, stream io.ReadCloser) io.ReadCloser {
|
||||||
|
return stream
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
package packer
|
||||||
|
|
||||||
|
type uiProgressBar = NoopProgressTracker
|
|
@ -3,7 +3,7 @@
|
||||||
# This script builds the application from source for multiple platforms.
|
# This script builds the application from source for multiple platforms.
|
||||||
# Determine the arch/os combos we're building for
|
# Determine the arch/os combos we're building for
|
||||||
ALL_XC_ARCH="386 amd64 arm arm64 ppc64le mips mips64 mipsle mipsle64 s390x"
|
ALL_XC_ARCH="386 amd64 arm arm64 ppc64le mips mips64 mipsle mipsle64 s390x"
|
||||||
ALL_XC_OS="linux darwin windows freebsd openbsd"
|
ALL_XC_OS="linux darwin windows freebsd openbsd solaris"
|
||||||
|
|
||||||
# Exit immediately if a command fails
|
# Exit immediately if a command fails
|
||||||
set -e
|
set -e
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
// +build !solaris
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/mattn/go-tty"
|
||||||
|
)
|
||||||
|
|
||||||
|
var openTTY = tty.Open
|
|
@ -0,0 +1,11 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/hashicorp/packer/packer"
|
||||||
|
)
|
||||||
|
|
||||||
|
func openTTY() (packer.TTY, error) {
|
||||||
|
return nil, fmt.Errorf("no TTY available on solaris")
|
||||||
|
}
|
Loading…
Reference in New Issue