| 336 | } |
| 337 | |
| 338 | func getConfigFile(path, executePath, templatePath string, app application) error { |
| 339 | _ = os.MkdirAll(filepath.Dir(path), 0755) |
| 340 | f, err := os.Create(executePath) |
| 341 | if err != nil { |
| 342 | return err |
| 343 | } |
| 344 | if file.IsNotExist(path) { |
| 345 | nf, err := os.Create(path) |
| 346 | if err != nil { |
| 347 | return err |
| 348 | } |
| 349 | tmpl, err := template.ParseFiles(templatePath) |
| 350 | if err != nil { |
| 351 | return err |
| 352 | } |
| 353 | err = tmpl.Execute(nf, app) |
| 354 | if err != nil { |
| 355 | return err |
| 356 | } |
| 357 | _ = nf.Close() |
| 358 | } |
| 359 | pf, err := os.Open(path) |
| 360 | if err != nil { |
| 361 | return err |
| 362 | } |
| 363 | _, _ = io.Copy(f, pf) |
| 364 | _ = f.Close() |
| 365 | _ = pf.Close() |
| 366 | return nil |
| 367 | } |
| 368 | |
| 369 | func deCompress(tarFile, dest string) error { |
| 370 | srcFile, err := os.Open(tarFile) |