On 05/28/2010 09:29 AM, Eric Blake wrote:
On 05/28/2010 09:16 AM, Jiri Denemark wrote:
> Firstly, the init script has to touch its file under /var/lock/subsys
> when started, otherwise system would think it's not running and won't
> stop it during shutdown.
>
> Secondly, for some reason there is a policy to automatically enable
> init scripts when they are installed, so let the specfile do this. We
> also need to start the init script to ensure it will be stopped during
> the first shutdown after installing the package.
Makes sense.
> LISTFILE="$localstatedir"/lib/libvirt/libvirt-guests
> +VAR_SUBSYS_LIBVIRT_GUESTS="$localstatedir"/lock/subsys/libvirt-guests
>
> RETVAL=0
>
> @@ -117,12 +118,17 @@ guest_is_on() {
> return 0
> }
>
> +started() {
> + touch $VAR_SUBSYS_LIBVIRT_GUESTS
touch "$VAR_SUBSYS_LIBVIRT_GUESTS"
> +}
> +
> start() {
> - [ -f $LISTFILE ] || return 0
> + [ -f $LISTFILE ] || { started; return 0; }
On rereading this email, we should also s/\$LISTFILE/"\1"/g throughout
the script.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org