I have a set of packages that I wish to install along-side the minibase variant in debootstrap. I'm having the hardest time figuring out how to customize variants so that more than just the base is installed in a chroot when debootstrap is run. Any way to achieve this?
Asked
Active
Viewed 8,441 times
1 Answers
10
It's pretty easy to add your own variant with additional custom packages to debootstrap.
The debootstrap configuration/runtime scripts are located in /usr/share/debootstrap/scripts. Let's create an allmybase variant which includes everything in minbase along with the packages htop and traceroute.
Open
/usr/share/debootstrap/scripts/precisein your editor.- Note that this, along with many Ubuntu releases, is a symbolic link to
/usr/share/debootstrap/scripts/gutsy; if you want to affect only a specific release, break the link and make it a copy of the gutsy script instead.
- Note that this, along with many Ubuntu releases, is a symbolic link to
Around line 22, find the line beginning with
variantsand add your custom variant at the end:variants - buildd fakechroot minbase allmybase
Find the
work_out_debs()function around line 34, and look at the default settings for thebasevariable for your "base" variant (here,minbase):elif doing_variant fakechroot || doing_variant minbase; then base="apt"Append your own variant with custom packages at the end of the function:
elif doing_variant allmybase; then base="apt htop traceroute"Save, exit, and test it out with the
--print-debs"simulation" flag, e.g.sudo debootstrap --print-debs --variant=allmybase precise /tmp/prec-chroot
- In this example, the output will show that the
htopandtraceroutepackages will be included in the allmybase chroot.
- In this example, the output will show that the
ish
- 138,666
- 36
- 303
- 312
-
Wow, I guess this seems almost as dirty as just installing a variant and mounting the chroot + apt-get. Thanks for the information! – Marco Ceppi Jul 26 '12 at 02:20
-
Well, a little pain once will gain you a lot if you install the same variant repeatedly ;) – ish Jul 26 '12 at 02:45
-
Maybe that option did not exist at the time of the question, but the same effect can be achieved with `debootstrap --include=htop,traceroute` without any modifications to debootstrap scripts. – raimue Nov 06 '19 at 15:56