Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: xendomains rc.d script



On 16.07.2012 22:58, Brook Milligan wrote:
> The following code fragment is in the xendomains_start() function of
> the xentools41 xendomains rc.d script:
> 
>      # Start off by running the pre-hook script if it's present.
>      if [ -n "${xendomains_prehook}" ]; then
>          cmdline=`printf "${xendomains_prehook}" $domain`
>          cmd="${cmdline%% *}"
>          if [ -x "$cmd" ]; then
>             $cmdline || echo "Pre-hook \`\`$cmdline'' failed... skipping 
> $domain."
>             continue # <- why this?
>          fi
>      fi
> 
> This fragment is executed for each of the xen domains and is intended to
> run a pre-hook script prior to starting each domain.  However, it seems
> to me that the 'continue' statement will cause the domain to be skipped
> if a pre-hook script exists.
> 
> Shouldn't this script place the 'continue' statement in a conditional
> dependent on whether or not the command failed?

Correct. I will commit a fix later.

--- xendomains.orig     2012-07-16 23:48:01.000000000 +0200
+++ xendomains  2012-07-16 23:51:57.000000000 +0200
@@ -50,8 +50,10 @@ xendomains_start()
                        cmdline=`printf "${xendomains_prehook}" $domain`
                        cmd="${cmdline%% *}"
                        if [ -x "$cmd" ]; then
-                               $cmdline || echo "Pre-hook
\`\`$cmdline'' failed... skipping $domain."
-                               continue
+                               if ! $cmdline; then
+                                       echo "Pre-hook \`\`$cmdline''
failed... skipping $domain."
+                                       continue
+                               fi
                        fi
                fi




-- 
Jean-Yves Migeon
jeanyves.migeon%free.fr@localhost


Home | Main Index | Thread Index | Old Index