Skip to content

Commit 9d2960e

Browse files
committed
feat: add feature-installer feature.
1 parent 2793a58 commit 9d2960e

File tree

4 files changed

+79
-0
lines changed

4 files changed

+79
-0
lines changed

.github/workflows/test.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
- bun.sh
2020
- chezmoi.io
2121
- deno.com
22+
- feature-installer
2223
- nixos.org
2324
- pkgx.sh
2425
- smallstep.com
@@ -51,6 +52,7 @@ jobs:
5152
- bun.sh
5253
- chezmoi.io
5354
- deno.com
55+
- feature-installer
5456
- nixos.org
5557
- pkgx.sh
5658
- smallstep.com

src/feature-installer/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
# feature-installer
3+
4+
Install "feature-installer" binary
5+
6+
## Example Usage
7+
8+
```json
9+
"features": {
10+
"ghcr.io/devcontainer-community/devcontainer-features/feature-installer:0.0.1": {}
11+
}
12+
```
13+
14+
## Options
15+
16+
| Options Id | Description | Type | Default Value |
17+
|-----|-----|-----|-----|
18+
| version | Version of "feature-installer" to install. | string | latest |
19+
20+
21+
22+
---
23+
24+
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainer-community/devcontainer-features/blob/main/src/feature-installer/devcontainer-feature.json). Add additional notes to a `NOTES.md`._
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "feature-installer",
3+
"id": "feature-installer",
4+
"version": "0.0.1",
5+
"description": "Install \"feature-installer\" binary",
6+
"documentationURL": "https://github.com/devcontainer-community/devcontainer-features/tree/main/src/feature-installer",
7+
"options": {
8+
"version": {
9+
"type": "string",
10+
"default": "latest",
11+
"proposals": [
12+
"latest"
13+
],
14+
"description": "Version of \"feature-installer\" to install."
15+
}
16+
}
17+
}

src/feature-installer/install.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
set -o errexit
3+
set -o pipefail
4+
set -o noclobber
5+
set -o nounset
6+
set -o allexport
7+
readonly name="feature-installer"
8+
apt_get_update() {
9+
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
10+
echo "Running apt-get update..."
11+
apt-get update -y
12+
fi
13+
}
14+
apt_get_checkinstall() {
15+
if ! dpkg -s "$@" >/dev/null 2>&1; then
16+
apt_get_update
17+
DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends --no-install-suggests --option 'Debug::pkgProblemResolver=true' --option 'Debug::pkgAcquire::Worker=1' "$@"
18+
fi
19+
}
20+
apt_get_cleanup() {
21+
apt-get clean
22+
rm -rf /var/lib/apt/lists/*
23+
}
24+
echo_banner() {
25+
local text="$1"
26+
echo -e "\e[1m\e[97m\e[41m$text\e[0m"
27+
}
28+
install() {
29+
apt_get_checkinstall curl ca-certificates
30+
su $_REMOTE_USER -c "curl -fsSL http://raw.githubusercontent.com/devcontainer-community/feature-installer/refs/heads/main/scripts/install.sh | sh"
31+
apt_get_cleanup
32+
}
33+
echo_banner "devcontainer.community"
34+
echo "Installing $name..."
35+
install "$@"
36+
echo "(*) Done!"

0 commit comments

Comments
 (0)