Skip to content

Commit

Permalink
Check the installed package instead of from ubuntu-archive (bugfix) (#…
Browse files Browse the repository at this point in the history
…914)

[p/b/b/check-ubuntu-desktop-recommends.sh] (LP: #2027655)

Co-authored-by: Jeremy Szu <jeremy.szu@canonical.com>
  • Loading branch information
kissiel and Jeremy Szu authored Jan 7, 2024
1 parent 8de3979 commit 67ab000
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion providers/base/bin/check-ubuntu-desktop-recommends.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ IFS=$'\n\t'
target_package=${1:-ubuntu-desktop}

noninstalled=()
target_version="$(dpkg-query --showformat='${Version}' --show ubuntu-desktop)"
apt_show_ud="$(apt-cache show "${target_package}"="$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 "${target_package}" | 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=' '
Expand Down

0 comments on commit 67ab000

Please sign in to comment.