Skip to content

Commit

Permalink
New upstream version 0.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
obbardc committed Jan 10, 2024
1 parent 030d034 commit f76ea6c
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 26 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
Expand Down Expand Up @@ -48,22 +48,25 @@ jobs:
# See https://github.com/actions/runner-images/issues/183
#
# For Arch Linux uml is not yet supported, so only test under qemu there.
os: [bullseye, bookworm, trixie]
backend: [qemu, uml]
os: [bookworm, trixie]
backend: [qemu, uml, kvm]
include:
- os: arch
backend: qemu
backend: "qemu"
- os: arch
backend: "kvm"
name: Test ${{matrix.os}} with ${{matrix.backend}} backend
runs-on: ubuntu-latest
runs-on: ${{ matrix.backend == 'kvm' && 'kvm' || 'ubuntu-latest' }}
defaults:
run:
shell: bash
container:
image: ghcr.io/go-debos/test-containers/fakemachine-${{matrix.os}}:main
image: ghcr.io/go-debos/test-containers/${{matrix.os}}:main
options: >-
--security-opt label=disable
--cap-add=SYS_PTRACE
--tmpfs /scratch:exec
${{ matrix.backend == 'kvm' && '--device /dev/kvm' || '' }}
env:
TMP: /scratch
steps:
Expand Down
3 changes: 0 additions & 3 deletions backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,6 @@ type backend interface {
// A list of udev rules
UdevRules() []string

// The match expression used for the networkd configuration
NetworkdMatch() string

// The tty used for the job output
JobOutputTTY() string

Expand Down
4 changes: 0 additions & 4 deletions backend_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,6 @@ func (b qemuBackend) UdevRules() []string {
return udevRules
}

func (b qemuBackend) NetworkdMatch() string {
return "e*"
}

func (b qemuBackend) JobOutputTTY() string {
// By default we send job output to the second virtio console,
// reserving /dev/ttyS0 for boot messages (which we ignore)
Expand Down
4 changes: 0 additions & 4 deletions backend_uml.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ func (b umlBackend) UdevRules() []string {
return udevRules
}

func (b umlBackend) NetworkdMatch() string {
return "vec*"
}

func (b umlBackend) JobOutputTTY() string {
// Send the fakemachine job output to the right console
if b.machine.showBoot {
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ require (
github.com/alessio/shellescape v1.4.2
github.com/docker/go-units v0.5.0
github.com/jessevdk/go-flags v1.5.0
github.com/klauspost/compress v1.15.3
github.com/klauspost/compress v1.17.4
github.com/stretchr/testify v1.8.1
github.com/surma/gocpio v1.1.0
github.com/ulikunitz/xz v0.5.11
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad
golang.org/x/sys v0.15.0
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc=
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
github.com/klauspost/compress v1.15.3 h1:wmfu2iqj9q22SyMINp1uQ8C2/V4M1phJdmH9fG4nba0=
github.com/klauspost/compress v1.15.3/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU=
github.com/klauspost/compress v1.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW4fZ4=
github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand All @@ -23,8 +23,8 @@ github.com/surma/gocpio v1.1.0/go.mod h1:zaLNaN+EDnfSnNdWPJJf9OZxWF817w5dt8JNzF9
github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8=
github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
22 changes: 19 additions & 3 deletions machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,16 +286,26 @@ exec /lib/systemd/systemd
`
const networkdTemplate = `
[Match]
Name=%[1]s
Type=ether
[Network]
DHCP=ipv4
# Disable link-local address to speedup boot
LinkLocalAddressing=no
IPv6AcceptRA=no
`

const networkdLinkTemplate = `
[Match]
Type=ether
[Link]
# Give the interface a static name
Name=ethernet0
`

const commandWrapper = `#!/bin/sh
/lib/systemd/systemd-networkd-wait-online -q
/lib/systemd/systemd-networkd-wait-online -q --interface=ethernet0
if [ $? != 0 ]; then
echo "WARNING: Network setup failed"
echo "== Journal =="
Expand Down Expand Up @@ -798,7 +808,13 @@ func (m *Machine) startup(command string, extracontent [][2]string) (int, error)
}

err = w.WriteFile("/etc/systemd/network/ethernet.network",
fmt.Sprintf(networkdTemplate, backend.NetworkdMatch()), 0444)
networkdTemplate, 0444)
if err != nil {
return -1, err
}

err = w.WriteFile("/etc/systemd/network/10-ethernet.link",
networkdLinkTemplate, 0444)
if err != nil {
return -1, err
}
Expand Down

0 comments on commit f76ea6c

Please sign in to comment.