From 82b350f24990be768dc85a9764cfc6e32a042e2e Mon Sep 17 00:00:00 2001 From: Jeremy Szu Date: Wed, 26 Jul 2023 14:49:10 +0800 Subject: [PATCH] Check the installed package instead of from ubuntu-archive (bugfix) [p/b/b/check-ubuntu-desktop-recommends.sh] (LP: #2027655) --- providers/base/bin/check-ubuntu-desktop-recommends.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/providers/base/bin/check-ubuntu-desktop-recommends.sh b/providers/base/bin/check-ubuntu-desktop-recommends.sh index edda52e490..ff40fd82e2 100755 --- a/providers/base/bin/check-ubuntu-desktop-recommends.sh +++ b/providers/base/bin/check-ubuntu-desktop-recommends.sh @@ -3,13 +3,16 @@ set -euo pipefail IFS=$'\n\t' noninstalled=() +target_version="$(dpkg-query --showformat='${Version}' --show ubuntu-desktop)" +apt_show_ud="$(apt-cache show ubuntu-desktop="$target_version")" +recommends="$(echo "${apt_show_ud}"| grep ^Recommends | head -n 1)" 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') +done < <(echo "$recommends"| cut -d : -f 2-| xargs| sed 's/ //g'| tr , $'\n') if [ -n "${noninstalled[*]}" ]; then IFS=' '