[csw-devel] dynamically generated adm scripts
Ben Walton
bwalton at opencsw.org
Mon Feb 9 20:18:23 CET 2009
Hi All,
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.
Thanks
-Ben
--
Ben Walton
Systems Programmer - CHASS
University of Toronto
C:416.407.5610 | W:416.978.4302
GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu
Contact me to arrange for a CAcert assurance meeting.
More information about the devel
mailing list