diff --git a/otherworld b/otherworld index e2d0c7e..722dd74 100755 --- a/otherworld +++ b/otherworld @@ -36,6 +36,16 @@ DEFAULT_COMMAND = ["bash"] GENERATED_IMAGE_NAME_TEMPLATE = "image_{container_name}" +CREATE_USER_BOOTSTRAP_SCRIPT=""" +chown {user} /home/{user} +chown {user} /home/{user}/.config +cd /home/{user} +cp -Rv /etc/skel . +chown -R {user} skel +mv skel/* skel/.* . +rm -rf skel +""" + def get_generated_image_name (container_name): return GENERATED_IMAGE_NAME_TEMPLATE.format(container_name=container_name) @@ -56,8 +66,7 @@ def docker_create_user (container, user, uid=None): if uid is not None: command = command + ["--uid", str(uid)] call(command) - call(["docker", "exec", container, "chown", user, f"/home/{user}"]) - call(["docker", "exec", container, "chown", user, f"/home/{user}/.config"]) + call(["docker", "exec", container, "sh", "-c", CREATE_USER_BOOTSTRAP_SCRIPT.format(user=user)]) def docker_start (container): call(["docker", "start", container])