| 662 | } |
| 663 | |
| 664 | func createPostInstScript(target target) (string, error) { |
| 665 | scriptname := filepath.Join("script", "deb-post-inst.template") |
| 666 | t, err := template.ParseFiles(scriptname) |
| 667 | if err != nil { |
| 668 | return "", err |
| 669 | } |
| 670 | scriptname = strings.TrimSuffix(scriptname, ".template") |
| 671 | w, err := os.Create(scriptname) |
| 672 | if err != nil { |
| 673 | return "", err |
| 674 | } |
| 675 | defer w.Close() |
| 676 | if err = t.Execute(w, struct { |
| 677 | Service, Command string |
| 678 | }{ |
| 679 | target.systemdService, target.binaryName, |
| 680 | }); err != nil { |
| 681 | return "", err |
| 682 | } |
| 683 | return scriptname, nil |
| 684 | } |
| 685 | |
| 686 | func shouldBuildSyso(dir string) (string, error) { |
| 687 | type M map[string]interface{} |