Re: Running a command if any files are copied.

Bram Moolenaar <[email protected]> Fri, 16 Sep 2005 20:05:47 +0200
Newsgroups gmane.comp.tools.aap.user
Message-ID <[email protected]>
Mike Ellis wrote:

> Thanks, Bram, the script works correctly now for one file.  (I had to
> change :cp to :copy).

Sorry, I forget the synax of commands sometimes.  Actually, I'm
wondering if Aap will become simpler to use when the Aap commands would
take arguments like the Unix commands.

> As for udevstart, it should  run _one time only _ if one or more
> changed files are installed.  The situation is almost analogous to
> compile and link, where the linker runs only if any files are
> compiled.
> 
> This seems to me a fairly common need, e.g. to install changed
> configuration files for a daemon and conditionally restart the daemon.

You could set a variable in the block where the file is copied, and then
at the "finally" target check for it:

	didit = 0

	didi : dodo
	  :copy {f} $source $target
	  didit = 1

	...

	finally:
		@if _no.didit:
		   :sys run the command

-- 
   They now pass three KNIGHTS impaled to a tree.  With their feet off the
   ground,  with one lance through the lot of them, they are skewered up
   like a barbecue.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\     Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html   ///


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. 
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php