Add user_init_commands
and root_init_commands
lists so config files can append init commands successively without overwriting each other.
This commit is contained in:
parent
f43ac055c2
commit
911ffe1c92
12
otherworld
12
otherworld
@ -258,7 +258,9 @@ config = {
|
||||
"tty": sys.stdout.isatty(),
|
||||
"log": log,
|
||||
"root_init_command": [],
|
||||
"root_init_commmands": [],
|
||||
"user_init_command": [],
|
||||
"user_init_commands": [],
|
||||
"docker_create_options": []
|
||||
}
|
||||
|
||||
@ -355,10 +357,16 @@ except Exception:
|
||||
docker_create_user(container_name, user, uid)
|
||||
|
||||
if config['root_init_command']:
|
||||
docker_exec(container_name, init_command_as_list(config['root_init_command']), "root", command_env, tty, "/home/{}".format(command_user))
|
||||
config['root_init_commands'].append(config['root_init_command'])
|
||||
|
||||
for command in config['root_init_commands']:
|
||||
docker_exec(container_name, init_command_as_list(command), "root", command_env, tty, "/home/{}".format(command_user))
|
||||
|
||||
if config['user_init_command']:
|
||||
docker_exec(container_name, init_command_as_list(config['user_init_command']), command_user, command_env, tty, "/home/{}".format(command_user))
|
||||
config['user_init_commands'].append(config['user_init_command'])
|
||||
|
||||
for command in config['user_init_commands']:
|
||||
docker_exec(container_name, init_command_as_list(command), command_user, command_env, tty, "/home/{}".format(command_user))
|
||||
|
||||
log("Welcome to {} (IP {})", container_name, container['NetworkSettings']['IPAddress'])
|
||||
docker_exec(container_name, command, command_user, command_env, tty, command_workdir)
|
||||
|
Loading…
x
Reference in New Issue
Block a user