]> pere.pagekite.me Git - homepage.git/blob - blog/data/2010-06-16-calling-tasksel.txt
Generated.
[homepage.git] / blog / data / 2010-06-16-calling-tasksel.txt
1 Title: Calling tasksel like the installer, while still getting useful output
2 Tags: english, nuug, debian
3 Date: 2010-06-16 14:55
4
5 <p>A few times I have had the need to simulate the way tasksel
6 installs packages during the normal debian-installer run. Until now,
7 I have ended up letting tasksel do the work, with the annoying problem
8 of not getting any feedback at all when something fails (like a
9 conffile question from dpkg or a download that fails), using code like
10 this:
11
12 <blockquote><pre>
13 export DEBIAN_FRONTEND=noninteractive
14 tasksel --new-install
15 </pre></blockquote>
16
17 This would invoke tasksel, let its automatic task selection pick the
18 tasks to install, and continue to install the requested tasks without
19 any output what so ever.
20
21 Recently I revisited this problem while working on the automatic
22 package upgrade testing, because tasksel would some times hang without
23 any useful feedback, and I want to see what is going on when it
24 happen. Then it occured to me, I can parse the output from tasksel
25 when asked to run in test mode, and use that aptitude command line
26 printed by tasksel then to simulate the tasksel run. I ended up using
27 code like this:
28
29 <blockquote><pre>
30 export DEBIAN_FRONTEND=noninteractive
31 cmd="$(in_target tasksel -t --new-install | sed 's/debconf-apt-progress -- //')"
32 $cmd
33 </pre></blockquote>
34
35 <p>The content of $cmd is typically something like "<tt>aptitude -q
36 --without-recommends -o APT::Install-Recommends=no -y install
37 ~t^desktop$ ~t^gnome-desktop$ ~t^laptop$ ~pstandard ~prequired
38 ~pimportant</tt>", which will install the gnome desktop task, the
39 laptop task and all packages with priority standard , required and
40 important, just like tasksel would have done it during
41 installation.</p>
42
43 <p>A better approach is probably to extend tasksel to be able to
44 install packages without using debconf-apt-progress, for use cases
45 like this.</p>