mirror of
https://github.com/mudler/luet.git
synced 2025-07-21 18:51:39 +00:00
Try to chown after copy
This commit is contained in:
parent
f07cf6c245
commit
c13a2174c4
@ -16,6 +16,7 @@
|
|||||||
package helpers
|
package helpers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
@ -172,9 +173,18 @@ func CopyFile(src, dst string) (err error) {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return copy.Copy(src, dst, copy.Options{
|
err = copy.Copy(src, dst, copy.Options{
|
||||||
Sync: true,
|
Sync: true,
|
||||||
OnSymlink: func(string) copy.SymlinkAction { return copy.Shallow }})
|
OnSymlink: func(string) copy.SymlinkAction { return copy.Shallow }})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if stat, ok := fi.Sys().(*syscall.Stat_t); ok {
|
||||||
|
if err := os.Chown(dst, int(stat.Uid), int(stat.Gid)); err != nil {
|
||||||
|
fmt.Println("failed chowning", dst, err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsDirectory(path string) (bool, error) {
|
func IsDirectory(path string) (bool, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user