[Lxc-users] lxc-clone
Serge Hallyn
serge.hallyn at canonical.com
Mon Apr 18 13:06:08 UTC 2011
Quoting Daniel Lezcano (daniel.lezcano at free.fr):
> On 04/06/2011 04:05 PM, Serge E. Hallyn wrote:
> >Quoting Daniel Lezcano (daniel.lezcano at free.fr):
> >>>What do you think is the best way to do this? We could allow the user
> >>>to specify a 'firstboot' script, which gets copied into root directory
> >>>of the container. Maybe boot the container when it's done, run
> >>>/firstboot.sh, and shut down. Or just let that happen when the user
> >>>first boots. We could use a /etc/init.d/lxc-firstboot script, but
> >>>that will only work if the container's init system actually looks at
> >>>sysvinit scripts. Obviously sysvinit and upstart do, and I must
> >>>assume that systemd does. lxc-init I assume doesn't.
> >>Mmh, that's look a bit complicate for the user. I was thinking about
> >>something simpler like:
> >>
> >>grep -q "lxc.utsname" $lxc_path/$lxc_new/config
> >>if [ $? == 0 ]; then
> >> sed -e "s/lxc.utsname/lxc.utsname=$hostname" $lxc_path/$lxc_new/config
> >>else
> >> echo "lxc.utsname = $hostname">> $lxc_path/$lxc_new/config
> >>fi
> >>
> >>and so for the rest of the configuration variables.
> >Ok, yeah, that'll be necessary and independent of the distro. But I
> >do think a firstboot option will be useful both for -clone and -create.
> >It can be totally optional so as not to confuse those who don't want
> >it.
>
> I am not sure to understand what is for the 'firstboot' option. Can
> you elaborate a bit ?
It's just a job that starts at boot, runs a script the user specified
when creating the container, and then disables itself so it doesn't
run again. So it'll only run the first time that we actually boot
the container. Until then, the disk image is pristine.
-serge
More information about the lxc-users
mailing list