1

I see that my system has installed several tasks. Below is the output of command with tasksel:

$ tasksel --list-tasks | grep ^i
i print-server  Print server
i samba-server  Samba file server
i ubuntu-mate-core  Ubuntu MATE minimal
i ubuntu-mate-desktop   Ubuntu MATE desktop
i openssh-server    OpenSSH server
i server    Basic Ubuntu server

How can I get the same information using different tool(s)?
Hope to get solution without tasksel package installed. Only by parsing dpkg-info or something similar.

N0rbert
  • 99,918
  • 1
    "Only by parsing dpkg-info or something similar." Nope. Not all meta-packages are tasks and not all tasks are meta-packages. To have a 100% match you need tasksel itself installed :( Unless you want to parse a website that has them listed :) – Rinzwind May 10 '21 at 21:37
  • What do packages with ^ mean? Is there some documentation? – jarno May 11 '21 at 19:07
  • 1
    @jarno ^ means package installation task, see at least https://askubuntu.com/a/211953/66509 . Not sure about exact man-page. – N0rbert May 11 '21 at 20:55

1 Answers1

1

I don't think this is the same way that tasksel actually checks, but without tasksel you can

  1. parse the list of tasks

    apt-cache dumpavail | grep ^Task: | sed -e 's/Task: //' -e 's/,./\n/g' | sort -u
    
  2. get a list of packages installed for a task. E.g. for the openssh-server^ meta-package

    apt-cache show openssh-server^ | grep ^Package: | sed -e 's/Package: //' | sort -u
    
  3. check the installation status for the list of packages installed for a task. E.g. for the openssh-server^ meta-package

    apt-cache policy $(apt-cache show openssh-server^ | grep ^Package: | sed -e 's/Package: //' | sort -u) | grep -B 1 Installed:
    
  4. glue it all together with bash to get task status

    for t in $(apt-cache dumpavail | grep ^Task: | sed -e 's/Task: //' -e 's/,./\n/g' | sort -u); do
      t_installed=u
      if (( $(apt-cache policy $(apt-cache show ${t}^ | grep ^Package: | sed -e 's/Package: //' | sort -u) | grep Installed: | grep -c 'none') == 0 )); then t_installed=i ; fi
      echo $t_installed $t
    done