├── .github └── workflows │ └── ci.yml ├── .gitignore ├── LICENSE ├── README.md ├── first_run.txt ├── meson.build ├── meson_options.txt ├── sdk_update.txt └── vscode.sh /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: master 6 | pull_request: 7 | branches: master 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | permissions: 13 | contents: read 14 | actions: write 15 | container: 16 | image: freedesktopsdk/sdk:24.08-x86_64 17 | 18 | steps: 19 | - uses: actions/checkout@v4 20 | 21 | - name: Build and install 22 | env: 23 | FLATPAK_ID: com.example.DummyEditor 24 | run: | 25 | set -e 26 | meson \ 27 | --prefix=$(pwd)/ide-wrapper-build \ 28 | -Deditor_binary=/bin/echo \ 29 | -Deditor_args='["--some-option"]' \ 30 | -Deditor_title='Test dummy editor' \ 31 | -Dprogram_name=dummy-editor \ 32 | -Dflagfile_prefix=dummy \ 33 | build 34 | ninja -C build 35 | ninja -C build install 36 | 37 | - uses: actions/upload-artifact@v4 38 | with: 39 | name: ide-wrapper-build 40 | path: ide-wrapper-build 41 | 42 | - name: Install shellcheck 43 | run: | 44 | set -e -o pipefail 45 | shopt -s failglob 46 | shellcheck_tarball="shellcheck.tar.xz" 47 | shellcheck_url=$(curl -sL https://api.github.com/repos/koalaman/shellcheck/releases/latest | \ 48 | jq -r '.assets | map(select(.name | endswith("linux.x86_64.tar.xz"))) | first | .browser_download_url') 49 | curl -sL -o "$shellcheck_tarball" "$shellcheck_url" 50 | tar -xJf "$shellcheck_tarball" 51 | install -Dm755 shellcheck-*/shellcheck /usr/local/bin/shellcheck 52 | 53 | - name: Run shellcheck 54 | run: | 55 | shellcheck --severity=style ide-wrapper-build/bin/dummy-editor 56 | 57 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Flathub VSCode maintainers 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Flatpak editor wrapper 2 | 3 | This wrapper sets up development environment before launching the editor inside flatpak sandbox. 4 | 5 | Current functions: 6 | 7 | * Show up a readme on first launch 8 | * Show up a notice after SDK update 9 | * Enable installed SDK extensions (from `/usr/lib/sdk`) 10 | * `FLATPAK_ENABLE_SDK_EXT` must be set to a comma-separated list or `*` 11 | * Enable installed development tools (from `/app/tools`) 12 | * Isolate npm/pip/cargo/etc packages from host environment 13 | 14 | ## Usage 15 | 16 | Usage of this module consists of: 17 | 18 | 1. Sourcing this repository as a git submodule or using flatpak-builder's built-in git source. 19 | 1. Creating a module in your flatpak's build file that specifies the options you want to use. 20 | 1. Overwriting your flatpak's entry points to run the wrapper instead of the actual program's 21 | executable. This must be done on the "command" key of your build file as well as on the 22 | ".desktop" file of your upstream. 23 | 24 | Some aspects of this module's behaviour may be changed using environment variables, see the full listing in the "Environment Variables" section below. 25 | 26 | ### Sourcing this Repository 27 | 28 | To use this repository as a git submodule, you may clone it inside of your flatpak's build directory 29 | with the command: 30 | 31 | ``` 32 | git submodule add https://github.com/flathub/ide-flatpak-wrapper.git 33 | ``` 34 | 35 | Then, you will bring it into your build file using flatpak-builder's "dir" source. Example: 36 | 37 | ```yaml 38 | - name: ide-flatpak-wrapper 39 | buildsystem: meson 40 | config-opts: 41 | # your config opts (more on this later) 42 | sources: 43 | - type: dir 44 | path: ide-flatpak-wrapper 45 | ``` 46 | 47 | If you prefer, you may use the git source instead. Exemple: 48 | 49 | ```yaml 50 | - name: ide-flatpak-wrapper 51 | buildsystem: meson 52 | config-opts: 53 | # your config opts (more on this later) 54 | sources: 55 | - type: git 56 | url: https://github.com/flathub/ide-flatpak-wrapper.git 57 | branch: master 58 | ``` 59 | 60 | ### Specifying Config Options 61 | 62 | For this module to work properly, we must specify a minimum of 2 options - the path to your editor's 63 | binary and a name to install the wrapper under: 64 | 65 | ```yaml 66 | - name: ide-flatpak-wrapper 67 | buildsystem: meson 68 | config-opts: 69 | # Path to the editor executable 70 | - -Deditor_binary=/app/main/bin/code-oss 71 | # Install wrapper under this name (must be different from the above) 72 | - -Dprogram_name=code-oss-wrapper 73 | sources: 74 | # your source choice 75 | ``` 76 | 77 | Additionally, you may specify the following options: 78 | 79 | * `-Deditor_args` Command line args to append to the editor executable. 80 | * `-Deditor_title` Human readable title of the editor. This will be interpolated into the "first run template" 81 | file (more on this file later). 82 | * `-Dfirst_run_template` Name of the file that will be opened on your editor's first run. 83 | * `-Dsdk_update_template` Name of the file that will be opened when your flatpak updates its SDK. This can be 84 | used to inform the user that the SDK extensions they were using before must be updated as well. 85 | * `-Dflagfile_prefix` An arbitrary string prepended to `-first-run` and `-sdk-update-` files names that indicate 86 | that we already did show the corresponding readme. 87 | * `-Ddefault_loglevel` The default loglevel. May be overwritten by user with FLATPAK_IDE_LOGLEVEL environment variable. 88 | 89 | ### Overwriting the Flatpak's Entry Points 90 | 91 | Now that you have your wrapper configured, you must ensure **it** is executed instead of your actual editor's 92 | binary. Typically your flatpak will have two entry points: the `command` key of your build file which is used 93 | when the flatpak is executed using the `flatpak run` command and the desktop file which is used when the user 94 | clicks on your editor's icon from their desktop environment. If the desktop file comes from upstream you will 95 | need to patch the `Exec` line to call the wrapper. 96 | 97 | ### First Run and SDK Update Templates 98 | 99 | To inform your user of the particulars of flatpaks, you can include a first run template and an SDK update template 100 | which will be run once after each of those events. You must include those files in the `sources` section of the 101 | module: 102 | 103 | ```yaml 104 | - name: ide-flatpak-wrapper 105 | buildsystem: meson 106 | config-opts: 107 | # your options 108 | sources: 109 | # your source choice 110 | - type: file 111 | path: ide-first-run.txt 112 | - type: file 113 | path: sdk-update.txt 114 | ``` 115 | 116 | Those template files have string interpolation for the `EDITOR_TITLE` and `FLATPAK_ID` using the `@` symbol. 117 | For example, using an editor title of "VS Code" and a flatpak ID of "com.visualstudio.code" the template file 118 | would go from this: 119 | 120 | ``` 121 | ------------------------------------------------------------------------------------ 122 | | Warning: You are running an unofficial Flatpak version of @EDITOR_TITLE@ !!! | 123 | ------------------------------------------------------------------------------------ 124 | 125 | Please open issues under: https://github.com/flathub/@FLATPAK_ID@/issues 126 | ``` 127 | 128 | To this: 129 | 130 | ``` 131 | ------------------------------------------------------------------------------------ 132 | | Warning: You are running an unofficial Flatpak version of VS Code !!! | 133 | ------------------------------------------------------------------------------------ 134 | 135 | Please open issues under: https://github.com/flathub/com.visualstudio.code/issues 136 | ``` 137 | 138 | ## Environment Variables 139 | 140 | You may use the following environment variables to change the behaviour of the ide-flatpak-wrapper: 141 | 142 | * `FLATPAK_IDE_LOGLEVEL` (= `1`) 143 | 144 | Controls verbosity of the module, `0` supresses all module-originated outputs to stdout. 145 | 146 | * Type: Number (`0` | `1`) 147 | 148 | * `FLATPAK_PREFER_USER_PACKAGES` (= `0`) 149 | 150 | * `FLATPAK_ISOLATE_PACKAGES` (= `1`) 151 | 152 | * `FLATPAK_ISOLATE_NPM` (= `FLATPAK_ISOLATE_PACKAGES`) 153 | 154 | * `FLATPAK_PREFER_USER_NPM` (= `FLATPAK_PREFER_USER_PACKAGES`) 155 | 156 | * `FLATPAK_ISOLATE_CARGO` (= `FLATPAK_ISOLATE_PACKAGES`) 157 | 158 | * `FLATPAK_PREFER_USER_CARGO` (= `FLATPAK_PREFER_USER_PACKAGES`) 159 | 160 | * `FLATPAK_ISOLATE_PIP` (= `FLATPAK_ISOLATE_PACKAGES`) 161 | 162 | * `FLATPAK_PREFER_USER_PIP` (= `FLATPAK_PREFER_USER_PACKAGES`) 163 | -------------------------------------------------------------------------------- /first_run.txt: -------------------------------------------------------------------------------- 1 | 2 | https://www.flathub.org 3 | 4 | ------------------------------------------------------------------------------------ 5 | | Warning: You are running an unofficial Flatpak version of @EDITOR_TITLE@ !!! | 6 | ------------------------------------------------------------------------------------ 7 | 8 | Please open issues under: https://github.com/flathub/@FLATPAK_ID@/issues 9 | 10 | 11 | This version is running inside a container and is therefore not able 12 | to access SDKs on your host system! 13 | 14 | To execute commands on the host system, run inside the sandbox: 15 | 16 | $ flatpak-spawn --host 17 | 18 | To make the Integrated Terminal automatically use the host system's shell, 19 | you can add this to the settings: 20 | 21 | { 22 | "terminal.integrated.profiles.linux": { 23 | "host-bash": { 24 | "path": "/usr/bin/flatpak-spawn", 25 | "args": ["--host", "--env=TERM=xterm-256color", "bash"] 26 | } 27 | }, 28 | "terminal.integrated.defaultProfile.linux": "host-bash" 29 | } 30 | 31 | This flatpak provides a standard development environment (gcc, python, etc). 32 | To see what's available: 33 | 34 | $ flatpak run --command=sh @FLATPAK_ID@ 35 | $ ls /usr/bin (shared runtime) 36 | $ ls /app/bin (bundled with this flatpak) 37 | 38 | To get support for additional languages, you have to install SDK extensions, e.g. 39 | 40 | $ flatpak install flathub org.freedesktop.Sdk.Extension.dotnet 41 | $ flatpak install flathub org.freedesktop.Sdk.Extension.golang 42 | 43 | To enable selected extensions, set FLATPAK_ENABLE_SDK_EXT environment variable 44 | to a comma-separated list of extension names (name is ID portion after the last dot): 45 | 46 | $ FLATPAK_ENABLE_SDK_EXT=dotnet,golang flatpak run @FLATPAK_ID@ 47 | 48 | To make this persistent, set the variable via flatpak override: 49 | 50 | $ flatpak override --user @FLATPAK_ID@ --env=FLATPAK_ENABLE_SDK_EXT="dotnet,golang" 51 | 52 | You can use 53 | 54 | $ flatpak search 55 | 56 | to find others. 57 | -------------------------------------------------------------------------------- /meson.build: -------------------------------------------------------------------------------- 1 | project('ide-flatpak-wrapper') 2 | 3 | bash = find_program('bash') 4 | pymod = import('python') 5 | python = pymod.find_installation('python3') 6 | fs = import('fs') 7 | 8 | editor = find_program(get_option('editor_binary'), required: false) 9 | if editor.found() 10 | editor_path = editor.path() 11 | else 12 | editor_path = get_option('editor_binary') 13 | if editor_path == '' 14 | error('Editor binary path is empty') 15 | endif 16 | endif 17 | message('Using @0@ as editor binary'.format(editor_path)) 18 | 19 | if get_option('flatpak_id') == '' 20 | flatpak_id = run_command('sh', '-c', 'echo $FLATPAK_ID', check: true).stdout().strip() 21 | else 22 | flatpak_id = get_option('flatpak_id') 23 | endif 24 | datadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name()) 25 | 26 | if get_option('sdk_version') == '' 27 | sdk_version_cmd = run_command('sh', '-c', '. /etc/os-release && echo $VERSION_ID', check: true) 28 | sdk_version_arr = sdk_version_cmd.stdout().strip().split('.') 29 | sdk_version = '.'.join([sdk_version_arr[0], sdk_version_arr[1]]) 30 | else 31 | sdk_version = get_option('sdk_version') 32 | endif 33 | 34 | editor_args = [] 35 | foreach arg : get_option('editor_args') 36 | editor_args += '"@0@"'.format(arg) 37 | endforeach 38 | 39 | first_run_template = files(get_option('first_run_template')) 40 | sdk_update_template = files(get_option('sdk_update_template')) 41 | first_run_filename = fs.name(get_option('first_run_template')) 42 | sdk_update_filename = fs.name(get_option('sdk_update_template')) 43 | 44 | wrapper_data = configuration_data({ 45 | 'BASH': bash.path(), 46 | 'EDITOR_BINARY': editor_path, 47 | 'EDITOR_ARGS': ' '.join(editor_args), 48 | 'EDITOR_TITLE': get_option('editor_title'), 49 | 'FIRST_RUN_README': join_paths(datadir, first_run_filename), 50 | 'SDK_UPDATE_README': join_paths(datadir, sdk_update_filename), 51 | 'FLAGFILE_PREFIX': get_option('flagfile_prefix'), 52 | 'SDK_VERSION': sdk_version, 53 | 'PROGRAM_NAME': get_option('program_name'), 54 | 'PYTHON_VERSION': python.language_version(), 55 | 'DEFAULT_LOGLEVEL': get_option('default_loglevel'), 56 | }) 57 | 58 | readme_data = configuration_data({ 59 | 'FLATPAK_ID': flatpak_id, 60 | 'EDITOR_TITLE': get_option('editor_title'), 61 | 'SDK_VERSION': sdk_version 62 | }) 63 | 64 | configure_file(input: 'vscode.sh', 65 | output: get_option('program_name'), 66 | configuration: wrapper_data, 67 | install_dir: get_option('bindir'), 68 | install_mode: 'rwxr-xr-x') 69 | 70 | configure_file(input: first_run_template, 71 | output: first_run_filename, 72 | configuration: readme_data, 73 | install_dir: datadir) 74 | 75 | configure_file(input: sdk_update_template, 76 | output: sdk_update_filename, 77 | configuration: readme_data, 78 | install_dir: datadir) 79 | -------------------------------------------------------------------------------- /meson_options.txt: -------------------------------------------------------------------------------- 1 | option('editor_binary', type: 'string') 2 | option('editor_args', type: 'array', value: []) 3 | option('editor_title', type: 'string', value: 'Visual Studio Code') 4 | option('program_name', type: 'string', value: 'code') 5 | option('flatpak_id', type: 'string') 6 | option('sdk_version', type: 'string') 7 | option('first_run_template', type: 'string', value: 'first_run.txt') 8 | option('sdk_update_template', type: 'string', value: 'sdk_update.txt') 9 | option('flagfile_prefix', type: 'string', value: 'flatpak-vscode') 10 | option('default_loglevel', type: 'string', value: '1') 11 | -------------------------------------------------------------------------------- /sdk_update.txt: -------------------------------------------------------------------------------- 1 | https://www.flathub.org 2 | 3 | --------------------------------------- 4 | | Warning: SDK was updated to @SDK_VERSION@ ! | 5 | --------------------------------------- 6 | 7 | @EDITOR_TITLE@ flatpak platform was updated to a new major version. 8 | 9 | You may need to 10 | - Install updated SDK extensions for matching version (e.g. `org.freedesktop.Sdk.Extension.node10//@SDK_VERSION@`) 11 | - Reinstall PyPI, CPAN and RubyGems packages (due to interpreter major version change) 12 | - Rebuild your projects and their dependencies (due to ABI incompatibility between SDK versions) 13 | -------------------------------------------------------------------------------- /vscode.sh: -------------------------------------------------------------------------------- 1 | #!@BASH@ 2 | # shellcheck shell=bash 3 | 4 | set -e 5 | shopt -s nullglob 6 | 7 | FIRST_RUN="${XDG_CONFIG_HOME}/@FLAGFILE_PREFIX@-first-run" 8 | SDK_UPDATE="${XDG_CONFIG_HOME}/@FLAGFILE_PREFIX@-sdk-update-@SDK_VERSION@" 9 | FLATPAK_IDE_LOGLEVEL="${FLATPAK_IDE_LOGLEVEL:-@DEFAULT_LOGLEVEL@}" 10 | 11 | function msg() { 12 | if [ "${FLATPAK_IDE_LOGLEVEL}" -ne 0 ]; then 13 | echo "@PROGRAM_NAME@-wrapper: $*" >&2 14 | fi 15 | } 16 | 17 | function exec_vscode() { 18 | exec "@EDITOR_BINARY@" @EDITOR_ARGS@ "$@" 19 | } 20 | 21 | if [ -n "${FLATPAK_IDE_ENV}" ]; then 22 | msg "Environment is already set up" 23 | exec_vscode "$@" 24 | fi 25 | 26 | declare -A PATH_SUBDIRS 27 | PATH_SUBDIRS[PATH]="bin" 28 | PATH_SUBDIRS[PYTHONPATH]="lib/python@PYTHON_VERSION@/site-packages" 29 | PATH_SUBDIRS[PKG_CONFIG_PATH]="lib/pkgconfig" 30 | PATH_SUBDIRS[GI_TYPELIB_PATH]="lib/girepository-1.0" 31 | 32 | function export_path_vars() { 33 | base_dir="$1" 34 | for var_name in "${!PATH_SUBDIRS[@]}"; do 35 | abs_dir="$base_dir/${PATH_SUBDIRS[$var_name]}" 36 | if [ -d "$abs_dir" ]; then 37 | msg "Adding $abs_dir to $var_name" 38 | if [ -z "${!var_name}" ]; then 39 | export "$var_name"="$abs_dir" 40 | else 41 | export "$var_name"="${!var_name}:$abs_dir" 42 | fi 43 | fi 44 | done 45 | } 46 | 47 | for tool_dir in /app/tools/*; do 48 | export_path_vars "$tool_dir" 49 | done 50 | 51 | if [ "$FLATPAK_ENABLE_SDK_EXT" = "*" ]; then 52 | SDK=() 53 | for d in /usr/lib/sdk/*; do 54 | SDK+=("${d##*/}") 55 | done 56 | else 57 | IFS=',' read -ra SDK <<< "$FLATPAK_ENABLE_SDK_EXT" 58 | fi 59 | 60 | for i in "${SDK[@]}"; do 61 | sdk_ext_dir="/usr/lib/sdk/$i" 62 | if [[ -d "$sdk_ext_dir" ]]; then 63 | if [[ -z "$FLATPAK_SDK_EXT_NO_SCRIPTS" && \ 64 | -f "$sdk_ext_dir/enable.sh" ]]; then 65 | msg "Evaluating $sdk_ext_dir/enable.sh" 66 | # shellcheck source=/dev/null 67 | . "$sdk_ext_dir/enable.sh" 68 | else 69 | export_path_vars "$sdk_ext_dir" 70 | fi 71 | else 72 | msg "Requested SDK extension \"$i\" is not installed" 73 | fi 74 | done 75 | 76 | # Create /etc/shells and add shells from extensions 77 | if [ ! -f /etc/shells ]; then 78 | printf '/usr/bin/%s\n' sh bash > /etc/shells 79 | for ext_etc_shells in /app/tools/*/etc/shells; do 80 | cat >> /etc/shells < "$ext_etc_shells" 81 | done 82 | fi 83 | 84 | FLATPAK_PREFER_USER_PACKAGES="${FLATPAK_PREFER_USER_PACKAGES:-0}" 85 | FLATPAK_ISOLATE_PACKAGES="${FLATPAK_ISOLATE_PACKAGES:-1}" 86 | FLATPAK_ISOLATE_NPM="${FLATPAK_ISOLATE_NPM:-${FLATPAK_ISOLATE_PACKAGES}}" 87 | FLATPAK_PREFER_USER_NPM="${FLATPAK_PREFER_USER_NPM:-${FLATPAK_PREFER_USER_PACKAGES}}" 88 | FLATPAK_ISOLATE_CARGO="${FLATPAK_ISOLATE_CARGO:-${FLATPAK_ISOLATE_PACKAGES}}" 89 | FLATPAK_PREFER_USER_CARGO="${FLATPAK_PREFER_USER_CARGO:-${FLATPAK_PREFER_USER_PACKAGES}}" 90 | FLATPAK_ISOLATE_PIP="${FLATPAK_ISOLATE_PIP:-${FLATPAK_ISOLATE_PACKAGES}}" 91 | FLATPAK_PREFER_USER_PIP="${FLATPAK_PREFER_USER_PIP:-${FLATPAK_PREFER_USER_PACKAGES}}" 92 | FLATPAK_ISOLATE_GEM="${FLATPAK_ISOLATE_GEM:-${FLATPAK_ISOLATE_PACKAGES}}" 93 | FLATPAK_PREFER_USER_GEM="${FLATPAK_PREFER_USER_GEM:-${FLATPAK_PREFER_USER_PACKAGES}}" 94 | 95 | if [ "${FLATPAK_ISOLATE_NPM}" -ne 0 ]; then 96 | msg "Setting up NPM packages" 97 | export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npmrc" 98 | if [ ! -f "$NPM_CONFIG_USERCONFIG" ]; then 99 | cat < "$NPM_CONFIG_USERCONFIG" 100 | prefix=\${XDG_DATA_HOME}/node 101 | init-module=\${XDG_CONFIG_HOME}/npm-init.js 102 | tmp=\${XDG_CACHE_HOME}/tmp 103 | EOF_NPM_CONFIG 104 | fi 105 | if [ "$FLATPAK_PREFER_USER_NPM" -ne 0 ]; then 106 | export PATH="$XDG_DATA_HOME/node/bin:$PATH" 107 | else 108 | export PATH="$PATH:$XDG_DATA_HOME/node/bin" 109 | fi 110 | fi 111 | 112 | if [ "${FLATPAK_ISOLATE_CARGO}" -ne 0 ] ; then 113 | msg "Setting up Cargo packages" 114 | export CARGO_INSTALL_ROOT="$XDG_DATA_HOME/cargo" 115 | export CARGO_HOME="$CARGO_INSTALL_ROOT" 116 | if [ "$FLATPAK_PREFER_USER_CARGO" -ne 0 ]; then 117 | export PATH="$CARGO_INSTALL_ROOT/bin:$PATH" 118 | else 119 | export PATH="$PATH:$CARGO_INSTALL_ROOT/bin" 120 | fi 121 | fi 122 | 123 | if [ "${FLATPAK_ISOLATE_PIP}" -ne 0 ]; then 124 | msg "Setting up Python packages" 125 | export PYTHONUSERBASE="$XDG_DATA_HOME/python" 126 | if [ "$FLATPAK_PREFER_USER_PIP" -ne 0 ]; then 127 | export PATH="$PYTHONUSERBASE/bin:$PATH" 128 | else 129 | export PATH="$PATH:$PYTHONUSERBASE/bin" 130 | fi 131 | fi 132 | 133 | if [ "${FLATPAK_ISOLATE_GEM}" -ne 0 ]; then 134 | msg "Setting up Ruby packages" 135 | GEM_USER_INSTALL="$(ruby <<<'puts Gem.user_dir')" 136 | if [ "$FLATPAK_PREFER_USER_GEM" -ne 0 ]; then 137 | export PATH="$GEM_USER_INSTALL/bin:$PATH" 138 | else 139 | export PATH="$PATH:$GEM_USER_INSTALL/bin" 140 | fi 141 | fi 142 | 143 | export FLATPAK_IDE_ENV=1 144 | 145 | if [ ! -f "${FIRST_RUN}" ]; then 146 | touch "${FIRST_RUN}" 147 | touch "${SDK_UPDATE}" 148 | exec_vscode "$@" "@FIRST_RUN_README@" 149 | elif [ ! -f "${SDK_UPDATE}" ]; then 150 | touch "${SDK_UPDATE}" 151 | exec_vscode "$@" "@SDK_UPDATE_README@" 152 | else 153 | exec_vscode "$@" 154 | fi 155 | --------------------------------------------------------------------------------