diff options
-rw-r--r-- | docs/containers.rst | 8 | ||||
-rw-r--r-- | lcitool/containers/containers.py | 8 |
2 files changed, 7 insertions, 9 deletions
diff --git a/docs/containers.rst b/docs/containers.rst index abaa406..5873b12 100644 --- a/docs/containers.rst +++ b/docs/containers.rst @@ -82,12 +82,8 @@ home directory inside the container, and the working directory is switched to the home directory to make execution easier. The script file is mounted to the *script* file in the home directory -inside the container. Ensure the file is an executable by running: - -:: - - chmod +x <path_to_your_script> - +inside the container. The script is made executable before the mount is +performed. It can also be used as a standalone script (e.g an ``echo hello" script``). diff --git a/lcitool/containers/containers.py b/lcitool/containers/containers.py index e026c22..0d5041b 100644 --- a/lcitool/containers/containers.py +++ b/lcitool/containers/containers.py @@ -194,9 +194,11 @@ class Container(ABC): ] if script: - script_file = shutil.copy2( - script, Path(tempdir, "script") - ) + script_file = Path(shutil.copy2(script, Path(tempdir, "script"))) + + # make the script an executable file + script_file.chmod(script_file.stat().st_mode | 0o111) + script_mount = f"{script_file}:{user_home}/script:z" engine_args_.extend([ "--volume", script_mount |