This script (setup-green-tunnel.sh) automates the setup of the Green Tunnel proxy as a Podman container on a Steam Deck, managed as a user-level systemd service. It pulls the Green Tunnel Docker image, configures necessary files, starts the service, and provides instructions for setting up the Steam Deck's HTTP proxy to use Green Tunnel.
-
Pulls the Green Tunnel Image:
- Downloads
docker.io/sadeghhayeri/green-tunnelusing Podman. - Verifies the image is successfully pulled.
- Downloads
-
Creates Directories:
- Sets up
~/.config/containers/systemdand~/.config/systemd/user/podman-user-wait-network-online.service.d.
- Sets up
-
Manages Configuration Files:
- Creates
green-tunnel.containerto define the Green Tunnel service (listens on port 8000). - Creates
override.confto set a 3-second timeout for network-online checks. - If either file exists:
- Skips creation if the content matches the expected configuration.
- Shows differences (
diff -u) and prompts to replace if content differs, defaulting to keeping the existing file.
- Creates
-
Configures Systemd:
- Reloads the user systemd daemon to process the
.containerfile. - Verifies that
green-tunnel.serviceis generated by Podman Quadlet. - Starts the service immediately.
- Reloads the user systemd daemon to process the
-
Configure Steam Deck Proxy:
- Outputs steps to configure the Steam Deck's HTTP Proxy to use Green Tunnel on
127.0.0.1:8000.
- Outputs steps to configure the Steam Deck's HTTP Proxy to use Green Tunnel on
-
Image Pull Fails:
- Ensure internet connectivity and Podman is installed.
- Run
podman pull docker.io/sadeghhayeri/green-tunnelmanually to debug.
-
Service Not Generated:
- Check
~/.config/containers/systemd/green-tunnel.containerfor syntax errors. - Run
systemd-analyze --user --generators=true verify green-tunnel.serviceto analyze generated service. - Run
/usr/lib/systemd/system-generators/podman-system-generator --dryrun --usersee if it shows any errors.
- Check
-
Service Fails to Start:
- Run
systemctl --user status green-tunnel.serviceorjournalctl --user -u green-tunnel.servicefor logs. - Check for port conflicts on
8000(or the port ingreen-tunnel.container) usingss -tuln | grep 8000.
- Run
-
Permission Errors:
- Ensure your user has write permissions to
~/.config/. - Run
chmod -R u+rw ~/.config/if needed.
- Ensure your user has write permissions to
-
Proxy Not Working:
- Verify the service is running (
systemctl --user is-active green-tunnel.service). - Test connectivity with
curl -s --connect-timeout 2 http://localhost:8000. - Ensure the correct port is used in Steam Deck's proxy settings.
- Verify the service is running (
- Podman installed by default in steamdeck.
- Write permissions to
~/.config/for creating directories and files. - Internet access to pull the Docker image.
- A terminal to run the script (e.g., via Desktop Mode or SSH).
-
Download the Script:
- Save
setup-green-tunnel.shto a directory (e.g.,~/green-tunnel/).
- Save
-
Make the Script Executable:
chmod +x setup-green-tunnel.sh
-
Run the Script:
./setup-green-tunnel.sh
- The script will:
- Pull the Green Tunnel image.
- Create necessary directories and files.
- Prompt you to replace existing
green-tunnel.containeroroverride.confif their contents differ (pressyto replace, or Enter/any other key to keep existing, which is the default). - Reload systemd, start the service, and verify it’s running.
- Display Steam Deck proxy configuration instructions.
- The script will:
-
Handle Prompts:
- If
green-tunnel.containeroroverride.confexists with different content, you’ll see adiffoutput and a prompt like:Do you want to replace ~/.config/containers/systemd/green-tunnel.container with the new content? (y/N, default: keep existing):- Press
yto replace, or press Enter (or any other key) to keep the existing file.
- Press
- If
-
Configure Steam Deck Proxy:
- Follow the script’s final instructions:
To use Green Tunnel in Steam Deck's proxy settings: 1. Open Settings on your Steam Deck. 2. Navigate to Internet -> Http Proxy. 3. In the Address field, enter: 127.0.0.1 4. In the Port field, enter: 8000 5. Save the settings to route traffic through Green Tunnel. - Note: If you kept an existing
green-tunnel.containerwith a different port (e.g.,9000), use that port instead of8000.
- Follow the script’s final instructions:
- Idempotency: The script is idempotent, skipping unnecessary actions (e.g., recreating correct files or directories).
- Non-Interactive Use: Prompts require user input. For automation, consider piping input (e.g.,
echo "n" | ./setup-green-tunnel.sh) or modifying the script for a timeout. - Custom Ports: If you keep an existing
green-tunnel.containerwith a different port, update the Steam Deck proxy port accordingly. - Steam Deck Context: This script is tailored for Steam Deck’s user-level systemd environment. Adjust paths or settings for other systems.
For issues or feature requests, please report them in the project repository or contact the maintainer.



