Skip to content

Commit

Permalink
feat: update quadlet to pass socket in, add additional documentaiton (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jeefy authored Nov 13, 2023
1 parent 8eb36ad commit 5f3b17e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 14 deletions.
24 changes: 21 additions & 3 deletions just/custom.just
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
28 changes: 17 additions & 11 deletions usr/share/ublue-os/quadlets/podmansh.container
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
RequiredBy=default.target

0 comments on commit 5f3b17e

Please sign in to comment.