pkgs/posh: spawn login shell

When bash is spawned as a login shell it automatically loads some of the
default profile paths, including `/etc/profile` and `$HOME/.profile`.
This commit is contained in:
steveej 2019-12-12 15:07:42 +01:00
parent 6ae18f8dd6
commit 4fc34a3fd1

View file

@ -167,7 +167,7 @@ in
source /etc/profile
test -S "$SSH_AUTH_SOCK" && ssh="-v $SSH_AUTH_SOCK:$SSH_AUTH_SOCK -e SSH_AUTH_SOCK"
tty -s && tty="-t" || quiet="-q"
tty -s && tty="-t" entrypoint=--entrypoint='["/usr/bin/env","bash","-il"]' || quiet="-q"
# define these as variables so we can override them at runtime
POSH_IMAGE=${image}
@ -179,6 +179,8 @@ in
# TODO parse the beginning of the command for POSH_* overrides
fi
test "$@" && cmd=( -c "$@")
HOME_CONTAINERS_CONFIGDIR="$HOME/.config/containers"
HOME_POLICY_JSON="$HOME_CONTAINERS_CONFIGDIR/policy.json"
test -d $HOME_CONTAINERS_CONFIGIDR || mkdir $HOME_CONTAINERS_CONFIGIDR
@ -188,7 +190,8 @@ in
${global_args} run --rm -i $tty $ssh -v ~/:/root -w /root --network host --pull=''${POSH_PULL} \
--conmon ${pkgs.conmon}/bin/conmon --runtime ${pkgs.runc}/bin/runc \
--config ${podmanConfig} \
${run_args} ''${POSH_IMAGE} $@
${run_args} \
''${POSH_IMAGE} /usr/bin/env bash -l "''${cmd[@]}"
'')
.overrideAttrs(attrs: attrs // {
passthru = {