Re: Running a command if any files are copied.
Bram Moolenaar <[email protected]> Fri, 16 Sep 2005 17:34:00 +0200
| Newsgroups | gmane.comp.tools.aap.user |
|---|---|
| Message-ID | <[email protected]> |
Mike Ellis wrote:
> Just discovered Aap yesterday. Very impressive!
>
> Question: What's best way to copy one or more changed files to a local
> target and if (and only if) any files were copied, run a system
> command?
>
> For example, here's a snippet from a main.aap I'm creating to replace
> a fairly complicated makefile.
>
> #install the udev rules
> :sys cp acceleron.rules /etc/udev/rules.d/
> :sys /sbin/udevstart
>
> This always copies the rules file and always runs udevstart. I'd like
> to copy the rules only when the file changes and only run udevstart
> when a file was copied. I'd also like to generalize it to handle more
> than one .rules file.
You could do it this way (for one file):
dir = /etc/udev/rules.d/
name = acceleron.rules
$dir/$name : $name
:cp {f} $source $target
:sys /sbin/udevstart
# install commands
:update $dir/$name
If there are more .rules files, would udevstart need to be run once or
for each file?
--
He was not in the least bit scared to be mashed into a pulp
Or to have his eyes gouged out and his elbows broken;
To have his kneecaps split and his body burned away
And his limbs all hacked and mangled, brave Sir Robin.
"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