Permalink
Browse files

Fix pacman file perms

  • Loading branch information...
zachhuff386 committed May 23, 2017
1 parent 1eee4ff commit 198ce9c24f507cfdb41d46bc9ac4f8deed86bb4e
Showing with 18 additions and 3 deletions.
  1. +2 −2 pacman/pacman.go
  2. +1 −1 redhat/redhat.go
  3. +15 −0 utils/file.go
View
@@ -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"
@@ -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
}
View
@@ -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"
View
@@ -1,6 +1,7 @@
package utils
import (
"fmt"
"github.com/dropbox/godropbox/errors"
"io/ioutil"
"os"
@@ -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 {

0 comments on commit 198ce9c

Please sign in to comment.