File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 8
8
"os"
9
9
"path/filepath"
10
10
"strings"
11
+ "syscall"
11
12
"text/template"
12
13
)
13
14
@@ -108,7 +109,13 @@ func generateFile(config Config, containers Context) bool {
108
109
if config .Dest != "" {
109
110
110
111
contents := []byte {}
111
- if _ , err := os .Stat (config .Dest ); err == nil {
112
+ if fi , err := os .Stat (config .Dest ); err == nil {
113
+ if err := dest .Chmod (fi .Mode ()); err != nil {
114
+ log .Fatalf ("unable to chmod temp file: %s\n " , err )
115
+ }
116
+ if err := dest .Chown (int (fi .Sys ().(* syscall.Stat_t ).Uid ), int (fi .Sys ().(* syscall.Stat_t ).Gid )); err != nil {
117
+ log .Fatalf ("unable to chown temp file: %s\n " , err )
118
+ }
112
119
contents , err = ioutil .ReadFile (config .Dest )
113
120
if err != nil {
114
121
log .Fatalf ("unable to compare current file contents: %s: %s\n " , config .Dest , err )
You can’t perform that action at this time.
0 commit comments