-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexec.go
More file actions
42 lines (37 loc) · 1.13 KB
/
Copy pathexec.go
File metadata and controls
42 lines (37 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import "dagger/fedora/internal/dagger"
// WithExecScripts adds scripts (Files) to be uploaded and executed on the
// generated Container image
func (f *Fedora) WithExecScripts(
// scripts (Files) to be uploaded and executed
scripts []*dagger.File,
// if true, the script(s) will be run prior to any packages being installed
// on the Container image
// if false, they will be run after packages are installed as part of
// WithPackagesInstalled
prePackages bool,
) *Fedora {
if prePackages {
f.ExecScriptPre = append(f.ExecScriptPre, scripts...)
} else {
f.ExecScriptPost = append(f.ExecScriptPost, scripts...)
}
return f
}
// WithExec will execute the given command on the Container image
func (f *Fedora) WithExec(
// the command to be executed
command []string,
// if true, the command will be run prior to any packages being installed
// on the Container image
// if false, it will be run after packages are installed as part of
// WithPackagesInstalled
prePackages bool,
) *Fedora {
if prePackages {
f.ExecPre = append(f.ExecPre, command)
} else {
f.ExecPost = append(f.ExecPost, command)
}
return f
}