Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm setting up an automated "no questions asked" preseed system and using Dustin Kirkland's server preseed as an example.

He uses the following line to install three packages as part of the automated install:

d-i pkgsel/include string byobu vim openssh-server

I am looking for the inverse of this, basically be able to remove packages as part of the automated install.

I am thinking I need to to use d-i preseed/late_command string apt-remove packagename to clean up stuff I don't want when the install is done, but I am not sure

share|improve this question
    
Definitely how I would go about it. Not big on preseed though. I use pseudopackages and start from a base install that doesn't have anything I don't want. –  hbdgaf Jul 28 '11 at 12:04
    
No one from the desktop team or server team looked at this question? –  Manish Sinha Oct 3 '11 at 19:24
add comment

2 Answers 2

up vote 6 down vote accepted
+150

There isn't an option to purge o delete a package in the preseed configuration script but you can use this command....

d-i preseed/late_command

This command is run just before the install finishes, but when there is
still a usable /target directory. You can chroot to /target and use it
directly, or use the apt-install and in-target commands to easily install
packages and run commands in the target system.
"in-target" means: chroot /target
d-i preseed/late_command string [in-target] foo

example :

d-i preseed/late_command string \
            in-target apt-get remove packagename

you can also run a script :

d-i preseed/late_command string \
        in-target wget http://........./postinst.sh -O /root/postinst.sh; \
        in-target /bin/bash /root/postinst.sh

or install a group of DEB files :

d-i preseed/late_command               string \
    for deb in /hd-media/*.deb; do cp $deb /target/tmp; \
    chroot /target dpkg -i /tmp/$(basename $deb); done
share|improve this answer
add comment

The example pressed is just an example; it does not contain all possible d-i combinations, but just those more common.

Personally, I have never tried to remove packages from an install, so I am not sure there is a specific d-i command for it; it sounds like your d-i preseed late_command should work. A quick search on the d-i docs did not produce anything... But, of course, Colin would know ;-)

Alternatively, you could start from a basic server, and then add whatever you want:

tasksel tasksel/first   multiselect     Basic Ubuntu server
...
d-i preseed/late_command string apt-install whatever else
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.