Clean up the autoshell and make it faster on subsequent runs.

This commit is contained in:
Hans Goor 2024-09-01 20:48:31 +02:00
parent 7afdee985f
commit dbda6c03d9
Signed by: eyedevelop
SSH key fingerprint: SHA256:Td89veptDEwCV8J3fjqnknNk7SbwzedYhauyC2nFBYg
2 changed files with 7 additions and 6 deletions

View file

@ -68,7 +68,7 @@ enter_toolbox() {
create_toolbox
fi
podman exec -it "${TOOLBX_NAME}" "/autoshell.sh" "${SHELL}"
podman exec -it --env=_REAL_USER="${USER}" "${TOOLBX_NAME}" "/autoshell.sh" "${SHELL}"
}
print_usage() {
@ -80,13 +80,11 @@ print_usage() {
echo " -i|--image -- The image to use to create the toolbox with."
echo " -p|--privileged -- Whether the toolbox is privileged or not."
echo " delete -- Delete the current toolbox."
echo
echo "If no command is specified, enter is assumed."
}
if [[ "$#" -lt 1 ]]; then
print_usage
return 1
exit 1
fi
while [[ "$#" -ge 1 ]]; do

View file

@ -9,7 +9,7 @@ install_shell() {
case "${ID}" in
debian)
apt-get -y update && apt-get -y install "$(apt-file update &>/dev/null && apt-file search -l "${REAL_SHELL}" | head -n1 )"
apt-get -y update && apt-get -y install "$(apt-file update &>/dev/null && apt-file search -lF "${REAL_SHELL}" | head -n1 )"
;;
*)
@ -26,5 +26,8 @@ start_shell() {
fi
}
install_shell >/dev/null || true
if ! command -v "${REAL_SHELL}" &>/dev/null; then
install_shell >/dev/null || true
fi
start_shell "$@"