From: <ale...@us...> - 2006-03-21 16:39:55
|
Revision: 2147 Author: alextreme Date: 2006-03-21 08:38:46 -0800 (Tue, 21 Mar 2006) ViewCVS: http://svn.sourceforge.net/morphix/?rev=2147&view=rev Log Message: ----------- * adding Giulio's patch for adding -c to isomaker, use of tempdir Modified Paths: -------------- trunk/mmaker/src/isomaker.c Modified: trunk/mmaker/src/isomaker.c =================================================================== --- trunk/mmaker/src/isomaker.c 2006-03-20 21:35:49 UTC (rev 2146) +++ trunk/mmaker/src/isomaker.c 2006-03-21 16:38:46 UTC (rev 2147) @@ -38,6 +38,7 @@ printf("\t-p:\tPackages to be included on iso\n"); printf("\t-t:\tTarball to be included on iso\n"); printf("\t-g:\tTarball which contains a complete debootstrapped Debian\n\t\tsystem for building the base module (and any main modules)\n"); + 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"); @@ -81,7 +82,7 @@ gchar *cmdline = NULL; ptr = mainmodxmllist; while (ptr != NULL) { - gchar *xmltemplate = (gchar *)ptr->data; + gchar *xmltemplate = (gchar *)ptr->data; count++; cmdline = g_strdup_printf("%s -r %s %s %s/mainmod/mainmod%d.mod", MMAKER_PATH, @@ -170,6 +171,7 @@ gchar *basemodxml = NULL; gchar *repourl = NULL; gchar *workdir = NULL; + gchar *tempdir = NULL; gchar *cmdline = NULL; gchar *outputiso = NULL; gchar optchar; @@ -184,13 +186,14 @@ gint opts = 0; gboolean use_debget = TRUE; gboolean verbose = FALSE; + gboolean clean = FALSE; if (getuid() != 0) { fprintf(stderr,"You need to be root to use this tool! (mkisofs and chroot usage in mmaker)\n"); return(EXIT_FAILURE); } - while ((optchar = getopt(argc,argv,"b:m:r:g:t:p:v")) != -1) { + while ((optchar = getopt(argc,argv,"b:m:r:g:t:p:cv")) != -1) { switch (optchar) { case 'b': // set temporary directory @@ -223,6 +226,10 @@ opts+=2; tarballlist = g_list_append(tarballlist,optarg); break; + case 'c': + opts+=1; + clean = TRUE; + break; case 'v': opts+=1; verbose = TRUE; @@ -281,6 +288,13 @@ printf("Error: Unable to create temporary directory in %s for building in...\n",getTempRoot()); return(EXIT_FAILURE); } + + tempdir = getTempdir(); + if (tempdir == NULL) { + printf("Error: Unable to create temporary directory in %s for building in...\n",getTempRoot()); + return(EXIT_FAILURE); + } + if (g_file_test(DEBGET_PATH,G_FILE_TEST_EXISTS) == FALSE) { printf("Warning: Unable to find deb-get in: %s\n",DEBGET_PATH); printf("Continuing, however packages won't be retrieved or used\n"); @@ -299,9 +313,10 @@ /* build and add basemodule files */ - cmdline = g_strdup_printf("%s%s -m %s/boot/miniroot.gz -k %s/boot/vmlinuz %s %s %s/base/morphix", + cmdline = g_strdup_printf("%s%s -t %s -m %s/boot/miniroot.gz -k %s/boot/vmlinuz %s %s %s/base/morphix", MMAKER_PATH, (verbose ? " -v" : ""), + tempdir, workdir, workdir, basemodxml, @@ -339,8 +354,28 @@ printf("Info: Your live CD should be available as %s\n",outputiso); /* clean everything up... */ + if(clean){ + printf("Info: Cleaning up base module build directory %s\n",tempdir); + cmdline = g_strdup_printf("rm -rf %s",tempdir); + ExecuteCommand(cmdline); + g_free(cmdline); - printf("Info: Cleaning up (disabled, please remove %s manually)\n",workdir); + printf("Info: Cleaning up iso image build directory %s\n",workdir); + cmdline = g_strdup_printf("rm -rf %s",workdir); + ExecuteCommand(cmdline); + g_free(cmdline); + + printf("Info: Cleaning up miniroot %s/miniroot-dir\n",getTempRoot()); + cmdline = g_strdup_printf("rm -rf %s/miniroot-dir",getTempRoot()); + ExecuteCommand(cmdline); + g_free(cmdline); + } + else{ + printf("Info: Cleaning up disabled, please remove manually\n",tempdir); + printf("Info: base module build %s\n",tempdir); + printf("Info: iso image build %s\n",tempdir); + printf("Info: miniroot %s/miniroot-dir\n",getTempRoot()); + + } return (EXIT_SUCCESS); } - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |