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
  • 103,263

1 Answers1

2

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