[Libguestfs] [PATCH] sysprep: handle distro specific sysv scripts

Pino Toscano ptoscano at redhat.com
Thu Dec 12 13:34:50 UTC 2013


Hello,

(sorry for the late reply, I was not involved in libugestfs until 
recently.)

On Friday 21 September 2012 20:00:34 Olaf Hering wrote:
> Currently firstboot would only work on redhat-based images.
> Handle redhat-based, suse-based and debian guests, error out in case
> of an unknown distro.
> Update firstboot.sh:
>  - make sure scripts exists and can be executed
>  - add LSB header to avoid insserv warnings later on
>  - run script only if called with "start"
> Update functions, pass only required options.
> 
> Signed-off-by: Olaf Hering <olaf at aepfle.de>
> 
> diff --git a/sysprep/firstboot.ml b/sysprep/firstboot.ml
> index 97cd8a9..c5296a1 100644
> --- a/sysprep/firstboot.ml
> +++ b/sysprep/firstboot.ml
> @@ -28,14 +28,35 @@ let firstboot_dir = "/usr/lib/virt-sysprep"
>  let firstboot_sh = sprintf "\
>  #!/bin/sh -
> 
> +### BEGIN INIT INFO
> +# Provides:          virt-sysprep
> +# Required-Start:    $null
> +# Should-Start:      $all
> +# Required-Stop:     $null
> +# Should-Stop:       $all

This basically means that the firstboot script can be executed ahead of 
anything else; thus doing something like
  virt-builder debian-7 --firstboot-command "du -hcs /usr/share/doc"
can fail because of /usr not mounted yet.  Likewise for other kind of 
commands.

I understand that this functionality might be used to do simple stuff, 
but still IMHO it would be better to have it run after all the other 
facilities (at least the standard ones) are available, so I would 
propose to change the written LSB header into:
  # Required-Start:    $all
  # Should-Start:      $null
  # Required-Stop:     $null
  # Should-Stop:       $null
(or just remove the two Should-* and leave Required-Stop blank)

What do you think?

(Firstboot scripts are not working in Debian anyway, see #1019388.)

-- 
Pino Toscano




More information about the Libguestfs mailing list