Documentation
¶
Overview ¶
Package loginshell keeps an image's PATH in the login shells toolboxd runs.
Images put their tools on PATH with ENV (the golang image adds /usr/local/go/bin, rust /usr/local/cargo/bin), and toolboxd starts with that PATH. A login shell reads /etc/profile first, and on Alpine and Debian alike that file overwrites PATH with a fixed default, so the image's own directories vanish and `go` or `cargo` is "not found". Login shells stay, because some images set tools up through the profile (conda, nix, sdkman in /etc/profile.d); what changes is that the image's PATH is put back in front once the profile has run.
toolboxd records the PATH it started with in Env, inherited by every child, and runs Restore after the profile: prefixed to every command it hands a login shell (Prefix, Argv), written first to a stdin-fed login session, and installed as an /etc/profile.d script (InstallProfileHook) for the interactive terminals no command reaches.
Index ¶
Constants ¶
const Env = "AEROLVM_IMAGE_PATH"
Env names the variable holding the PATH login shells put back: the one toolboxd started with, or the one a request set.
const ProfileDir = "/etc/profile.d"
ProfileDir is where login shells on Alpine and Debian source drop-in scripts, after /etc/profile has set PATH.
const Restore = `` /* 157-byte string literal not displayed */
Restore is POSIX shell that puts $AEROLVM_IMAGE_PATH back at the front of PATH unless it is already there, keeping whatever the profile added after it. It does nothing when the variable is unset, so it is harmless outside aerolvm.
Variables ¶
This section is empty.
Functions ¶
func Argv ¶
Argv returns argv with the PATH restore prefixed to its command when argv runs a login shell with -c (an E2B command is /bin/bash -l -c ...). Anything else is returned unchanged.
func EnvFor ¶
EnvFor is the extra environment for a child started with a request's env: a PATH the request sets is the one its login shells keep.
func InstallProfileHook ¶
InstallProfileHook writes the PATH restore as a profile.d script in dir, for the interactive login shells no command reaches (terminals). It reports whether the hook is in place. A missing dir means no profile sources drop-ins, and nothing is written; an unwritable one (a non-root image, a read-only root) is an error the caller logs.
func LoginWithoutCommand ¶
LoginWithoutCommand reports whether argv starts a login shell that reads its commands from stdin (or a terminal) rather than -c.
Types ¶
This section is empty.