diff --git a/otherworld b/otherworld index ea3389e..84303c0 100755 --- a/otherworld +++ b/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)