group
This commit is contained in:
parent
2496e349cb
commit
70a4d99fe9
1 changed files with 14 additions and 5 deletions
|
@ -29,6 +29,13 @@ local user = arg[1]
|
|||
local container_name = arg[2]
|
||||
local image_name = arg[3]
|
||||
|
||||
local group = user
|
||||
local GROUP = os.getenv "GROUP"
|
||||
if GROUP ~= nil then
|
||||
env_string = env_string .. "GROUP="..GROUP.." "
|
||||
group = GROUP
|
||||
end
|
||||
|
||||
local arguments = {unpack(arg, 4)}
|
||||
for i=1,#arguments do
|
||||
arguments[i] = "'"..arguments[i].."'"
|
||||
|
@ -46,16 +53,18 @@ CONTAINER_NAME=']]..container_name..[['
|
|||
|
||||
export USER=']]..user..[['
|
||||
|
||||
export GROUP=']]..group..[['
|
||||
|
||||
export HOME="/home/$USER"
|
||||
cd "$HOME"
|
||||
]]
|
||||
|
||||
local run_script = prefix..[[
|
||||
|
||||
chpst -u "$USER:$USER" podman pull "$IMAGE" 2>/dev/stdout || exit $?
|
||||
chpst -u "$USER:$USER" podman image prune -f 2>/dev/stdout || exit $?
|
||||
chpst -u "$USER:$GROUP" podman pull "$IMAGE" 2>/dev/stdout || exit $?
|
||||
chpst -u "$USER:$GROUP" podman image prune -f 2>/dev/stdout || exit $?
|
||||
|
||||
exec ]]..netns_string..[[chpst -u "$USER:$USER" podman run --tty --rm \
|
||||
exec ]]..netns_string..[[chpst -u "$USER:$GROUP" podman run --tty --rm \
|
||||
--name="$CONTAINER_NAME" \
|
||||
--replace \
|
||||
]]..utils.join_table(arguments, " ")..[[ \
|
||||
|
@ -63,8 +72,8 @@ exec ]]..netns_string..[[chpst -u "$USER:$USER" podman run --tty --rm \
|
|||
]]
|
||||
local down_script = prefix..[[
|
||||
|
||||
chpst -u "$USER:$USER" podman stop --ignore "$CONTAINER_NAME" 2>/dev/stdout || exit $?
|
||||
chpst -u "$USER:$USER" podman rm --force --ignore "$CONTAINER_NAME" 2>/dev/stdout || exit $?
|
||||
chpst -u "$USER:$GROUP" podman stop --ignore "$CONTAINER_NAME" 2>/dev/stdout || exit $?
|
||||
chpst -u "$USER:$GROUP" podman rm --force --ignore "$CONTAINER_NAME" 2>/dev/stdout || exit $?
|
||||
]]
|
||||
|
||||
local function write_script(file_name, content)
|
||||
|
|
Loading…
Reference in a new issue