From 758d4c74909b777f92b3a3df186e125383d041df Mon Sep 17 00:00:00 2001 From: Jeffrey Sica Date: Mon, 13 Nov 2023 16:59:01 +0000 Subject: [PATCH] feat: update quadlet to pass socket in, add additional documentation --- just/custom.just | 24 ++++++++++++++-- .../ublue-os/quadlets/podmansh.container | 28 +++++++++++-------- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/just/custom.just b/just/custom.just index 5192c70c5f7..c4a34318c9d 100644 --- a/just/custom.just +++ b/just/custom.just @@ -174,14 +174,32 @@ podmansh: sudo cp /usr/share/ublue-os/quadlets/podmansh.container /etc/containers/systemd/users/${UID}/podmansh.container sudo usermod $USER --shell /usr/bin/podmansh printf "${USER}'s shell is now %s." "$(cat /etc/passwd | grep ":$UID:" | cut '-d:' '-f7')" + systemctl --user start podman.socket + loginctl enable-linger $(whoami) + podman pull ghcr.io/ublue-os/ubuntu-toolbox:latest systemctl --user daemon-reload systemctl --user stop podmansh.service systemctl --user start podmansh.service - echo "Shell now switched to podmansh. Spawn a new terminal to get going!" - echo "By default, the shell will be Bash. To override it, create ~/.profile with your preferred shell" - echo "Note: That shell must exist in the toolbox!" + + @echo "Shell now switched to podmansh. Spawn a new terminal to get going!" + @echo "By default, the shell will be Bash. To override it, create ~/.profile with your preferred shell" + @echo "Note: That shell must exist in the toolbox!" + @echo "To ensure a smooth experience within VSCode, please add the following to your settings.json:" + @echo "---" + @echo "\"terminal.integrated.profiles.linux\": {" + @echo " \"podmansh zsh\": {" + @echo " \"path\": \"podmansh\"," + @echo " \"args\": [\"-c\", \"cd \${workspaceFolder}; exec zsh\"]" + @echo " }" + @echo "}" + @echo "---" + @echo "Please make sure you have the following environment variable set WITHIN the container:" + @echo "---" + @echo "export DOCKER_HOST=unix:///var/run/podman/podman.sock" + @echo "---" + @echo "Happy Podmansh'ing!" # Switch podmansh to another image (EXPERIMENTAL) podmansh-switch IMAGE: diff --git a/usr/share/ublue-os/quadlets/podmansh.container b/usr/share/ublue-os/quadlets/podmansh.container index 70bb81152bc..ef201de8b8b 100644 --- a/usr/share/ublue-os/quadlets/podmansh.container +++ b/usr/share/ublue-os/quadlets/podmansh.container @@ -2,6 +2,14 @@ Description=The Podmansh container After=local-fs.target +[Service] +# Restart service when sleep finishes +Restart=always +# Extend Timeout to allow time to pull the image +TimeoutStartSec=900 +# Ensure there's a userland podman.sock +ExecStartPre=/bin/systemctl --user enable podman.socket + [Container] Image=ghcr.io/ublue-os/ubuntu-toolbox:latest ContainerName=podmansh @@ -13,35 +21,33 @@ NoNewPrivileges=no Exec=sleep infinity WorkingDir=%h -Volume=%h:%h +Volume=/var/home:/var/home +Volume=/var/home/linuxbrew:/home/linuxbrew Volume=/:/run/host:rslave Volume=/dev:/dev:rslave Volume=/sys:/sys:rslave Volume=/tmp:/tmp:rslave -Volume=/etc/passwd:/etc/passwd:rslave -Volume=/etc/passwd-:/etc/passwd-:rslave -Volume=/etc/group:/etc/group:rslave -Volume=/etc/group-:/etc/group-:rslave -Volume=/tmp:/tmp:rslave Volume=/sys/fs/selinux Volume=/etc/selinux:/etc/selinux:rslave Volume=/var/log/journal Volume=/run/user/%U:/run/user/%U:rslave -Volume=/etc/hosts:/etc/hosts:ro -Volume=/etc/resolv.conf:/etc/resolv.conf:ro +Volume=/etc/hosts:/etc/hosts +Volume=/etc/resolv.conf:/etc/resolv.conf +Volume=/run/user/1000/podman/podman.sock:/var/run/podman/podman.sock Environment=ENV=%h/.profile PodmanArgs=--env-host PodmanArgs=--privileged PodmanArgs=--mount=type=devpts,destination=/dev/pts -PodmanArgs=--userns=host +PodmanArgs=--userns=keep-id +PodmanArgs=--group-add=keep-groups PodmanArgs=--ulimit=host PodmanArgs=--security-opt=label=disable -PodmanArgs=--cgroupns=private +PodmanArgs=--cgroupns=host PodmanArgs=--log-level=debug Annotation=run.oci.keep_original_groups=1 [Install] -RequiredBy=default.target \ No newline at end of file +RequiredBy=default.target