SF.net SVN: morphix: [2280] trunk/mmaker/src/isomaker.c

[email protected]
Newsgroups gmane.linux.morphix.cvs
Message-ID <[email protected]>
Revision: 2280
Author:   alextreme
Date:     2006-05-30 14:47:34 -0700 (Tue, 30 May 2006)
ViewCVS:  http://svn.sourceforge.net/morphix/?rev=2280&view=rev

Log Message:
-----------
  * adding -n minimod.xml (via morphmini)

Modified Paths:
--------------
    trunk/mmaker/src/isomaker.c
Modified: trunk/mmaker/src/isomaker.c
===================================================================
--- trunk/mmaker/src/isomaker.c	2006-05-30 21:36:22 UTC (rev 2279)
+++ trunk/mmaker/src/isomaker.c	2006-05-30 21:47:34 UTC (rev 2280)
@@ -25,15 +25,17 @@
 
 /* fixed paths, FIXMOI */
 
+#define MORPHMINI_PATH "/usr/sbin/morphmini"
 #define MMAKER_PATH "/usr/sbin/mmaker"
 #define DEBGET_PATH "/usr/bin/deb-get"
 #define MAKEISO_PATH "/usr/bin/make-iso"
 
 void usage(gchar *filename) {
-	printf("Usage: %s -b basemod.xml [-g debootstrap.tar.gz] [-t tarball.tar.gz] [-m mainmod.xml] [-m mainmod2.xml] [-c] [-v] [-r repository [-p package1] [-p package2]] output.iso\n",filename);
+	printf("Usage: %s -b basemod.xml [-g debootstrap.tar.gz] [-t tarball.tar.gz] [-m mainmod.xml] [-m mainmod2.xml] [-n minimod1.xml] [-n minimod2.xml] [-c] [-v] [-r repository [-p package1] [-p package2]] output.iso\n",filename);
 
 	printf("\t-b:\tBase module template to build output.iso with\n");
 	printf("\t-m:\tMain module template to include in output.iso\n");
+	printf("\t-n:\tMini module template to include in output.iso (needs morphmini)\n");
 	printf("\t-r:\tspecify Repository for deb/udeb packages to include on iso\n");
 	printf("\t-p:\tPackages to be included on iso\n");
 	printf("\t-t:\tTarball to be included on iso\n");
@@ -41,7 +43,7 @@
 	printf("\t-c:\tClean temporary directories\n");
 	printf("\t-v:\tverbose mode\n");
 	printf("\nThis tool uses mmaker to generate a Morphix iso from scratch,\n");
-	printf("using one basemodule template, and arbitrary number of mainmodule templates,\nand optionally extra dpkg-deb-extracted deb/udeb packages\n\n");
+	printf("using one basemodule template, and arbitrary number of mainmodule and minimodule templates,\nand optionally extra dpkg-deb-extracted deb/udeb packages\n\n");
 	printf("\nIf you want to modify an existing iso, please take a look at isomorph from\nthe morphix repository, ");
 	printf("Isomorph also allows you to include mini modules, \nscripts, directly-copied and install-on-boot packages\n");
 	printf("\nThis tool is made possible by an infinite amount of monkeys\n");
@@ -98,6 +100,33 @@
 	}
 }
 
+void do_minimodules(gchar *workdir, GList *minimodxmllist) {
+	gint count = 0;
+	GList *ptr = NULL;
+	gchar *cmdline = NULL;
+
+	if (!g_file_test(MORPHMINI_PATH, G_FILE_TEST_EXISTS)) {
+		printf("Warning: morphmini not found, not building minimodules!\n");
+		return;
+	}
+
+	ptr = minimodxmllist;
+	while (ptr != NULL) {
+	        gchar *xmltemplate = (gchar *)ptr->data;
+		count++;
+		cmdline = g_strdup_printf("%s %s %s/minimod/minimod%d.mod",
+					  MORPHMINI_PATH,
+					  xmltemplate,
+					  workdir,
+					  count);
+		if (!executeCommandMain(cmdline)) {
+			printf("Warning: morphmini returned an error when building minimodule, continuing...\n");
+		}
+		g_free(cmdline);
+		ptr = ptr->next;
+	}
+}
+
 void do_packages(gchar *workdir, GList *packagelist, gboolean use_debget,gchar *repourl) {
 	GList *ptr = NULL;
 	gchar *cmdline = NULL;
@@ -179,6 +208,7 @@
 	gchar *debtarball = NULL;
 
 	GList *mainmodxmllist = NULL;
+	GList *minimodxmllist = NULL;
 	GList *packagelist = NULL;
 	GList *tarballlist = NULL;
 	GList *minirootlist = NULL;
@@ -206,6 +236,11 @@
 		  opts+=2;
 		  mainmodxmllist = g_list_append(mainmodxmllist,optarg);
 		  break;
+	  case 'n':
+		  // set debootstrapped base directory
+		  opts+=2;
+		  minimodxmllist = g_list_append(minimodxmllist,optarg);
+		  break;
 	  case 'r':
 		  opts+=2;
 		  if (repourl == NULL) {
@@ -332,6 +367,10 @@
 
 	do_mainmodules(workdir,mainmodxmllist,debtarball);
 
+	/* build and add minimodules */
+
+	do_minimodules(workdir,minimodxmllist);
+
 	/* package/repository stuff. yup, this is messy */
 
 	do_packages(workdir,packagelist,use_debget,repourl);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.