[kwlug-disc] once again, so that's how "tasksel" works

Robert P. J. Day rpjday at crashcourse.ca
Sun May 2 11:41:16 EDT 2010

(apologies for earlier null email -- touchy keyboard)

   determined to nail down debian/ubuntu pkg management, i started  
poking around the "tasksel" utility that others had mentioned before.   
i can see the list of available tasks thusly:

$ tasksel --list-tasks

and reading further, i was informed that tasks are defined in  
/usr/share/tasksel/ubuntu-tasks.desc.  but, oddly, that file defines  
every possible task with the line:

Packages: task-fields

luckily, since "tasksel" is a shell script, it's easy to spot where  
it's picking up the package list for the task:

         open (AVAIL, "apt-cache dumpavail|");
         while (<AVAIL>) {
              if (/^Task: (.*)/m) {
                     my @tasks=split(", ", $1);
                     if (grep { $_ eq $task->{task} } @tasks) {
                            $list{$1}=1 if /^Package: (.*)/m;
         close AVAIL;

in short, take the output from "apt-cache dumpavail" and scan for all  
packages that list themselves as part of a given task.  makes sense  
after you think about it since you don't want to hardcode that info in  
a single file that might change frequently.

   oh, and a cute variation that seems to be overlooked:

$ sudo apt-get install lamp-server^

installing a task by identifying it with that trailing "^".


More information about the kwlug-disc mailing list