diff options
| author | Jeff Carr <[email protected]> | 2024-11-16 09:49:49 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-11-16 09:49:49 -0600 |
| commit | 526605ff8733f14baa737246e2d817d42a556675 (patch) | |
| tree | 517d7cd6ca647bd2080f6b73366e3774a2b2863f /buildPackage.go | |
| parent | d45037dee96be62126c277a8738b39a52b9ed4b9 (diff) | |
add an example to build a custom .deb
Diffstat (limited to 'buildPackage.go')
| -rw-r--r-- | buildPackage.go | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/buildPackage.go b/buildPackage.go index 9c9692c..856e960 100644 --- a/buildPackage.go +++ b/buildPackage.go @@ -42,7 +42,12 @@ func (c *controlBox) buildPackage() (bool, error) { fulldebname := filepath.Join(homeDir, "incoming", debname) if shell.Exists(fulldebname) { log.Info("debian package already built: " + fulldebname) - return true, errors.New("debian package already built: " + fulldebname) + if argv.Auto { + return true, errors.New("debian package already built: " + fulldebname) + } else { + return false, errors.New("debian package already built: " + fulldebname) + } + } var fullfilename string @@ -132,13 +137,17 @@ func (c *controlBox) buildPackage() (bool, error) { log.Warn("mkdir failed") return false, errors.New("mkdir files/usr/bin") } - if r := shell.Run([]string{"cp", fullfilename, "files/usr/bin"}); r.Error != nil { - log.Warn("cp failed") - return false, r.Error - } - if r := shell.Run([]string{"strip", "files/usr/bin/" + filename}); r.Error != nil { - log.Warn("strip failed") - return false, r.Error + if os.Getenv("GO_DEB_CUSTOM") == "true" { + // skip cp & strip on custom 'control' files + } else { + if r := shell.Run([]string{"cp", fullfilename, "files/usr/bin"}); r.Error != nil { + log.Warn("cp failed") + return false, r.Error + } + if r := shell.Run([]string{"strip", "files/usr/bin/" + filename}); r.Error != nil { + log.Warn("strip failed") + return false, r.Error + } } // put the README in there (if missing, generate it?) @@ -168,19 +177,10 @@ func (c *controlBox) buildPackage() (bool, error) { shell.Run([]string{"cp", "postinst", "files/DEBIAN/"}) } - if c.status == nil { - log.Warn("c.status == nil") - panic(-1) - } // experiment for the toolkit package // if the git repo has a "./build" script run it before packaging // this way the user can put custom files in the .deb package - if c.status.Exists("build") { - if argv.Release { - os.Unsetenv("GO111MODULE") - } else { - os.Setenv("GO111MODULE", "off") - } + if shell.Exists("build") { shell.Run([]string{"./build"}) } |
