Skip to content

Commit

Permalink
Fix pacman file perms
Browse files Browse the repository at this point in the history
  • Loading branch information
zachhuff386 committed May 23, 2017
1 parent 1eee4ff commit 198ce9c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pacman/pacman.go
Expand Up @@ -163,7 +163,7 @@ func (p *Pacman) createMake() (err error) {
}

data += "package() {\n"
data += fmt.Sprintf(" sudo rsync -a -A -X %s/ ${pkgdir}/\n",
data += fmt.Sprintf(" rsync -a -A -X %s/ ${pkgdir}/\n",
p.Pack.PackageDir)
data += "}\n"

Expand All @@ -178,7 +178,7 @@ func (p *Pacman) createMake() (err error) {
}

func (p *Pacman) pacmanBuild() (err error) {
err = utils.Chmod(p.pacmanDir, 0777)
err = utils.ChownR(p.pacmanDir, "nobody", "nobody")
if err != nil {
return
}
Expand Down
2 changes: 1 addition & 1 deletion redhat/redhat.go
Expand Up @@ -167,7 +167,7 @@ func (r *Redhat) createSpec(files []string) (err error) {
}

data += "%install\n"
data += fmt.Sprintf("sudo rsync -a -A -X %s/ $RPM_BUILD_ROOT/\n",
data += fmt.Sprintf("rsync -a -A -X %s/ $RPM_BUILD_ROOT/\n",
r.Pack.PackageDir)
data += "\n"

Expand Down
15 changes: 15 additions & 0 deletions utils/file.go
@@ -1,6 +1,7 @@
package utils

import (
"fmt"
"github.com/dropbox/godropbox/errors"
"io/ioutil"
"os"
Expand Down Expand Up @@ -57,6 +58,20 @@ func Chmod(path string, perm os.FileMode) (err error) {
return
}

func ChownR(path string, user, group string) (err error) {
err = Exec("",
"chown",
"-R",
fmt.Sprintf("%s:%s", user, group),
path,
)
if err != nil {
return
}

return
}

func Remove(path string) (err error) {
err = os.Remove(path)
if err != nil {
Expand Down

0 comments on commit 198ce9c

Please sign in to comment.