2023-03-09 09:23:42 -05:00
|
|
|
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
2023-04-03 11:50:22 -04:00
|
|
|
load("@rules_oci//oci:defs.bzl", "oci_image")
|
|
|
|
load("@rules_pkg//:pkg.bzl", "pkg_tar")
|
|
|
|
load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_files", "strip_prefix")
|
2023-03-09 09:23:42 -05:00
|
|
|
|
|
|
|
go_library(
|
|
|
|
name = "libvirt",
|
|
|
|
srcs = ["libvirt.go"],
|
|
|
|
importpath = "github.com/edgelesssys/constellation/v2/cli/internal/libvirt",
|
|
|
|
visibility = ["//cli:__subpackages__"],
|
|
|
|
deps = [
|
|
|
|
"//internal/file",
|
|
|
|
"@com_github_docker_docker//api/types",
|
|
|
|
"@com_github_docker_docker//api/types/container",
|
|
|
|
"@com_github_docker_docker//api/types/filters",
|
|
|
|
"@com_github_docker_docker//client",
|
|
|
|
"@com_github_spf13_afero//:afero",
|
|
|
|
],
|
|
|
|
)
|
2023-04-03 11:50:22 -04:00
|
|
|
|
|
|
|
pkg_files(
|
|
|
|
name = "etc",
|
|
|
|
srcs = [
|
|
|
|
"//cli/internal/libvirt/etc:passwd_db",
|
|
|
|
],
|
|
|
|
attributes = pkg_attributes(
|
|
|
|
group = "root",
|
|
|
|
mode = "0644",
|
|
|
|
owner = "root",
|
|
|
|
),
|
|
|
|
prefix = "etc",
|
|
|
|
strip_prefix = strip_prefix.from_pkg(),
|
|
|
|
)
|
|
|
|
|
|
|
|
pkg_files(
|
|
|
|
name = "nvram",
|
|
|
|
srcs = [
|
|
|
|
"//cli/internal/libvirt/nvram:nvram_vars",
|
|
|
|
],
|
|
|
|
prefix = "usr/share/OVMF",
|
|
|
|
strip_prefix = strip_prefix.from_pkg(),
|
|
|
|
)
|
|
|
|
|
|
|
|
pkg_files(
|
|
|
|
name = "libvirt_conf",
|
|
|
|
srcs = [
|
|
|
|
"libvirtd.conf",
|
|
|
|
"qemu.conf",
|
|
|
|
],
|
|
|
|
prefix = "/etc/libvirt",
|
|
|
|
)
|
|
|
|
|
|
|
|
pkg_tar(
|
|
|
|
name = "start",
|
|
|
|
srcs = [
|
|
|
|
"start.sh",
|
|
|
|
":etc",
|
|
|
|
":libvirt_conf",
|
|
|
|
":nvram",
|
|
|
|
],
|
|
|
|
mode = "0755",
|
|
|
|
)
|
|
|
|
|
|
|
|
oci_image(
|
|
|
|
name = "constellation_libvirt",
|
|
|
|
architecture = "amd64",
|
|
|
|
entrypoint = ["/start.sh"],
|
|
|
|
os = "linux",
|
|
|
|
tars = [
|
|
|
|
"//rpm:containerized-libvirt",
|
|
|
|
":start",
|
|
|
|
],
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|