Skip to content

Commit

Permalink
Merge pull request #42 from guzman-raphael/fix-permission-apt
Browse files Browse the repository at this point in the history
Fix permission issue with updating the package manager
  • Loading branch information
jverswijver authored Nov 3, 2021
2 parents de5aba4 + 2661324 commit f90cec3
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions utilities/startup.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ func main() {
// Install alpine packages
if _, err := os.Stat(os.Getenv("APK_REQUIREMENTS")); err == nil {
cmd0 := exec.Command("apk", "update")
cmd0.SysProcAttr = &syscall.SysProcAttr{}
cmd0.SysProcAttr.Credential = &syscall.Credential{Uid: 0, Gid: 0}
output0, err0 := cmd0.CombinedOutput()
if err0 != nil {
println("System update error!")
Expand Down Expand Up @@ -107,6 +109,8 @@ func main() {
// Install debian packages
if _, err := os.Stat(os.Getenv("APT_REQUIREMENTS")); err == nil {
cmd0 := exec.Command("apt-get", "update")
cmd0.SysProcAttr = &syscall.SysProcAttr{}
cmd0.SysProcAttr.Credential = &syscall.Credential{Uid: 0, Gid: 0}
output0, err0 := cmd0.CombinedOutput()
if err0 != nil {
println("System update error!")
Expand Down Expand Up @@ -145,11 +149,11 @@ func main() {
}
// check if config passed in from flag name
func isFlagPassed(name string) bool {
found := false
flag.Visit(func(f *flag.Flag) {
if f.Name == name {
found = true
}
})
return found
found := false
flag.Visit(func(f *flag.Flag) {
if f.Name == name {
found = true
}
})
return found
}

0 comments on commit f90cec3

Please sign in to comment.