summaryrefslogtreecommitdiff
diff options
authorShih-Yuan Lee (FourDollars) <sylee@canonical.com>2022-01-04 20:31:06 +0800
committerShih-Yuan Lee (FourDollars) <sylee@canonical.com>2022-01-05 16:17:50 +0800
commitcf1df249bfcec3ffaa6b616c125e5ec04b7d52c8 (patch)
tree3155aa622fd644d6e6af084dee5a725b20036f65
parentc44c4af4e3213cbe70a169d480ae7a0fd833cb24 (diff)
Add: check if all recommended packages of ubuntu-desktop are installed.
-rwxr-xr-xbin/check-ubuntu-desktop-recommends.sh21
-rw-r--r--units/miscellanea/jobs.pxu9
-rw-r--r--units/miscellanea/test-plan.pxu1
3 files changed, 31 insertions, 0 deletions
diff --git a/bin/check-ubuntu-desktop-recommends.sh b/bin/check-ubuntu-desktop-recommends.sh
new file mode 100755
index 0000000..edda52e
--- /dev/null
+++ b/bin/check-ubuntu-desktop-recommends.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+set -euo pipefail
+IFS=$'\n\t'
+
+noninstalled=()
+while read -r pkg; do
+ # libreoffice-impress provides libreoffice-ogltrans, and libreoffice-ogltrans becomes a transitional package on Ubuntu 20.04.
+ # shellcheck disable=SC2016
+ if ! dpkg-query -W -f='${Status}\n' "$pkg" 2>&1 | grep "install ok installed" >/dev/null 2>&1 && [ "$pkg" != "libreoffice-ogltrans" ]; then
+ noninstalled+=("$pkg")
+ fi
+done < <(apt-cache show ubuntu-desktop | grep ^Recommends | head -n 1 | cut -d : -f 2- | xargs | sed 's/ //g' | tr , $'\n')
+
+if [ -n "${noninstalled[*]}" ]; then
+ IFS=' '
+ echo "${noninstalled[*]} are not installed."
+ exit 1
+fi
+
+echo "All packages in Recommends of ubuntu-desktop are installed."
+exit 0
diff --git a/units/miscellanea/jobs.pxu b/units/miscellanea/jobs.pxu
index ac0c9ae..785eebe 100644
--- a/units/miscellanea/jobs.pxu
+++ b/units/miscellanea/jobs.pxu
@@ -476,6 +476,15 @@ _description: Verify installed Debian package files against MD5 checksum lists f
plugin: shell
category_id: com.canonical.plainbox::miscellanea
+estimated_duration: 60
+id: miscellanea/ubuntu-desktop-recommends
+requires: package.name == 'ubuntu-desktop'
+command: check-ubuntu-desktop-recommends.sh
+_summary: Check if Debian packages in Recommends of ubuntu-desktop are installed
+_description: Check if Debian packages in Recommends of ubuntu-desktop are installed
+
+plugin: shell
+category_id: com.canonical.plainbox::miscellanea
id: miscellanea/maas_user_check
requires:
executable.name == 'ipmitool'
diff --git a/units/miscellanea/test-plan.pxu b/units/miscellanea/test-plan.pxu
index a48e80f..b6e4de7 100644
--- a/units/miscellanea/test-plan.pxu
+++ b/units/miscellanea/test-plan.pxu
@@ -34,6 +34,7 @@ include:
miscellanea/fan_stress_reaction
miscellanea/debsums certification-status=blocker
miscellanea/check_prerelease certification-status=blocker
+ miscellanea/ubuntu-desktop-recommends certification-status=blocker
bootstrap_include:
fwts