diff --git a/ubuntu-to-mint-convert-v3.sh b/ubuntu-to-mint-convert-v3.sh index 07c5fbe..f585fe6 100644 --- a/ubuntu-to-mint-convert-v3.sh +++ b/ubuntu-to-mint-convert-v3.sh @@ -823,9 +823,17 @@ simulate_and_gate() { die "APT could not resolve the Mint stack (exit ${rc}). Nothing has been installed. Full output: ${sim_out}" fi - # `Remv [version]` is what apt-get -s prints for each removal. + # apt-get -s prints `Remv [version]` for removals and `Purg ` + # for purges -- both take the package away, so both count. It also emits + # the architecture qualifier in multiarch situations ("Remv sudo:amd64"), + # which has to be stripped or a critical package would slip past the exact + # match below. ubuntu-desktop-prune.sh already parses it this way. local -a removals=() - mapfile -t removals < <(awk '$1=="Remv"{print $2}' "$sim_out" | sort -u) + mapfile -t removals < <( + awk '/^(Remv|Purg)[[:space:]]+/{print $2}' "$sim_out" \ + | sed -E 's/:[a-z0-9]+$//' \ + | sort -u + ) local count=${#removals[@]} # Critical packages first: no threshold makes these acceptable.