From d45037dee96be62126c277a8738b39a52b9ed4b9 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 16 Nov 2024 04:56:58 -0600 Subject: [PATCH] allow the .deb package to be a different name --- buildPackage.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/buildPackage.go b/buildPackage.go index 8d3bba2..9c9692c 100644 --- a/buildPackage.go +++ b/buildPackage.go @@ -70,7 +70,7 @@ func (c *controlBox) buildPackage() (bool, error) { } else { // set the GO111 build var to true. pass the versions to the compiler manually os.Setenv("GO111MODULE", "off") - cmd := []string{"go", "build", "-v", "-x"} + cmd := []string{"go", "build"} // set standard ldflag options now := time.Now() @@ -96,9 +96,18 @@ func (c *controlBox) buildPackage() (bool, error) { } } + filebase := filepath.Base(c.pathL.String()) + if fullfilename != filebase { + // this exception is for when you want to override a package name + // sometimes that's the best option. This way you can keep your + // name, but the .deb package name can be different so you can + // still apt-get it. For an example, look at the gozookeeper package + fullfilename = filebase + } + if !shell.Exists(fullfilename) { log.Warn("build failed. filename does not exist", fullfilename) - return false, errors.New("missing" + fullfilename) + return false, errors.New("missing " + fullfilename) } if shell.Exists("files") {