Sign inSign up

equinor/developer-pod:dp-shell-0.1.0

Multi-platform
Manifest digest

sha256:277fed198f805be0f7924640c017599ae5922f495e4a590e6f9cf30b4320d42d

Last pushed

5 days by equinor

Type

Sandbox Kit

Manifest digest

sha256:277fed198f805be0f7924640c017599ae5922f495e4a590e6f9cf30b4320d42d

yaml
schemaVersion: "3"
displayName: dp shell experience
description: zsh as the login shell with starship, autosuggestions, syntax highlighting and fzf; bash keeps starship, fzf and completion.
version: 0.1.0
kind: mixin
provides:
    - [email protected]
capabilities:
    - type: com.docker.sandbox/network-policy@1
      config:
        install:
            allow:
                - deb.debian.org
                - dhi.io
    - type: com.docker.sandbox/lifecycle@1
      config:
        install:
            - command: |
                set -eu
                export DEBIAN_FRONTEND=noninteractive
                apt-get update -qq
                apt-get install -y -qq --no-install-recommends zsh zsh-autosuggestions zsh-syntax-highlighting bash-completion >/dev/null
                rm -rf /var/lib/apt/lists/*
                # chsh fails under PAM in a hook (observed); usermod works.
                usermod --shell /bin/zsh agent
                # Both system files belong to Debian packages, so the lines are
                # appended after the install, once (grep before append).
                line='[ -r /etc/dp/zshrc ] && . /etc/dp/zshrc'
                grep -qxF "$line" /etc/zsh/zshrc || printf '\n# dp-shell kit\n%s\n' "$line" >> /etc/zsh/zshrc
                line='[ -r /etc/dp/bashrc ] && . /etc/dp/bashrc'
                grep -qxF "$line" /etc/bash.bashrc || printf '\n# dp-shell kit\n%s\n' "$line" >> /etc/bash.bashrc
                # The base ships /home/agent/.bashrc, which ends by setting
                # PROMPT_COMMAND to its own prompt after /etc/bash.bashrc ran
                # (observed, Docker Hardened Images Debian 13 base, 2026-11-13),
                # so bash gets starship only if the line also runs from there.
                home="$(getent passwd agent | cut -d: -f6)"
                if [ -f "$home/.bashrc" ] && ! grep -qxF "$line" "$home/.bashrc"; then
                  printf '\n# dp-shell kit\n%s\n' "$line" >> "$home/.bashrc"
                fi
                # Without any of its four startup files in the home, zsh's
                # zsh/newuser module runs the new-user menu on the first
                # interactive start (zsh 5.9 Src/Modules/newuser.c; Debian ships
                # scripts/newuser). An empty .zshrc, the agent's own, skips it;
                # it is the file a user edits for personal settings.
                if [ ! -e "$home/.zshrc" ] && [ ! -e "$home/.zshenv" ] && [ ! -e "$home/.zprofile" ] && [ ! -e "$home/.zlogin" ]; then
                  printf '%s\n' "# Your zsh settings. The dp-shell kit keeps its own in /etc/dp/zshrc (sourced by /etc/zsh/zshrc before this file)." > "$home/.zshrc"
                  chown agent:agent "$home/.zshrc"
                fi
              description: Install zsh, its two plugins and bash-completion from Debian; make zsh the agent user's login shell; wire dp's configuration into the system rc files
              user: "0"