Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalwareutils.git;a=commitdiff;h=eed9e7698fb4cca06ce60b83aa8a380963dfa6bb

commit eed9e7698fb4cca06ce60b83aa8a380963dfa6bb
Author: James Buren <r...@frugalware.org>
Date:   Fri Feb 24 00:42:11 2012 -0600

add implementatio for 2nd libfwgrubconfig function

diff --git a/libfwgrubconfig/new.c b/libfwgrubconfig/new.c
index ae28730..793a4fd 100644
--- a/libfwgrubconfig/new.c
+++ b/libfwgrubconfig/new.c
@@ -121,12 +121,14 @@ int fwgrub_install(enum fwgrub_install_mode mode)
}

/* Setup logging. */
-       strcat(cmd,FWGRUB_LOGDEV " 2>&1");
+       strcat(cmd," > " FWGRUB_LOGDEV " 2>&1");

+       /* Let's do the splits! :D */
pid = fork();

if(!pid)
{
+               /* Execute the command in the child process. */
execl("/bin/sh","/bin/sh","-c",cmd,(void *) 0);

_exit(EXIT_FAILURE);
@@ -134,6 +136,35 @@ int fwgrub_install(enum fwgrub_install_mode mode)
else if(pid == -1)
return 1;

+       /* Did the process exit normally and return a zero exit code? */
+       if(waitpid(pid,&status,0) == -1 || !WIFEXITED(status) || 
WEXITSTATUS(status))
+               return 1;
+
+       return 0;
+}
+
+/** Creates a grub.cfg
+ * @return 0 on succcess, 1 on error
+ */
+int fwgrub_create_menu(void)
+{
+       pid_t pid;
+       int status;
+
+       /* Let's do the splits! :D */
+       pid = fork();
+
+       if(!pid)
+       {
+               /* Execute the command in the child process. */
+               execl("/bin/sh","/bin/sh","-c","grub-mkconfig -o 
/boot/grub/grub.cfg > " FWGRUB_LOGDEV " 2>&1", (void *) 0);
+
+               _exit(EXIT_FAILURE);
+       }
+       else if(pid == -1)
+               return 1;
+
+       /* Did the process exit normally and return a zero exit code? */
if(waitpid(pid,&status,0) == -1 || !WIFEXITED(status) || WEXITSTATUS(status))
return 1;
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to