dependencies

This commit is contained in:
Cat /dev/Nulo 2022-09-16 16:17:37 -03:00
parent 58330f77e8
commit 2496e349cb

View file

@ -13,9 +13,17 @@ local env_string = ""
local netns_string = "" local netns_string = ""
local USE_NETNS = os.getenv "USE_NETNS" local USE_NETNS = os.getenv "USE_NETNS"
if USE_NETNS ~= nil then if USE_NETNS ~= nil then
env_string = env_string .. "USE_NETNS='"..USE_NETNS.."' " env_string = env_string .. "USE_NETNS="..USE_NETNS.." "
netns_string = "ip netns exec "..USE_NETNS.." " netns_string = "ip netns exec "..USE_NETNS.." "
end end
local dependencies_string = ""
local DEPENDENCIES = os.getenv "DEPENDENCIES"
if DEPENDENCIES ~= nil then
env_string = env_string .. "DEPENDENCIES='"..DEPENDENCIES.."' "
for dep in string.gmatch(DEPENDENCIES, "[%w-]+") do
dependencies_string = dependencies_string .. "sv status "..dep.." || exit 1\n"
end
end
local user = arg[1] local user = arg[1]
local container_name = arg[2] local container_name = arg[2]
@ -30,6 +38,8 @@ local prefix = [[
#!/bin/sh #!/bin/sh
# Generated with ]]..utils.join_table({env_string..arg[0], user, container_name, image_name, unpack(arguments)}, " ")..[[ # Generated with ]]..utils.join_table({env_string..arg[0], user, container_name, image_name, unpack(arguments)}, " ")..[[
]]..dependencies_string..[[
IMAGE=']]..image_name..[[' IMAGE=']]..image_name..[['
CONTAINER_NAME=']]..container_name..[[' CONTAINER_NAME=']]..container_name..[['