From 04b9f49ce12d4bc8c4b82f10b95dab1a765dd2a1 Mon Sep 17 00:00:00 2001
From: Sebastian Steins <592313+sebst@users.noreply.github.com>
Date: Sat, 12 Oct 2024 22:28:46 +0200
Subject: [PATCH 1/2] feat(`webinstall.dev`): Add feature.

---
 .github/workflows/test.yaml                  |  2 ++
 src/webinstall.dev/devcontainer-feature.json | 17 +++++++++
 src/webinstall.dev/install.sh                | 36 ++++++++++++++++++++
 test/webinstall.dev/test.sh                  | 19 +++++++++++
 4 files changed, 74 insertions(+)
 create mode 100644 src/webinstall.dev/devcontainer-feature.json
 create mode 100755 src/webinstall.dev/install.sh
 create mode 100755 test/webinstall.dev/test.sh

diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 9beaa49..860d312 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -20,6 +20,7 @@ jobs:
           - pkgx.sh
           - smallstep.com
           - starship.rs
+          - webinstall.dev
           - zellij.dev
         baseImage:
           - debian:latest
@@ -47,6 +48,7 @@ jobs:
           - pkgx.sh
           - smallstep.com
           - starship.rs
+          - webinstall.dev
           - zellij.dev
     steps:
       - uses: actions/checkout@v4
diff --git a/src/webinstall.dev/devcontainer-feature.json b/src/webinstall.dev/devcontainer-feature.json
new file mode 100644
index 0000000..940a9d0
--- /dev/null
+++ b/src/webinstall.dev/devcontainer-feature.json
@@ -0,0 +1,17 @@
+{
+    "name": "starship.rs",
+    "id": "starship.rs",
+    "version": "1.0.0",
+    "description": "Install \"webi\" binary",
+    "documentationURL": "https://github.com/devcontainer-community/devcontainer-features/tree/main/src/starship.rs",
+    "options": {
+        "version": {
+            "type": "string",
+            "default": "latest",
+            "proposals": [
+                "latest"
+            ],
+            "description": "Version of \"webi\" to install."
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/webinstall.dev/install.sh b/src/webinstall.dev/install.sh
new file mode 100755
index 0000000..a1e388f
--- /dev/null
+++ b/src/webinstall.dev/install.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+set -o errexit
+set -o pipefail
+set -o noclobber
+set -o nounset
+set -o allexport
+readonly name="asdf"
+apt_get_update() {
+    if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
+        echo "Running apt-get update..."
+        apt-get update -y
+    fi
+}
+apt_get_checkinstall() {
+    if ! dpkg -s "$@" >/dev/null 2>&1; then
+        apt_get_update
+        DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends --no-install-suggests --option 'Debug::pkgProblemResolver=true' --option 'Debug::pkgAcquire::Worker=1' "$@"
+    fi
+}
+apt_get_cleanup() {
+    apt-get clean
+    rm -rf /var/lib/apt/lists/*
+}
+echo_banner() {
+    local text="$1"
+    echo -e "\e[1m\e[97m\e[41m$text\e[0m"
+}
+install() {
+    apt_get_checkinstall curl ca-certificates
+    su $_REMOTE_USER -c "curl -sS https://webi.sh/webi | sh"
+    apt_get_cleanup
+}
+echo_banner "devcontainer.community"
+echo "Installing $name..."
+install "$@"
+echo "(*) Done!"
diff --git a/test/webinstall.dev/test.sh b/test/webinstall.dev/test.sh
new file mode 100755
index 0000000..d0c92a8
--- /dev/null
+++ b/test/webinstall.dev/test.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+
+set -e
+
+# Optional: Import test library bundled with the devcontainer CLI
+# See https://github.com/devcontainers/cli/blob/HEAD/docs/features/test.md#dev-container-features-test-lib
+# Provides the 'check' and 'reportResults' commands.
+source dev-container-features-test-lib
+
+# Feature-specific tests
+# The 'check' command comes from the dev-container-features-test-lib. Syntax is...
+# check <LABEL> <cmd> [args...]
+
+check "execute command" bash -c "webi --version | grep 'webi'"
+
+# Report results
+# If any of the checks above exited with a non-zero exit code, the test will fail.
+reportResults
\ No newline at end of file

From 384eb9fe1e6d9266a00766ce7ca59332bdd3bc18 Mon Sep 17 00:00:00 2001
From: Sebastian Steins <592313+sebst@users.noreply.github.com>
Date: Sat, 12 Oct 2024 22:29:52 +0200
Subject: [PATCH 2/2] feat(`webinstall.dev`): Fix `devcontainer-feature.json`.

---
 src/webinstall.dev/devcontainer-feature.json | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/webinstall.dev/devcontainer-feature.json b/src/webinstall.dev/devcontainer-feature.json
index 940a9d0..dca0323 100644
--- a/src/webinstall.dev/devcontainer-feature.json
+++ b/src/webinstall.dev/devcontainer-feature.json
@@ -1,9 +1,9 @@
 {
-    "name": "starship.rs",
-    "id": "starship.rs",
+    "name": "webinstall.dev",
+    "id": "webinstall.dev",
     "version": "1.0.0",
     "description": "Install \"webi\" binary",
-    "documentationURL": "https://github.com/devcontainer-community/devcontainer-features/tree/main/src/starship.rs",
+    "documentationURL": "https://github.com/devcontainer-community/devcontainer-features/tree/main/src/webinstall.dev",
     "options": {
         "version": {
             "type": "string",