()
| 133 | } |
| 134 | |
| 135 | func (b BuildConfig) preInstall() error { |
| 136 | for _, script := range b.PreInstall { |
| 137 | script = strings.TrimSpace(script) |
| 138 | if script == "" { |
| 139 | continue |
| 140 | } |
| 141 | |
| 142 | title := fmt.Sprintf("[pre install %s]", b.PortConfig.nameVersion()) |
| 143 | script = b.expandVariables(script) |
| 144 | if err := checkUnexpandedVariables(script, title); err != nil { |
| 145 | return err |
| 146 | } |
| 147 | executor := cmd.NewExecutor(title, script) |
| 148 | |
| 149 | // prebuild port does not have repo dir. |
| 150 | if fileio.PathExists(b.PortConfig.RepoDir) { |
| 151 | executor.SetWorkDir(b.PortConfig.RepoDir) |
| 152 | } |
| 153 | |
| 154 | if err := executor.Execute(); err != nil { |
| 155 | return err |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | return nil |
| 160 | } |
| 161 | |
| 162 | func (b BuildConfig) postInstall() error { |
| 163 | for _, script := range b.PostInstall { |
nothing calls this directly
no test coverage detected