diff options
Diffstat (limited to 'buildPackage.go')
| -rw-r--r-- | buildPackage.go | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/buildPackage.go b/buildPackage.go index bf0657f..b7c1b27 100644 --- a/buildPackage.go +++ b/buildPackage.go @@ -62,7 +62,7 @@ func (c *controlBox) buildPackage() (bool, error) { os.Unsetenv("GO111MODULE") path := c.pathL.String() + "@latest" cmd := []string{"go", "install", "-v", "-x", path} - if shell.Run(cmd) { + if r := Run(cmd); r.Error == nil { log.Warn("go install worked") } else { return false, errors.New("go install") @@ -84,7 +84,7 @@ func (c *controlBox) buildPackage() (bool, error) { cmd = append(cmd, "-ldflags", "-X "+flag) } - if shell.Run(cmd) { + if r := Run(cmd); r.Error == nil { log.Warn("go build worked") } else { return false, errors.New("go build") @@ -118,13 +118,13 @@ func (c *controlBox) buildPackage() (bool, error) { log.Warn("mkdir failed") return false, errors.New("mkdir files/usr/bin") } - if !shell.Run([]string{"cp", fullfilename, "files/usr/bin"}) { + if r := Run([]string{"cp", fullfilename, "files/usr/bin"}); r.Error != nil { log.Warn("cp failed") - return false, errors.New("cp " + fullfilename) + return false, r.Error } - if !shell.Run([]string{"strip", "files/usr/bin/" + filename}) { + if r := Run([]string{"strip", "files/usr/bin/" + filename}); r.Error != nil { log.Warn("strip failed") - return false, errors.New("strip " + filename) + return false, r.Error } // put the README in there (if missing, generate it?) @@ -142,8 +142,8 @@ func (c *controlBox) buildPackage() (bool, error) { if !shell.Mkdir(path) { return false, errors.New("no files/usr/lib") } - if !shell.Run([]string{"cp", readme, path}) { - return false, errors.New("cp readme") + if r := Run([]string{"cp", readme, path}); r.Error != nil { + return false, r.Error } } @@ -151,7 +151,7 @@ func (c *controlBox) buildPackage() (bool, error) { return false, errors.New("write control file") } if shell.Exists("postinst") { - shell.Run([]string{"cp", "postinst", "files/DEBIAN/"}) + Run([]string{"cp", "postinst", "files/DEBIAN/"}) } if c.status == nil { @@ -167,26 +167,26 @@ func (c *controlBox) buildPackage() (bool, error) { } else { os.Setenv("GO111MODULE", "off") } - shell.Run([]string{"./build"}) + Run([]string{"./build"}) } - shell.Run([]string{"dpkg-deb", "--build", "files", fulldebname}) + Run([]string{"dpkg-deb", "--build", "files", fulldebname}) if shell.Exists(fulldebname) { } else { log.Warn("build failed") return false, errors.New("dpkg-deb --build failed") } - shell.Run([]string{"dpkg-deb", "-I", fulldebname}) - shell.Run([]string{"dpkg-deb", "-c", fulldebname}) + Run([]string{"dpkg-deb", "-I", fulldebname}) + Run([]string{"dpkg-deb", "-c", fulldebname}) // cleanup files if shell.Exists("files") { if argv.KeepFiles { log.Info("keeping the build files/") } else { - shell.Run([]string{"rm", "-rf", "files"}) + Run([]string{"rm", "-rf", "files"}) log.Info("running sync") - shell.Run([]string{"sync"}) + Run([]string{"sync"}) if shell.Exists("files") { log.Warn("rm -rf files/ failed. Run() returned false") return false, errors.New("rm files/") |
