diff options
| -rw-r--r-- | container/Containerfile | 1 | ||||
| -rwxr-xr-x | container/init | 7 | ||||
| -rwxr-xr-x | dbx | 12 |
3 files changed, 16 insertions, 4 deletions
diff --git a/container/Containerfile b/container/Containerfile index e8f8670..f7fc00f 100644 --- a/container/Containerfile +++ b/container/Containerfile @@ -41,5 +41,6 @@ RUN echo "StreamLocalBindUnlink yes" >> /etc/ssh/sshd_config && \ touch /etc/ssh/authorized_keys # Set up the entrypoint +RUN mkdir -p /etc/dbx/rc.d COPY init /sbin/init ENTRYPOINT ["/sbin/init"] diff --git a/container/init b/container/init index 24b6629..49ee840 100755 --- a/container/init +++ b/container/init @@ -7,4 +7,11 @@ if [ ! -f /run/.dbxenv ]; then exit 1 fi +for rc in /etc/dbx/rc.d/*; do + if [ ! -f "$rc" ] || [ ! -x "$rc" ]; then + continue + fi + "$rc" || printf '%s: %s failed (%d)\n' "$0" "$rc" "$?" >&2 +done + exec /usr/bin/tini /usr/sbin/sshd -- -D -e @@ -322,6 +322,8 @@ cmd_cp() { } cmd_create() { + local user + if engine_iscreated; then general_error "devbox name in use" fi @@ -334,13 +336,15 @@ cmd_create() { scp -q -F "$(ssh_config)" -p -r -- "${skel%/}/." "$name:" fi if [ -n "$script" ]; then - scp -q -F "$(ssh_config)" -p -- "$script" "$name:/tmp/post-install" + scp -q -F "$(ssh_config)" -p -- "$script" "root@$name:/tmp/post-install" fi - ssh -q -F "$(ssh_config)" "$name" " + + user="$(id -un)" + ssh -q -F "$(ssh_config)" "root@$name" " if [ -f /tmp/post-install ] && [ -x /tmp/post-install ]; then - /tmp/post-install && rm /tmp/post-install + /tmp/post-install '$user' && rm /tmp/post-install elif [ -f /etc/dbx/post-install ] && [ -x /etc/dbx/post-install ]; then - /etc/dbx/post-install + /etc/dbx/post-install '$user' fi " engine_stop |
