apt-install, %post, chroot

Colin Watson cjwatson at ubuntu.com
Wed Jan 9 17:15:47 GMT 2008


On Mon, Jan 07, 2008 at 05:02:44PM -0800, Ryan Lovett wrote:
> This is just to document the fact that apt-install is not available when
> post is run in a chroot. It tripped me up and I thought I'd save someone
> else the trouble.
> 
> Maybe something like the patch below would help. (totally untested)
> 
> Ryan
> 
> --- kickseed-0.46/handlers/post.sh.orig 2007-06-18 14:15:53.000000000 -0700
> +++ kickseed-0.46/handlers/post.sh      2008-01-07 16:59:02.000000000 -0800
> @@ -26,3 +26,7 @@
>                 warn "%post --nochroot interpreters other than /bin/sh not
> supported yet"
>         fi
>  }
> +
> +apt-install () {
> +       warn "apt-install is not available when %post is run in a chroot"
> +}

It isn't possible to define shell functions with a hyphen in their name.

Since this is essentially documentation, and the syslog is a tricky
place to put that, perhaps a paragraph in the installation guide would
do the job? How about this?

=== modified file 'en/install-methods/automatic-install.xml'
--- en/install-methods/automatic-install.xml	2007-11-01 04:51:58 +0000
+++ en/install-methods/automatic-install.xml	2008-01-09 17:15:03 +0000
@@ -153,6 +153,16 @@
 Indian layout.
 
 </para></listitem>
+<listitem><para>
+
+You may use the <command>apt-install</command> command to install packages
+in <userinput>%post --nochroot</userinput> scripts (although you might also
+choose to generate a <userinput>%packages</userinput> section in a
+<userinput>%pre</userinput> script and include it using
+<userinput>%include</userinput>). Note that this does not work if the
+post-installation script is run in the chroot environment.
+
+</para></listitem>
 </itemizedlist>
 
 </para>

Thanks,

-- 
Colin Watson                                       [cjwatson at ubuntu.com]



More information about the Ubuntu-installer mailing list