-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
48 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,7 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/ftlops/ftl" | ||
"github.com/ftlops/ftl/ops" | ||
) | ||
import "github.com/ftlops/ftl/plans/docker" | ||
|
||
func main() { | ||
ftl.Step("install docker", func() ftl.State { | ||
if !ops.MissingPackage("docker-ce") { | ||
return ftl.StateUnchanged | ||
} | ||
|
||
ftl.Step("install prereqs", func() ftl.State { | ||
prereqs := []string{ | ||
"apt-transport-https", | ||
"ca-certificates", | ||
"gnupg", | ||
"lsb-release", | ||
} | ||
missing := ops.MissingPackages(prereqs...) | ||
if len(missing) == 0 { | ||
return ftl.StateUnchanged | ||
} | ||
|
||
ops.UpdateRepos() | ||
ops.Install(missing...) | ||
return ftl.StateChanged | ||
}) | ||
|
||
ftl.Step("add repo", func() ftl.State { | ||
codename := ops.DistroCodename() | ||
repo := fmt.Sprintf("deb [arch=amd64] https://download.docker.com/linux/ubuntu %s stable", codename) | ||
if !ops.MissingRepo(repo) { | ||
return ftl.StateUnchanged | ||
} | ||
ops.AddRepo(repo, "https://download.docker.com/linux/ubuntu/gpg") | ||
return ftl.StateChanged | ||
}) | ||
|
||
ops.Install("docker-ce") | ||
return ftl.StateChanged | ||
}) | ||
docker.Install() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package docker | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/ftlops/ftl" | ||
"github.com/ftlops/ftl/ops" | ||
) | ||
|
||
func Install() { | ||
ftl.Step("install docker", func() ftl.State { | ||
if !ops.MissingPackage("docker-ce") { | ||
return ftl.StateUnchanged | ||
} | ||
|
||
ftl.Step("install prereqs", func() ftl.State { | ||
prereqs := []string{ | ||
"apt-transport-https", | ||
"ca-certificates", | ||
"gnupg", | ||
"lsb-release", | ||
} | ||
missing := ops.MissingPackages(prereqs...) | ||
if len(missing) == 0 { | ||
return ftl.StateUnchanged | ||
} | ||
|
||
ops.UpdateRepos() | ||
ops.Install(missing...) | ||
return ftl.StateChanged | ||
}) | ||
|
||
ftl.Step("add repo", func() ftl.State { | ||
codename := ops.DistroCodename() | ||
repo := fmt.Sprintf("deb [arch=amd64] https://download.docker.com/linux/ubuntu %s stable", codename) | ||
if !ops.MissingRepo(repo) { | ||
return ftl.StateUnchanged | ||
} | ||
ops.AddRepo(repo, "https://download.docker.com/linux/ubuntu/gpg") | ||
return ftl.StateChanged | ||
}) | ||
|
||
ops.Install("docker-ce") | ||
return ftl.StateChanged | ||
}) | ||
} |