add dumb-init where it makes sense

This commit is contained in:
Motiejus Jakštys 2021-05-24 00:11:58 +03:00
parent 8596372ce6
commit 8fe547a0ca

View File

@ -61,25 +61,30 @@ def _lxcconfig_impl(ctx):
runfiles = ctx.runfiles(files = ctx.files.src), runfiles = ctx.runfiles(files = ctx.files.src),
) )
def lxcbundle(name, src, version): def lxcbundle(name, src, version, overlay_tars = []):
if type(version) != "int": if type(version) != "int":
fail("version must be an int, got {}".format(type(version))) fail("version must be an int, got {}".format(type(version)))
rootfsname = name + "/_/rootfs" stage0 = name + "/_stage0/rootfs"
rootfs(name = rootfsname, src = src, out = rootfsname + ".tar") stage1 = name + "/_stage1/rootfs"
lxcconfig(name, src = src, out = name + "/_/meta.tar.xz") rootfs(
native.genrule( name = stage0,
name = name + "-rootfs", src = src,
srcs = [rootfsname], out = stage0 + ".tar",
outs = [rootfsname + ".tar.xz"],
cmd = "xz -T0 -f $< > $@",
message = "XZ",
) )
pkg_tar(
name = stage1,
deps = [stage0] + overlay_tars,
extension = "tar.xz",
out = stage1 + ".tar.xz",
)
lxcconfig(name, src = src, out = name + "/_stage1/meta.tar.xz")
outname = "{}.{}.tar".format(name, version) outname = "{}.{}.tar".format(name, version)
pkg_tar( pkg_tar(
name = name, name = name,
srcs = [ srcs = [
name + "-rootfs", name + "/_stage1/rootfs",
name + "-meta", name + "/_stage1/meta",
], ],
out = outname, out = outname,
) )
@ -94,11 +99,11 @@ _lxcconfig = rule(
) )
def lxcconfig(name, src, out = None): def lxcconfig(name, src, out = None):
_lxcconfig(name = name + "/_/config", src = src) _lxcconfig(name = name + "/_stage0/config", src = src)
pkg_tar( pkg_tar(
name = name + "-meta", name = name + "/_stage1/meta",
extension = "tar.xz", extension = "tar.xz",
srcs = [name + "/_/config"], srcs = [name + "/_stage0/config"],
remap_paths = { remap_paths = {
name: "", name: "",
}, },