Skip to content

Commit

Permalink
Merge pull request #8 from thebsdbox/makefile
Browse files Browse the repository at this point in the history
Fixes to makefile for releases and improved logging output from DHCP
  • Loading branch information
thebsdbox authored Nov 26, 2018
2 parents c9aab57 + 9b0226e commit 496887f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 16 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ TARGET := plunder
.DEFAULT_GOAL: $(TARGET)

# These will be provided to the target
VERSION := 1.0.0
VERSION := 0.1
BUILD := `git rev-parse HEAD`

# Operating System Default (LINUX)
Expand Down Expand Up @@ -50,6 +50,21 @@ docker:
@rm ./dockerfile/$(TARGET)
@echo New Docker image created

release:
@echo Creating Darwin Build
@GOOS=darwin make build
@zip -9 -r plunder-darwin-$(VERSION).zip ./plunder
@rm plunder
@echo Creating Linux Build
@GOOS=linux make build
@zip -9 -r plunder-linux-$(VERSION).zip ./plunder
@rm plunder
@echo Creating Windows Build
@GOOS=windows make build
@zip -9 -r plunder-win-$(VERSION).zip ./plunder
@rm plunder


simplify:
@gofmt -s -l -w $(SRC)

Expand Down
4 changes: 3 additions & 1 deletion pkg/server/serve_dhcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,17 @@ func (h *DHCPSettings) ServeDHCP(p dhcp.Packet, msgType dhcp.MessageType, option
log.Debugf("Mac address is configured for [%s]", deploymentType)
// If this mac address has no deployment attached then reboot IPXE
if deploymentType == "" {
log.Warnf("Mac address[%s] is unknown, rebooting server", mac)
h.Options[67] = []byte("http://" + h.IP.String() + "/reboot.ipxe")
} else {
// Assign the deployment boot script
log.Infof("Mac address [%s] is assigned a [%s] deployment type", mac, deploymentType)
h.Options[67] = []byte("http://" + h.IP.String() + "/" + deploymentType + ".ipxe")
}
}
}
ipLease := dhcp.IPAdd(h.Start, free)
log.Infof("Allocated IP [%s] for [%s]", ipLease.String(), mac)
log.Debugf("Allocated IP [%s] for [%s]", ipLease.String(), mac)

return dhcp.ReplyPacket(p, dhcp.Offer, h.IP, ipLease, h.LeaseDuration,
h.Options.SelectOrderOrAll(options[dhcp.OptionParameterRequestList]))
Expand Down

0 comments on commit 496887f

Please sign in to comment.