Last active
October 4, 2025 22:58
-
-
Save jakobhviid/d092f61a3adbc03be0a9707f161e9b05 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -euo pipefail | |
| echo "π Detecting architecture..." | |
| ARCH=$(uname -m) | |
| case "$ARCH" in | |
| x86_64) ARCH_NAME="amd64" ;; | |
| aarch64) ARCH_NAME="arm64" ;; | |
| *) echo "β Unsupported architecture: $ARCH"; exit 1 ;; | |
| esac | |
| PODMAN_VERSION="v4.9.0" | |
| URL="https://github.com/containers/podman/releases/download/${PODMAN_VERSION}/podman-remote-static-linux_${ARCH_NAME}.tar.gz" | |
| TMPDIR=$(mktemp -d) | |
| echo "π₯ Downloading podman-remote from: $URL" | |
| curl -sL "$URL" | tar -xz -C "$TMPDIR" | |
| BINARY=$TMPDIR/bin/podman-remote-static-linux_${ARCH_NAME} | |
| if [ ! -f "$BINARY" ]; then | |
| echo "β podman-remote binary not found in archive: $BINARY" | |
| echo "π Archive contents:" | |
| find "$TMPDIR" | |
| exit 1 | |
| fi | |
| echo "π Installing podman-remote wrapper as docker for Flatpak VSCode..." | |
| TARGET_DIR="$HOME/.var/app/com.visualstudio.code/bin" | |
| mkdir -p "$TARGET_DIR" | |
| cp "$BINARY" "$TARGET_DIR/podman-remote" | |
| cat > "$TARGET_DIR/docker" <<EOF | |
| #!/bin/bash | |
| exec "$TARGET_DIR/podman-remote" "\$@" | |
| EOF | |
| chmod +x "$TARGET_DIR/docker" | |
| rm -rf "$TMPDIR" | |
| echo "π¦ Installing Visual Studio Code (Flatpak)..." | |
| flatpak install -y flathub com.visualstudio.code | |
| echo "π§© Configuring Flatpak overrides..." | |
| flatpak override --user --reset com.visualstudio.code | |
| flatpak override --user com.visualstudio.code \ | |
| --filesystem=xdg-run/podman \ | |
| --env=PATH=$HOME/.var/app/com.visualstudio.code/bin:/app/bin:/usr/bin | |
| # β Check for Podman socket (user session) | |
| SOCK_PATH="/run/user/$(id -u)/podman/podman.sock" | |
| echo | |
| echo "π Checking for user Podman socket at:" | |
| echo " $SOCK_PATH" | |
| if [ ! -S "$SOCK_PATH" ]; then | |
| echo | |
| echo "β οΈ Required Podman socket not found at:" | |
| echo " $SOCK_PATH" | |
| echo | |
| echo "π‘ To enable it, run this in your terminal:" | |
| echo " systemctl --user enable --now podman.socket" | |
| echo | |
| echo "β This does not require root or layering." | |
| else | |
| echo "β Podman socket is available." | |
| fi | |
| echo | |
| echo "β Setup complete." | |
| echo "βΆ Launch VSCode: flatpak run com.visualstudio.code" | |
| echo "βΆ Install the Docker extension in VSCode." | |
| echo "βΆ Then open settings.json and paste the following:" | |
| cat <<'EOF' | |
| { | |
| "docker.host": "unix:///run/user/1000/podman/podman.sock", | |
| "terminal.integrated.defaultProfile.linux": "host-bash", | |
| "terminal.integrated.profiles.linux": { | |
| "host-bash": { | |
| "path": "host-spawn", | |
| "args": ["bash"] | |
| } | |
| } | |
| } | |
| EOF | |
| echo "π§ͺ Verify with: docker version && docker ps" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment