From 6dad4e75174764cbbe285283ea98b7105ddb95bb Mon Sep 17 00:00:00 2001 From: Gaurav Saini <147703805+gauravsaini04@users.noreply.github.com> Date: Wed, 15 May 2024 11:53:08 +0000 Subject: [PATCH 1/5] [Desktop-lite]- libasound2 not installing in noble - issue --- src/desktop-lite/install.sh | 11 ++++++- test/desktop-lite/desktop-lite_jammy.sh | 33 +++++++++++++++++++ .../desktop-lite/desktop-lite_noble_numbat.sh | 33 +++++++++++++++++++ test/desktop-lite/scenarios.json | 18 ++++++++++ 4 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 test/desktop-lite/desktop-lite_jammy.sh create mode 100644 test/desktop-lite/desktop-lite_noble_numbat.sh create mode 100644 test/desktop-lite/scenarios.json diff --git a/src/desktop-lite/install.sh b/src/desktop-lite/install.sh index df4390eca..39b6f6f2a 100755 --- a/src/desktop-lite/install.sh +++ b/src/desktop-lite/install.sh @@ -41,7 +41,6 @@ package_list=" libnotify4 \ libnss3 \ libxss1 \ - libasound2 \ xfonts-base \ xfonts-terminus \ fonts-noto \ @@ -198,6 +197,16 @@ fi # Install X11, fluxbox and VS Code dependencies check_packages ${package_list} +# if Ubuntu-24.04 (noble numbat) found, then install libasound2-dev else libasound2 +set -x +. /etc/os-release +if [ "${ID}" = "ubuntu" ] && [ "${VERSION_CODENAME}" = "noble" ]; then + echo "Ubuntu 24.04 Noble (Numbat) detected." + check_packages "libasound2-dev" +else + check_packages "libasound2" +fi + # On newer versions of Ubuntu (22.04), # we need an additional package that isn't provided in earlier versions if ! type vncpasswd > /dev/null 2>&1; then diff --git a/test/desktop-lite/desktop-lite_jammy.sh b/test/desktop-lite/desktop-lite_jammy.sh new file mode 100644 index 000000000..15d7b7e38 --- /dev/null +++ b/test/desktop-lite/desktop-lite_jammy.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +set -e + +# Optional: Import test library +source dev-container-features-test-lib + +echoStderr() +{ + echo "$@" 1>&2 +} + +checkOSPackage() { + LABEL=$1 + PACKAGE_NAME=$2 + echo -e "\n๐Ÿงช Testing $LABEL" + # Check if the package exists and retrieve its exact version + if [ "$(dpkg-query -W -f='${Status}' "$PACKAGE_NAME" 2>/dev/null | grep -c "ok installed")" -eq 1 ]; then + echo "โœ… Package '$PACKAGE_NAME' is installed." + else + echo "โŒ Package '$PACKAGE_NAME' is not installed." + fi +} + +check "desktop-init-exists" bash -c "ls /usr/local/share/desktop-init.sh" +check "log-exists" bash -c "ls /tmp/container-init.log" +check "fluxbox-exists" bash -c "ls -la ~/.fluxbox" + +checkOSPackage "if libasound2 exists !" "libasound2" +checkOSPackage "if libasound2-dev exists !" "libasound2-dev" + +# Report result +reportResults \ No newline at end of file diff --git a/test/desktop-lite/desktop-lite_noble_numbat.sh b/test/desktop-lite/desktop-lite_noble_numbat.sh new file mode 100644 index 000000000..15d7b7e38 --- /dev/null +++ b/test/desktop-lite/desktop-lite_noble_numbat.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +set -e + +# Optional: Import test library +source dev-container-features-test-lib + +echoStderr() +{ + echo "$@" 1>&2 +} + +checkOSPackage() { + LABEL=$1 + PACKAGE_NAME=$2 + echo -e "\n๐Ÿงช Testing $LABEL" + # Check if the package exists and retrieve its exact version + if [ "$(dpkg-query -W -f='${Status}' "$PACKAGE_NAME" 2>/dev/null | grep -c "ok installed")" -eq 1 ]; then + echo "โœ… Package '$PACKAGE_NAME' is installed." + else + echo "โŒ Package '$PACKAGE_NAME' is not installed." + fi +} + +check "desktop-init-exists" bash -c "ls /usr/local/share/desktop-init.sh" +check "log-exists" bash -c "ls /tmp/container-init.log" +check "fluxbox-exists" bash -c "ls -la ~/.fluxbox" + +checkOSPackage "if libasound2 exists !" "libasound2" +checkOSPackage "if libasound2-dev exists !" "libasound2-dev" + +# Report result +reportResults \ No newline at end of file diff --git a/test/desktop-lite/scenarios.json b/test/desktop-lite/scenarios.json new file mode 100644 index 000000000..c9381390c --- /dev/null +++ b/test/desktop-lite/scenarios.json @@ -0,0 +1,18 @@ +{ + "desktop-lite_noble_numbat": { + "image": "ubuntu:noble", + "features": { + "desktop-lite": { + "version": "latest" + } + } + }, + "desktop-lite_jammy": { + "image": "ubuntu:jammy", + "features": { + "desktop-lite": { + "version": "latest" + } + } + } +} \ No newline at end of file From cce2938093459269c7e9fd539b5d07351df577dd Mon Sep 17 00:00:00 2001 From: Gaurav Saini <147703805+gauravsaini04@users.noreply.github.com> Date: Wed, 15 May 2024 11:56:00 +0000 Subject: [PATCH 2/5] bump to patch version in Desktop-lite feature --- src/desktop-lite/devcontainer-feature.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/desktop-lite/devcontainer-feature.json b/src/desktop-lite/devcontainer-feature.json index 5387138b5..62e137f68 100644 --- a/src/desktop-lite/devcontainer-feature.json +++ b/src/desktop-lite/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "desktop-lite", - "version": "1.0.8", + "version": "1.0.9", "name": "Light-weight Desktop", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/desktop-lite", "description": "Adds a lightweight Fluxbox based desktop to the container that can be accessed using a VNC viewer or the web. GUI-based commands executed from the built-in VS code terminal will open on the desktop automatically.", From 5b909b435dcfa46949b95d03858eec747e11be1c Mon Sep 17 00:00:00 2001 From: Gaurav Saini <147703805+gauravsaini04@users.noreply.github.com> Date: Wed, 15 May 2024 11:56:39 +0000 Subject: [PATCH 3/5] misc change --- src/desktop-lite/install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/src/desktop-lite/install.sh b/src/desktop-lite/install.sh index 39b6f6f2a..e56c0b2a7 100755 --- a/src/desktop-lite/install.sh +++ b/src/desktop-lite/install.sh @@ -198,7 +198,6 @@ fi check_packages ${package_list} # if Ubuntu-24.04 (noble numbat) found, then install libasound2-dev else libasound2 -set -x . /etc/os-release if [ "${ID}" = "ubuntu" ] && [ "${VERSION_CODENAME}" = "noble" ]; then echo "Ubuntu 24.04 Noble (Numbat) detected." From 496011717859d0cf334756d2a943459994e5af1e Mon Sep 17 00:00:00 2001 From: Gaurav Saini <147703805+gauravsaini04@users.noreply.github.com> Date: Wed, 15 May 2024 23:01:07 +0000 Subject: [PATCH 4/5] Changes for comments ( review comments ) --- src/desktop-lite/devcontainer-feature.json | 2 +- src/desktop-lite/install.sh | 5 +-- test/desktop-lite/desktop-lite_jammy.sh | 33 ------------------- .../desktop-lite/desktop-lite_noble_numbat.sh | 33 ------------------- test/desktop-lite/scenarios.json | 18 ---------- test/desktop-lite/test.sh | 20 +++++++++++ 6 files changed, 24 insertions(+), 87 deletions(-) delete mode 100644 test/desktop-lite/desktop-lite_jammy.sh delete mode 100644 test/desktop-lite/desktop-lite_noble_numbat.sh delete mode 100644 test/desktop-lite/scenarios.json diff --git a/src/desktop-lite/devcontainer-feature.json b/src/desktop-lite/devcontainer-feature.json index 62e137f68..5386eb31d 100644 --- a/src/desktop-lite/devcontainer-feature.json +++ b/src/desktop-lite/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "desktop-lite", - "version": "1.0.9", + "version": "1.1.0", "name": "Light-weight Desktop", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/desktop-lite", "description": "Adds a lightweight Fluxbox based desktop to the container that can be accessed using a VNC viewer or the web. GUI-based commands executed from the built-in VS code terminal will open on the desktop automatically.", diff --git a/src/desktop-lite/install.sh b/src/desktop-lite/install.sh index e56c0b2a7..13a524ada 100755 --- a/src/desktop-lite/install.sh +++ b/src/desktop-lite/install.sh @@ -197,10 +197,11 @@ fi # Install X11, fluxbox and VS Code dependencies check_packages ${package_list} -# if Ubuntu-24.04 (noble numbat) found, then install libasound2-dev else libasound2 +# if Ubuntu-24.04, noble(numbat) found, then will install libasound2-dev instead of libasound2. +# this change is temporary, https://packages.ubuntu.com/noble/libasound2 will switch to libasound2 once it is available for Ubuntu-24.04, noble(numbat) . /etc/os-release if [ "${ID}" = "ubuntu" ] && [ "${VERSION_CODENAME}" = "noble" ]; then - echo "Ubuntu 24.04 Noble (Numbat) detected." + echo "Ubuntu 24.04, Noble(Numbat) detected. Installing libasound2-dev package..." check_packages "libasound2-dev" else check_packages "libasound2" diff --git a/test/desktop-lite/desktop-lite_jammy.sh b/test/desktop-lite/desktop-lite_jammy.sh deleted file mode 100644 index 15d7b7e38..000000000 --- a/test/desktop-lite/desktop-lite_jammy.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -echoStderr() -{ - echo "$@" 1>&2 -} - -checkOSPackage() { - LABEL=$1 - PACKAGE_NAME=$2 - echo -e "\n๐Ÿงช Testing $LABEL" - # Check if the package exists and retrieve its exact version - if [ "$(dpkg-query -W -f='${Status}' "$PACKAGE_NAME" 2>/dev/null | grep -c "ok installed")" -eq 1 ]; then - echo "โœ… Package '$PACKAGE_NAME' is installed." - else - echo "โŒ Package '$PACKAGE_NAME' is not installed." - fi -} - -check "desktop-init-exists" bash -c "ls /usr/local/share/desktop-init.sh" -check "log-exists" bash -c "ls /tmp/container-init.log" -check "fluxbox-exists" bash -c "ls -la ~/.fluxbox" - -checkOSPackage "if libasound2 exists !" "libasound2" -checkOSPackage "if libasound2-dev exists !" "libasound2-dev" - -# Report result -reportResults \ No newline at end of file diff --git a/test/desktop-lite/desktop-lite_noble_numbat.sh b/test/desktop-lite/desktop-lite_noble_numbat.sh deleted file mode 100644 index 15d7b7e38..000000000 --- a/test/desktop-lite/desktop-lite_noble_numbat.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -set -e - -# Optional: Import test library -source dev-container-features-test-lib - -echoStderr() -{ - echo "$@" 1>&2 -} - -checkOSPackage() { - LABEL=$1 - PACKAGE_NAME=$2 - echo -e "\n๐Ÿงช Testing $LABEL" - # Check if the package exists and retrieve its exact version - if [ "$(dpkg-query -W -f='${Status}' "$PACKAGE_NAME" 2>/dev/null | grep -c "ok installed")" -eq 1 ]; then - echo "โœ… Package '$PACKAGE_NAME' is installed." - else - echo "โŒ Package '$PACKAGE_NAME' is not installed." - fi -} - -check "desktop-init-exists" bash -c "ls /usr/local/share/desktop-init.sh" -check "log-exists" bash -c "ls /tmp/container-init.log" -check "fluxbox-exists" bash -c "ls -la ~/.fluxbox" - -checkOSPackage "if libasound2 exists !" "libasound2" -checkOSPackage "if libasound2-dev exists !" "libasound2-dev" - -# Report result -reportResults \ No newline at end of file diff --git a/test/desktop-lite/scenarios.json b/test/desktop-lite/scenarios.json deleted file mode 100644 index c9381390c..000000000 --- a/test/desktop-lite/scenarios.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "desktop-lite_noble_numbat": { - "image": "ubuntu:noble", - "features": { - "desktop-lite": { - "version": "latest" - } - } - }, - "desktop-lite_jammy": { - "image": "ubuntu:jammy", - "features": { - "desktop-lite": { - "version": "latest" - } - } - } -} \ No newline at end of file diff --git a/test/desktop-lite/test.sh b/test/desktop-lite/test.sh index 9009aa9c6..15d7b7e38 100755 --- a/test/desktop-lite/test.sh +++ b/test/desktop-lite/test.sh @@ -5,9 +5,29 @@ set -e # Optional: Import test library source dev-container-features-test-lib +echoStderr() +{ + echo "$@" 1>&2 +} + +checkOSPackage() { + LABEL=$1 + PACKAGE_NAME=$2 + echo -e "\n๐Ÿงช Testing $LABEL" + # Check if the package exists and retrieve its exact version + if [ "$(dpkg-query -W -f='${Status}' "$PACKAGE_NAME" 2>/dev/null | grep -c "ok installed")" -eq 1 ]; then + echo "โœ… Package '$PACKAGE_NAME' is installed." + else + echo "โŒ Package '$PACKAGE_NAME' is not installed." + fi +} + check "desktop-init-exists" bash -c "ls /usr/local/share/desktop-init.sh" check "log-exists" bash -c "ls /tmp/container-init.log" check "fluxbox-exists" bash -c "ls -la ~/.fluxbox" +checkOSPackage "if libasound2 exists !" "libasound2" +checkOSPackage "if libasound2-dev exists !" "libasound2-dev" + # Report result reportResults \ No newline at end of file From c0a169d9c80627430b11157af1c31b6bee5c7413 Mon Sep 17 00:00:00 2001 From: Gaurav Saini <147703805+gauravsaini04@users.noreply.github.com> Date: Thu, 16 May 2024 00:07:28 +0000 Subject: [PATCH 5/5] changes based on review comments.. --- test/desktop-lite/test.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test/desktop-lite/test.sh b/test/desktop-lite/test.sh index 15d7b7e38..5d11dd424 100755 --- a/test/desktop-lite/test.sh +++ b/test/desktop-lite/test.sh @@ -17,8 +17,10 @@ checkOSPackage() { # Check if the package exists and retrieve its exact version if [ "$(dpkg-query -W -f='${Status}' "$PACKAGE_NAME" 2>/dev/null | grep -c "ok installed")" -eq 1 ]; then echo "โœ… Package '$PACKAGE_NAME' is installed." + exit 0 else echo "โŒ Package '$PACKAGE_NAME' is not installed." + exit 1 fi } @@ -26,8 +28,16 @@ check "desktop-init-exists" bash -c "ls /usr/local/share/desktop-init.sh" check "log-exists" bash -c "ls /tmp/container-init.log" check "fluxbox-exists" bash -c "ls -la ~/.fluxbox" -checkOSPackage "if libasound2 exists !" "libasound2" -checkOSPackage "if libasound2-dev exists !" "libasound2-dev" +. /etc/os-release +if [ "${ID}" = "ubuntu" ]; then + if [ "${VERSION_CODENAME}" = "noble" ]; then + checkOSPackage "if libasound2-dev exists !" "libasound2-dev" + else + checkOSPackage "if libasound2 exists !" "libasound2" + fi +else + checkOSPackage "if libasound2 exists !" "libasound2" +fi # Report result reportResults \ No newline at end of file