[csw-devel] dynamically generated adm scripts
Dagobert Michelsen
dam at opencsw.org
Mon Feb 9 23:16:36 CET 2009
Hi Ben,
Am 09.02.2009 um 20:18 schrieb Ben Walton:
> I've mostly completed a feature for GAR that I thought I'd get some
> feedback on. While putting together one of my packages, I found the
> script to be quite nasty. It relies on version numbers of the
> package, etc (a maintenance annoyance). It struck me that it might be
> nice to have GAR generate this script automatically from a 'template'
> thus taking advantage of variables already available to the Makefile
> ($GARVERSION, etc).
>
> What I've put together allows for the definition of functions
> (possibly
> as extra include files) like this:
>
> define CSWpkgname_postinstall
> #!/bin/sh
>
> echo I'm the postinstall script for $(GARNAME) v$(GARVERSION).
>
> for i in /tmp/*; do
> echo Found $$i in /tmp;
> done
> endef
>
> This seems to work, but has a few drawbacks. As with shell snippets
> in regular rules, shell variables must be 'escaped' with $$. Also,
> due to the way GNU Make handles the 'defined' variables, \n\n* is
> collapsed to \n and any leading \t's are squished. This makes the
> resulting script less human readable (although the form stored in GAR
> can be as readable as a normal script).
>
> I should note that this would be an additional method for handling
> scripts. It wouldn't alter the traditional method in any way. You
> can mix an match to taste.
>
> Are others interested in something like this?
>
> Also, I'm not sure how this would interact with classutils. I'm not
> familiar at all with the workings there, so pointers as to how this
> would interact in that area are welcome.
This is definitely useful! It would be nice though to
have a more verbatim-type of definition...
Best regards
-- Dago
More information about the devel
mailing list