From 237f55187ab49436272cf84030c4f3364b3af057 Mon Sep 17 00:00:00 2001 From: Roxedus Date: Wed, 29 Dec 2021 21:01:59 +0100 Subject: [PATCH] Add helper for mods --- README.md | 1 + readme-vars.yml | 1 + root/usr/local/bin/install-extension | 10 ++++++++++ 3 files changed, 12 insertions(+) create mode 100755 root/usr/local/bin/install-extension diff --git a/README.md b/README.md index 8e181d5..f2d5db4 100644 --- a/README.md +++ b/README.md @@ -266,6 +266,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **29.12.21:** - Add `install-extension` as a helper for mods to install extensions. * **06.12.21:** - Add `DEFAULT_WORKSPACE` env var. * **29.11.21:** - Rebase to Ubuntu focal. * **16.09.21:** - Fix slow `chown` on large workspace (contents of workspace folder no longer chowned). diff --git a/readme-vars.yml b/readme-vars.yml index d2bdcb6..7b86228 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -77,6 +77,7 @@ app_setup_block: | # changelog changelogs: + - { date: "29.12.21:", desc: "Add `install-extension` as a helper for mods to install extensions." } - { date: "06.12.21:", desc: "Add `DEFAULT_WORKSPACE` env var." } - { date: "29.11.21:", desc: "Rebase to Ubuntu focal." } - { date: "16.09.21:", desc: "Fix slow `chown` on large workspace (contents of workspace folder no longer chowned)." } diff --git a/root/usr/local/bin/install-extension b/root/usr/local/bin/install-extension new file mode 100755 index 0000000..16342b9 --- /dev/null +++ b/root/usr/local/bin/install-extension @@ -0,0 +1,10 @@ +#!/usr/bin/with-contenv bash +# shellcheck shell=bash + +_install=(/usr/local/bin/code-server "--extensions-dir" "/config/extensions" "--install-extension") + +if [ "$(whoami)" == "abc" ]; then + "${_install[@]}" "$@" +else + s6-setuidgid abc "${_install[@]}" "$@" +fi