From: <ale...@us...> - 2006-05-30 22:08:26
|
Revision: 2282 Author: alextreme Date: 2006-05-30 15:08:18 -0700 (Tue, 30 May 2006) ViewCVS: http://svn.sourceforge.net/morphix/?rev=2282&view=rev Log Message: ----------- * adding <commandlist><command></command></commandlist> tags * Brendan, could you give this a spin? Will package after you OK it :) Modified Paths: -------------- trunk/mmaker/README trunk/mmaker/README.isomaker trunk/mmaker/README.template trunk/mmaker/libmorphix/makemodule.c trunk/mmaker/libmorphix/parsemod.c trunk/mmaker/libmorphix/parsemod.h Modified: trunk/mmaker/README =================================================================== --- trunk/mmaker/README 2006-05-30 21:51:21 UTC (rev 2281) +++ trunk/mmaker/README 2006-05-30 22:08:18 UTC (rev 2282) @@ -35,7 +35,7 @@ How does it handle initialization of a module at runtime? --------------------------------------------------------- -The /morphix/init* scripts too are in the process of being debianified, light and gnome already are there. +The /morphix/init* scripts too are in the process of being debianified. Add one of the morphix-init-* packages, they are available for most windowmanagers. Files in morphix-init contain the basics, should be easy to fork & customize. How do I make/install mmaker? ----------------------------- Modified: trunk/mmaker/README.isomaker =================================================================== --- trunk/mmaker/README.isomaker 2006-05-30 21:51:21 UTC (rev 2281) +++ trunk/mmaker/README.isomaker 2006-05-30 22:08:18 UTC (rev 2282) @@ -10,6 +10,7 @@ morphix-mmaker morphix-make-iso morphix-deb-get +morphix-morphmini Usage: ------ @@ -18,6 +19,7 @@ -b: Base module template to build output.iso with -m: Main module template to include in output.iso + -n: Mini module template to include in output.iso (needs morphmini) -r: Specify repository for deb/udeb packages to include on iso -p: Packages to be included on iso -t: Tarball to be included on iso Modified: trunk/mmaker/README.template =================================================================== --- trunk/mmaker/README.template 2006-05-30 21:51:21 UTC (rev 2281) +++ trunk/mmaker/README.template 2006-05-30 22:08:18 UTC (rev 2282) @@ -61,10 +61,18 @@ <!-- package to apt-get purge --> ... </packagelist> + <patchlist> <patch>path/to/shellscript.sh</patch> ( <!-- shell script on HOST system, gets the build directory as $1 --> </patchlist> + + <commandlist> + + <command>echo "Real Morphers idle on #morphix"</command> ( + <!-- shell command run in the build chroot, just before compressing --> + </commandlist> + </group> </comps> Modified: trunk/mmaker/libmorphix/makemodule.c =================================================================== --- trunk/mmaker/libmorphix/makemodule.c 2006-05-30 21:51:21 UTC (rev 2281) +++ trunk/mmaker/libmorphix/makemodule.c 2006-05-30 22:08:18 UTC (rev 2282) @@ -528,6 +528,37 @@ } /** + Executes shell commands, defined in the xml file. + + @param module mmodule*; module structure, initialised + @param dirname gchar*; location of the directory + + return TRUE if successful, FALSE and message to stderr if an error occurred +*/ + +gboolean executeCommands(mmodule *module, gchar *dirname) { + GList *ptr = module->commandlist; + while (ptr != NULL) { + gchar *cmdline = NULL; + gchar *command = ptr->data; + + if (command == NULL) + continue; + + cmdline = g_strdup_printf("%s %s %s",P_CHROOT,module->dirname,command); + if (!ExecuteCommand(cmdline)) { + fprintf(stderr,"Warning: unable to execute command: %s\n", command); + g_free(command); + g_free(cmdline); + continue; + } + g_free(cmdline); + ptr = ptr->next; + } + return TRUE; +} + +/** Reverts debconf to normal usage @param dirname gchar*; location of the module @@ -1088,6 +1119,9 @@ if (!executePatches(module,module->dirname)) { return FALSE; } + if (!executeCommands(module,module->dirname)) { + return FALSE; + } if (!compressModule(module,outputfilename,leave_dir,FS_ISO9660,module->name)) { return FALSE; @@ -1116,6 +1150,9 @@ if (!executePatches(module,module->dirname)) { return FALSE; } + if (!executeCommands(module,module->dirname)) { + return FALSE; + } if (!compressModule(module,outputfilename,leave_dir,FS_ISO9660,module->name)) { return FALSE; Modified: trunk/mmaker/libmorphix/parsemod.c =================================================================== --- trunk/mmaker/libmorphix/parsemod.c 2006-05-30 21:51:21 UTC (rev 2281) +++ trunk/mmaker/libmorphix/parsemod.c 2006-05-30 22:08:18 UTC (rev 2282) @@ -236,6 +236,21 @@ return module; } +mmodule* parseCommandlist(xmlDocPtr doc, xmlNodePtr cur, mmodule *module) { + xmlChar *key; + cur = cur->xmlChildrenNode; + module->commandlist = NULL; + while (cur != NULL) { + if (!xmlStrcmp(cur->name, ((const xmlChar *)"command"))) { + key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); + module->commandlist = g_list_append(module->commandlist,g_strdup(key)); + xmlFree(key); + } + cur = cur->next; + } + return module; +} + void initPackage(package_struct *package) { package->name = NULL; package->target = NULL; @@ -254,6 +269,7 @@ module->packagelist = NULL; module->packagedeletelist = NULL; module->patchlist = NULL; + module->commandlist = NULL; module->arch = NULL; module->verbose = FALSE; module->interactive = FALSE; @@ -312,6 +328,9 @@ if (!xmlStrcmp(cur->name, ((const xmlChar *)"patchlist"))) { parsePatchlist(doc,cur,module); } + if (!xmlStrcmp(cur->name, ((const xmlChar *)"commandlist"))) { + parseCommandlist(doc,cur,module); + } cur = cur->next; } return module; @@ -391,6 +410,14 @@ } g_list_free(module->patchlist); } + if (module->commandlist != NULL) { + GList *ptr = module->commandlist; + while (ptr != NULL) { + g_free(ptr->data); + ptr = ptr->next; + } + g_list_free(module->commandlist); + } g_free(module); } Modified: trunk/mmaker/libmorphix/parsemod.h =================================================================== --- trunk/mmaker/libmorphix/parsemod.h 2006-05-30 21:51:21 UTC (rev 2281) +++ trunk/mmaker/libmorphix/parsemod.h 2006-05-30 22:08:18 UTC (rev 2282) @@ -48,6 +48,7 @@ GList *packagelist; // list of package structs GList *packagedeletelist; // list of package structs GList *patchlist; // list of names of patches for module + GList *commandlist; // list of commands for module GList *retrievelist; // list of to/from combinations gboolean verbose; // build verbosely This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |