|
| 1 | +#!/usr/bin/env bash |
| 2 | +# jetbrains installer. |
| 3 | +# |
| 4 | +# How the Coder JetBrains flow works: the workspace is headless. Clicking the |
| 5 | +# IDE button in the Coder UI opens a `jetbrains-gateway://` URL that the |
| 6 | +# user's *local* Toolbox/Gateway handles; Gateway then SSHes into the |
| 7 | +# workspace and runs remote-dev-server.sh, which downloads the IDE backend |
| 8 | +# (IntelliJ IDEA, PyCharm, CLion, WebStorm, GoLand, RubyMine, PhpStorm, |
| 9 | +# Rider, DataGrip) on-demand into $HOME. Toolbox itself never runs on the |
| 10 | +# workspace. Nothing to install in the image — this script only declares the |
| 11 | +# HOME paths the remote-dev backend writes, so Gateway doesn't redownload |
| 12 | +# hundreds of MB and users don't lose settings, plugins, and project indexes |
| 13 | +# on every restart. |
| 14 | +# |
| 15 | +# JetBrains' remote-dev backend follows the XDG scheme on Linux with a |
| 16 | +# RemoteDev-<Code> subdir per IDE flavor (PS = PhpStorm, PY = PyCharm, IU = |
| 17 | +# IDEA Ultimate, CL = CLion, ...) under these three roots: |
| 18 | +# |
| 19 | +# ~/.cache/JetBrains/ — RemoteDev/dist/<build>/ (downloaded backend), |
| 20 | +# RemoteDev-<Code>/ system caches, indexes, |
| 21 | +# LocalHistory, log |
| 22 | +# ~/.config/JetBrains/ — RemoteDev-<Code>/ IDE settings, keymaps, |
| 23 | +# schemes, options, workspace, .lock |
| 24 | +# ~/.local/share/JetBrains/ — RemoteDev-<Code>/ installed plugins, |
| 25 | +# Daemon, consentOptions |
| 26 | +# |
| 27 | +# Plus the Java Preferences store the IDEs use for JetBrains Account |
| 28 | +# (JetProfile) login, license activation, and non-commercial-license |
| 29 | +# acceptance — skipping this forces re-login + re-accept every restart: |
| 30 | +# |
| 31 | +# ~/.java/.userPrefs/jetbrains/ |
| 32 | +set -e |
| 33 | + |
| 34 | +mkdir -p /etc/home-persist.d |
| 35 | +tee /etc/home-persist.d/jetbrains.json >/dev/null <<'EOF' |
| 36 | +{ |
| 37 | + "source": "jetbrains", |
| 38 | + "paths": [ |
| 39 | + ".cache/JetBrains/", |
| 40 | + ".config/JetBrains/", |
| 41 | + ".local/share/JetBrains/", |
| 42 | + ".java/.userPrefs/jetbrains/" |
| 43 | + ] |
| 44 | +} |
| 45 | +EOF |
0 commit comments