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

commit ee012a28e70b646d7fb019de084af6b61e18e495
Author: Miklos Vajna <[email protected]>
Date:   Thu Mar 8 21:57:41 2012 +0100

frugalwareutils-0.9.8-1-x86_64

- version bump

diff --git a/source/base/frugalwareutils/FrugalBuild 
b/source/base/frugalwareutils/FrugalBuild
index 32e7e36..6065300 100644
--- a/source/base/frugalwareutils/FrugalBuild
+++ b/source/base/frugalwareutils/FrugalBuild
@@ -7,9 +7,9 @@ USE_APIDOCS=${USE_APIDOCS:-"y"}
[ "$CARCH" = "arm" ] && USE_APIDOCS=n

pkgname=frugalwareutils
-pkgver=0.9.7
+pkgver=0.9.8
Fuse $USE_DEVEL && pkgver=0.8.7.6.g3d85830
-pkgrel=4
+pkgrel=1
pkgdesc="Frugalware configuration utilities."
url="http://ftp.frugalware.org/pub/other/frugalwareutils";
depends=('glib2>=2.16.4-2' 'ncurses>=5.6-4' 'parted>=3.0' \
@@ -23,8 +23,8 @@ replaces=('kxgenerator')
archs=('i686' 'x86_64' 'ppc' 'arm')
up2date="lynx -dump $url|Flasttar"
if ! Fuse $USE_DEVEL; then
-       source=($url/$pkgname-$pkgver.tar.gz $pkgname-grub2.patch)
-       signatures=(${source[0]}.asc '')
+       source=($url/$pkgname-$pkgver.tar.gz)
+       signatures=(${source[0]}.asc)
else
_F_scm_type="git"
_F_scm_url="git://git.frugalware.org/pub/other/frugalwareutils/frugalwareutils"
diff --git a/source/base/frugalwareutils/frugalwareutils-grub2.patch 
b/source/base/frugalwareutils/frugalwareutils-grub2.patch
deleted file mode 100644
index 79a7720..0000000
--- a/source/base/frugalwareutils/frugalwareutils-grub2.patch
+++ /dev/null
@@ -1,1016 +0,0 @@
-diff --git a/grubconfig/grubconfig.c b/grubconfig/grubconfig.c
-index 0622bfe..392c8d3 100644
---- a/grubconfig/grubconfig.c
-+++ b/grubconfig/grubconfig.c
-@@ -1,8 +1,8 @@
- /*
-  *  grubconfig.c for frugalwareutils
-- *
-+ *
-  *  Copyright (c) 2003-2006 by Miklos Vajna <[email protected]>
-- *
-+ *
-  *  This program is free software; you can redistribute it and/or modify
-  *  it under the terms of the GNU General Public License as published by
-  *  the Free Software Foundation; either version 2 of the License, or
-@@ -15,7 +15,7 @@
-  *
-  *  You should have received a copy of the GNU General Public License
-  *  along with this program; if not, write to the Free Software
-- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-  *  USA.
-  */
-
-@@ -32,45 +32,37 @@
- #include <unistd.h>
- #include <libintl.h>
-
--int ask_mode()
-+static
-+enum fwgrub_install_mode ask_mode()
- {
--      char *modes[] =
-+      char *modes[] =
-       {
-               _("MBR"), _("Install to Master Boot Record"),
--              _("Floppy"), _("Install to a formatted floppy in /dev/fd0"),
--              // see see 
http://lists.gnu.org/archive/html/bug-grub/2003-11/msg00085.html
--              _("Root"), _("Install to superblock (do NOT use with XFS)"),
-               _("Skip"), _("Skip the installation of GRUB.")
-       };
-       char *ptr;
--      int ret=0;
-+      enum fwgrub_install_mode ret=-1;
-
-       ptr = fwdialog_menu(_("Installing GRUB bootloader"),
-               _("GRUB can be installed to a variety of places:\n\n"
-               "\t1. The Master Boot Record of your first hard drive.\n"
--              "\t2. A formatted floppy disk.\n"
--              "\t3. The superblock of your root Linux partition.\n\n"
--              "Option 3 requires setting the partition bootable with 
(c)fdisk\n"
--              "Hint: Choose option 3 if you already have a boot manager 
installed.\n"
--              "Which option would you like?"), 0, 0, 0, 4, modes);
-+              "Which option would you like?"), 0, 0, 0, 2, modes);
-       if(!strcmp(ptr, _("MBR")))
--              ret=0;
--      if(!strcmp(ptr, _("Floppy")))
--              ret=1;
--      if(!strcmp(ptr, _("Root")))
--              ret=2;
--      if(!strcmp(ptr, _("Skip")))
--              ret=3;
-+              ret=FWGRUB_INSTALL_MBR;
-+      else if(!strcmp(ptr, _("Skip")))
-+              ret=-1;
-       free(ptr);
-       return(ret);
- }
-
-+static
- int run(int argc, char **argv)
- {
-       FILE *input = stdin, *fp;
-       dialog_state.output = stderr;
--      int mode, needrelease;
-+      int needrelease;
-       struct stat buf;
-+      enum fwgrub_install_mode mode;
-
-       if(argc > 1)
-       {
-@@ -91,20 +83,12 @@ int run(int argc, char **argv)
-       fwdialog_backtitle(_("GRUB bootloader"));
-
-       mode = ask_mode();
--      if(mode!=3)
-+      if(mode!=-1)
-       {
-               dialog_msgbox(_("Please wait"), _("Attempting to install the 
GRUB bootloader..."), 0, 0, 0);
-               needrelease = fwutil_init();
-               fwgrub_install(mode);
--              // backup the old config if there is any
--              if(!stat("/boot/grub/menu.lst", &buf))
--                      rename("/boot/grub/menu.lst", 
"/boot/grub/menu.lst.old");
--              fp = fopen("/boot/grub/menu.lst", "w");
--              if(fp)
--              {
--                      fwgrub_create_menu(fp);
--                      fclose(fp);
--              }
-+              fwgrub_make_config();
-               if(needrelease)
-                       fwutil_release();
-       }
-diff --git a/libfwgrubconfig/Makefile b/libfwgrubconfig/Makefile
-index f2e406a..f31b117 100644
---- a/libfwgrubconfig/Makefile
-+++ b/libfwgrubconfig/Makefile
-@@ -18,12 +18,6 @@
-
- -include ../config.mak
- CFLAGS = $(LIB_CFLAGS)
--CFLAGS += $(shell pkg-config --cflags glib-2.0)
--LDFLAGS += $(shell pkg-config --libs glib-2.0)
--CFLAGS += $(shell pkg-config --cflags blkid)
--LDFLAGS += $(shell pkg-config --libs blkid)
--
--LDFLAGS += -lparted
-
- # fwutil
- CFLAGS += -I../libfwutil
-diff --git a/libfwgrubconfig/libfwgrubconfig.c 
b/libfwgrubconfig/libfwgrubconfig.c
-index 5df62b8..721b34a 100644
---- a/libfwgrubconfig/libfwgrubconfig.c
-+++ b/libfwgrubconfig/libfwgrubconfig.c
-@@ -1,8 +1,8 @@
- /*
-  *  libfwgrubconfig.c for frugalwareutils
-- *
-+ *
-  *  Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 by Miklos Vajna 
<[email protected]>
-- *
-+ *
-  *  This program is free software; you can redistribute it and/or modify
-  *  it under the terms of the GNU General Public License as published by
-  *  the Free Software Foundation; either version 2 of the License, or
-@@ -15,760 +15,127 @@
-  *
-  *  You should have received a copy of the GNU General Public License
-  *  along with this program; if not, write to the Free Software
-- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-  *  USA.
-  */
-
-+#include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
--#include <sys/types.h>
--#include <dirent.h>
--#include <sys/stat.h>
-+#include <regex.h>
- #include <unistd.h>
-+#include <limits.h>
-+#include <sys/stat.h>
-+#include <sys/wait.h>
- #include <errno.h>
--#include <unistd.h>
--#include <fcntl.h>
--#include <sys/ioctl.h>
--#include <mntent.h>
--#include <sys/utsname.h>
--#include <ctype.h>
--#include <stdlib.h>
--#include <libfwutil.h>
--#include <glib.h>
--#include <blkid.h>
--
- #include "libfwgrubconfig.h"
-
--typedef struct mdu_version_s {
--      int major;
--      int minor;
--      int patchlevel;
--} mdu_version_t;
--#define MD_MAJOR 9
--#define RAID_VERSION            _IOR (MD_MAJOR, 0x10, mdu_version_t)
--#define BLKGETSIZE64 _IOR(0x12,114,size_t)
-+#define SPACE         " \t\r\n\v\f"
-+#define DIGIT         "0123456789"
- #define FWGRUB_LOGDEV "/dev/tty4"
-
--struct fwgrub_entry_t {
--      FILE *fp;
--      char *title;
--      char *initrd;
--      char *grubbootdev;
--      char *bootstr;
--      char *kernel;
--      char *rootdev;
--      char *opts;
--      char *type;
--};
--
--
--/** @defgroup libfwgrubconfig Frugalware GRUB Configuration library
-- * @brief Functions to make GRUB configuration easier
-+/** @defgroup libfwgrubconfig Frugalware GRUB configuration and installation 
library
-+ * @brief Functions to make GRUB configuration and installation easier
-  * @{
-  */
-
--/* find_dev_recursive() and find_dev() is based on Linus's original rdev */
--static int find_dev_recursive(char *dirnamebuf, int number)
--{
--      DIR *dp;
--      struct dirent *dir;
--      struct stat s;
--      int dirnamelen = 0;
--
--      if ((dp = opendir(dirnamebuf)) == NULL)
--              return(0);
--      dirnamelen = strlen(dirnamebuf);
--      while ((dir = readdir(dp)) != NULL)
--      {
--              if (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, ".."))
--                      continue;
--              if (dirnamelen + 1 + strlen(dir->d_name) > PATH_MAX)
--                      continue;
--              dirnamebuf[dirnamelen] = '/';
--              strcpy(dirnamebuf+dirnamelen+1, dir->d_name);
--              if (lstat(dirnamebuf, &s) < 0)
--                      continue;
--              if ((s.st_mode & S_IFMT) == S_IFBLK && s.st_rdev == number)
--                      return(1);
--              if ((s.st_mode & S_IFMT) == S_IFDIR &&
--                              find_dev_recursive(dirnamebuf, number))
--                      return(1);
--      }
--      dirnamebuf[dirnamelen] = 0;
--      closedir(dp);
--      return(0);
--}
--
--static char *find_dev(int n)
-+static
-+char *guess_mbr_device(void)
- {
--      char path[PATH_MAX+1];
--      if (!n)
--              return(NULL);
--      strcpy(path, "/dev");
--      if(find_dev_recursive(path, n))
--              return(strdup(path));
--      return(NULL);
--}
-+      FILE *f;
-+      char line[LINE_MAX], *p;
-+      int i, j;
-+      regex_t re;
-+      static char root[PATH_MAX];
-
--static char *find_rootdev()
--{
--      struct stat buf;
-+      f = fopen("/proc/partitions","rb");
-
--      if(!stat("/",&buf))
--              return(find_dev(buf.st_dev));
--      return(NULL);
--}
--
--/* Copyright (C) 2001-2006 Neil Brown <[email protected]> */
--static int md_get_version(int fd)
--{
--      struct stat stb;
--      mdu_version_t vers;
--
--      if (fstat(fd, &stb)<0)
--              return(1);
--      if ((S_IFMT&stb.st_mode) != S_IFBLK)
--              return(1);
--      if (ioctl(fd, RAID_VERSION, &vers) == 0)
--              return(0);
--      return(1);
--}
-+      if(!f)
-+              return 0;
-
--static int is_raid1_device(char *dev)
--{
--      int fd;
--
--      fd = open(dev, O_RDWR, 0);
--      if (md_get_version(fd))
--              return(0);
--      else
--              return(1);
--}
-+      if(regcomp(&re,"^[shv]d[a-z]$",REG_EXTENDED | REG_NOSUB | REG_NEWLINE))
-+      {
-+              fclose(f);
-
--static GList *find_real_devs(char *dev)
--{
--      GList *ret=NULL;
--      FILE *fp;
--      char line[PATH_MAX];
--      char *str, *ptr, *rdev;
--
--      // drop "/dev/"
--      dev += 5;
-+              return 0;
-+      }
-
--      fp = fopen("/proc/mdstat", "r");
--      if(!fp)
--              return(NULL);
-+      for( i = 1, *root = 0 ; fgets(line,sizeof line,f) ; ++i )
-+      {
-+              if(i < 3)
-+                      continue;
-
--      while(fgets(line, PATH_MAX, fp))
--              if(!strncmp(line, dev, strlen(dev)))
--                      break;
-+              p = line + strspn(line,SPACE);
-
--      str = line;
--      while((str = strstr(str, "[")))
--      {
--              rdev = str;
--              while(*rdev!=' ')
--                      rdev--;
--              rdev=strdup(++rdev);
--              if((ptr = strstr(rdev, "[")))
--                      *ptr='\0';
--              ret = g_list_append(ret, rdev);
--              str++;
--      }
--      fclose(fp);
--      return(ret);
--}
-+              for( j = 0 ; j < 3 ; ++j )
-+              {
-+                      p += strspn(p,DIGIT);
-
--// mode - 0: partition, 1: disk
--static char *grub_convert(char *dev, int mode)
--{
--      char *disk, *ptr, *grubdisk;
--      char line[PATH_MAX];
--      int partnum=0;
--      FILE *fp;
-+                      p += strspn(p,SPACE);
-+              }
-
--      // disk
--      disk = strdup(dev);
--      ptr = disk;
--      while(*++ptr)
--              if(isdigit(*ptr))
-+              if(!regexec(&re,p,0,0,0))
-               {
--                      *ptr='\0';
-+                      strcpy(root,"/dev/");
-+                      strcat(root,p);
-+                      p = strchr(root,'\n');
-+                      if(p)
-+                              *p = 0;
-                       break;
-               }
--
--      // partnum
--      if(!mode)
--      {
--              ptr = dev;
--              while(*++ptr)
--                      if(isdigit(*ptr))
--                              break;
--              partnum = atoi(ptr);
-       }
-
--      // grubdisk
--      fp = fopen("/boot/grub/device.map", "r");
--      if(!fp)
--              return(NULL);
--
--      while(fgets(line, PATH_MAX, fp))
--              if(strstr(line, disk))
--                      break;
--      fclose(fp);
--      grubdisk = strdup(line+1);
--      ptr = grubdisk;
--      while(*++ptr)
--              if(*ptr==')')
--                      break;
--      *ptr='\0';
--
--      if(partnum)
--              ptr = g_strdup_printf("(%s,%d)", grubdisk, --partnum);
--      else
--              ptr = g_strdup_printf("(%s)", grubdisk);
--      free(disk);
--      free(grubdisk);
--      return(ptr);
--}
--
--static char *get_mbr_dev()
--{
--      FILE *fp;
--      char line[PATH_MAX], *str=NULL, *ptr;
--      int i=0;
--
--      fp = fopen("/proc/partitions", "r");
--      if(!fp)
--              return(NULL);
--      while(fgets(line, PATH_MAX, fp))
--      {
--              if(i++ < 2 || strstr(line, "ram"))
--                      continue;
--              else
--                      break;
--      }
--      fclose(fp);
--      ptr=line;
--      while(*++ptr)
--              if(*ptr==' ')
--                      str = ptr+1;
--      // drop the \n from the end
--      if(!str)
--              return(NULL);
--      *(str+strlen(str)-1)='\0';
--      return(g_strdup_printf("/dev/%s", str));
--}
-+      fclose(f);
-
--static char *get_swap_dev()
--{
--      char line[PATH_MAX], *ptr;
--      int i = 0;
--      FILE *fp = fopen("/proc/swaps", "r");
-+      regfree(&re);
-
--      if (!fp)
--              return NULL;
--      while (fgets(line, PATH_MAX, fp))
--      {
--              if (!i++)
--                      continue;
--              else
--                      break;
--      }
--      if (i == 1)
--              return NULL;
--      fclose(fp);
--      ptr = strchr(line, ' ');
--      if (ptr)
--              *ptr = '\0';
--      return g_strdup(line);
-+      return (*root) ? root : 0;
- }
-
--
- /** Installs grub to a given target
-- * @param mode 0: mbr, 1: floppy, 2: root
-+ * @param mode FWGRUB_INSTALL_MBR, FWGRUB_INSTALL_EFI
-  * @return 0 on succcess, 1 on error
-  */
--int fwgrub_install(int mode)
--{
--      char *rootdev=find_rootdev();
--      FILE *pp;
--      int i, ret=0;
--
--      if(is_raid1_device(rootdev))
--      {
--              // manual installation
--              DIR *dir;
--              struct dirent *ent;
--              char src[PATH_MAX], dest[PATH_MAX];
--
--              dir = opendir("/usr/lib/grub/i386-frugalware");
--              if (!dir)
--                      return(1);
--              while ((ent = readdir(dir)) != NULL)
--              {
--                      if (!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, 
".."))
--                              continue;
--                      snprintf(src, PATH_MAX, 
"/usr/lib/grub/i386-frugalware/%s", ent->d_name);
--                      snprintf(dest, PATH_MAX, "/boot/grub/%s", ent->d_name);
--                      fwutil_cp(src, dest);
--              }
--              pp = popen("grub --batch --device-map=/boot/grub/device.map %s 
>"
--                      FWGRUB_LOGDEV " 2>&1", "w");
--              if(!pp)
--                      return(1);
--              fprintf(pp, "quit\n");
--              pclose(pp);
--              if(mode==0)
--              {
--                      // mbr
--                      char *ptr = NULL;
--                      GList *devs = find_real_devs(rootdev);
--                      for(i=0;i<g_list_length(devs);i++)
--                      {
--                              char *dev = g_list_nth_data(devs, i);
--                              pp = popen("grub --batch %s >" FWGRUB_LOGDEV
--                                      " 2>&1", "w");
--                              if(!pp)
--                                      return(1);
--                              ptr = grub_convert(dev, 0);
--                              fprintf(pp, "root %s\n", ptr);
--                              free(ptr);
--                              ptr = grub_convert(dev, 1);
--                              fprintf(pp, "setup %s\n", ptr);
--                              free(ptr);
--                              pclose(pp);
--                      }
--              }
--              /* else if(mode==1)
--               * TODO: floppy */
--              else if(mode==2)
--              {
--                      // root
--                      char *ptr = NULL;
--                      GList *devs = find_real_devs(rootdev);
--                      for(i=0;i<g_list_length(devs);i++)
--                      {
--                              char *dev = g_list_nth_data(devs, i);
--                              pp = popen("grub --batch %s >" FWGRUB_LOGDEV
--                                      " 2>&1", "w");
--                              if(!pp)
--                                      return(1);
--                              ptr = grub_convert(dev, 0);
--                              fprintf(pp, "root %s\n", ptr);
--                              free(ptr);
--                              ptr = grub_convert(dev, 0);
--                              fprintf(pp, "setup %s\n", ptr);
--                              free(ptr);
--                              pclose(pp);
--                      }
--              }
--      }
--      else
--      {
--              char *dev=NULL, *ptr;
--              if(mode==0)
--                      dev=get_mbr_dev();
--              if(mode==1)
--                      dev=strdup("/dev/fd0");
--              if(mode==2)
--                      dev=rootdev;
--              if(mode!=1)
--              {
--                      if (strncmp(dev, "/dev/vd", 7))
--                              ptr = g_strdup_printf("grub-install --no-floppy 
--recheck %s >"
--                                      FWGRUB_LOGDEV " 2>&1", dev);
--                      else
--                      {
--                              // we need to generate device.map
--                              // manually for virtio
--                              FILE *fp = fopen("/boot/grub/device.map", "w");
--                              fprintf(fp, "(hd0) %s\n", dev);
--                              fclose(fp);
--                              ptr = g_strdup_printf("grub-install --no-floppy 
%s >"
--                                      FWGRUB_LOGDEV " 2>&1", dev);
--                      }
--              }
--              else
--                      ptr = g_strdup_printf("grub-install %s >"
--                              FWGRUB_LOGDEV " 2>&1", dev);
--              if(dev!=rootdev)
--                      free(dev);
--              if((ret=system(ptr)))
--                      // this is needed for reiser, somehow the install is ok 
for the second time
--                      ret = system(ptr);
--              free(ptr);
--      }
--      free(rootdev);
--      return(ret);
--}
-
--/* based on coreutils/df.c, Copyright (C) 91, 1995-2004 Free Software 
Foundation, Inc. */
--static char *find_mount_point(char *dir)
-+int fwgrub_install(enum fwgrub_install_mode mode)
- {
--      char cwd[PATH_MAX] = "";
--      char mp[PATH_MAX] = "";
--      struct stat buf, last;
-+      char cmd[_POSIX_ARG_MAX], *mbr;
-+      struct stat st;
-
--      getcwd(cwd, PATH_MAX);
--      stat(dir, &buf);
--      last=buf;
--      chdir(dir);
-+      /* First, define the common parts of the install command. */
-+      strcpy(cmd,"grub-install --recheck --no-floppy --boot-directory=/boot 
");
-
--      /* Now walk up DIR's parents until we find another filesystem or /,
--       * chdiring as we go. LAST holds stat information for the last place
--       * we visited.  */
--      while(1)
-+      /* Now, define additional arguments based on installation mode. */
-+      switch(mode)
-       {
--              struct stat st;
--              stat("..", &st);
--              if(st.st_dev != last.st_dev || st.st_ino == last.st_ino)
--                      /* cwd is the mount point.  */
-+              case FWGRUB_INSTALL_MBR:
-+                      mbr = guess_mbr_device();
-+                      if(!mbr)
-+                              return 1;
-+                      strcat(cmd,mbr);
-                       break;
--              chdir("..");
--              last=st;
--      }
--      getcwd(mp, PATH_MAX);
--      chdir(cwd);
--      return(strdup(mp));
--}
--
--static char *mount_dev(char *path)
--{
--      struct mntent *mnt;
--      char *table = MOUNTED;
--      FILE *fp;
--
--      fp = setmntent (table, "r");
--      if(fp)
--      {
--              while ((mnt = getmntent (fp)))
--                      if(!strcmp(mnt->mnt_dir, path) && ! 
(!strcmp(mnt->mnt_fsname, "rootfs") || !strcmp(mnt->mnt_fsname, "/dev/root")))
--                              break;
--              endmntent(fp);
--              if(mnt)
--                      return(strdup(mnt->mnt_fsname));
--      }
--      // not found? then it must be a pre-initrd root device, look it up from 
/proc/cmdline
--      fp = fopen("/proc/cmdline", "r");
--      char line[PATH_MAX];
--      if (fp)
--              fgets(line, 512, fp);
--      // skip everything before root= and after a space
--      char *ptr = strstr(line, "root=") + 5;
--      if (strchr(ptr, ' '))
--              *(strchr(ptr, ' ')) = '\0';
--      fclose(fp);
--      return(strdup(ptr));
--}
--
--static char* get_uuid(char *device)
--{
--      char path[PATH_MAX];
--      int fd;
--      blkid_probe pr = NULL;
--      uint64_t size;
--      const char *uuid;
--      char *ret;
--
--      if(!device || !strlen(device))
--              return NULL;
--
--      fd = open(device, O_RDONLY);
-
--      if (fd < 0)
--              return NULL;
--
--      pr = blkid_new_probe();
--      blkid_probe_set_request (pr, BLKID_PROBREQ_UUID);
--      ioctl(fd, BLKGETSIZE64, &size);
--      blkid_probe_set_device(pr, fd, 0, size);
--      blkid_do_safeprobe(pr);
--      blkid_probe_lookup_value(pr, "UUID", &uuid, NULL);
--      snprintf(path, PATH_MAX, "/dev/disk/by-uuid/%s", uuid);
--      ret = strdup(path);
--      blkid_free_probe(pr);
--      close(fd);
--      return ret;
--}
--
--static int write_entry(struct fwgrub_entry_t *entry)
--{
--      char *ptr;
--
--      if(!entry || !entry->fp)
--              return(1);
--      fprintf(entry->fp, "title %s\n", entry->title);
--      fflush(entry->fp); // debug help
--      if(!entry->type || !strcmp(entry->type, "linux"))
--      {
--              if(entry->opts)
--              {
--                      if(entry->rootdev && strlen(entry->rootdev))
--                      {
--                              char *uuid = get_uuid(entry->rootdev);
--                              fprintf(entry->fp, "\tkernel %s%s%s root=%s 
%s\n",
--                                      entry->grubbootdev, entry->bootstr, 
entry->kernel, uuid, entry->opts);
--                              free(uuid);
--                      }
--                      else
--                              // probably rootdev is already included in 
->opts
--                              fprintf(entry->fp, "\tkernel %s%s%s %s\n",
--                                      entry->grubbootdev, entry->bootstr, 
entry->kernel, entry->opts);
--              }
--              else
--              {
--                      fprintf(entry->fp, "\tkernel %s%s%s\n",
--                              entry->grubbootdev, entry->bootstr, 
entry->kernel);
--              }
--              if(entry->initrd)
--                      fprintf(entry->fp,"\tinitrd %s%s%s\n",
--                              entry->grubbootdev, entry->bootstr, 
entry->initrd);
--              putc('\n',entry->fp);
--      }
--      else if(!strcmp(entry->type, "chain"))
--      {
--              ptr = grub_convert(entry->rootdev, 0);
--              fprintf(entry->fp, "\trootnoverify %s\n", ptr);
--              free(ptr);
--              fprintf(entry->fp, "\tchainloader +1\n\n");
-+              case FWGRUB_INSTALL_EFI:
-+                      strcat(cmd,"--root-directory=/boot/efi 
--bootloader-id=frugalware");
-+                      if(!stat("/boot/efi",&st) && !S_ISDIR(st.st_mode))
-+                              return 1;
-+                      else if(mkdir("/boot/efi",0755))
-+                              return 1;
-+                      break;
-       }
--      // TODO: else if(!strcmp(entry->type, "hurd"))
--      fflush(entry->fp);
--      return(0);
--}
--
--static char *gen_title()
--{
--      struct utsname name;
--      FILE *fp;
--      char line[PATH_MAX];
--
--      fp = fopen("/etc/frugalware-release", "r");
--      if(!fp)
--              return(NULL);
--      if(!fgets(line, PATH_MAX, fp))
--              return(NULL);
--      line[strlen(line)-1]='\0';
--      uname(&name);
--      return(g_strdup_printf("%s - %s", line, name.release));
--}
--
--static void entry_free(struct fwgrub_entry_t *entry)
--{
--      if(entry->title)
--              free(entry->title);
--      if(entry->grubbootdev)
--              free(entry->grubbootdev);
--      if(entry->bootstr)
--              free(entry->bootstr);
--      if(entry->kernel)
--              free(entry->kernel);
--      if(entry->initrd)
--              free(entry->initrd);
--      if(entry->rootdev)
--              free(entry->rootdev);
--      if(entry->opts)
--              free(entry->opts);
--}
-
--static int os_prober(FILE *fp)
--{
--      struct stat buf;
--      FILE *pp;
--      char line[PATH_MAX], *ptr, *bootdev;
--      struct fwgrub_entry_t *entry;
--      GList *entries=NULL;
--      int i;
--
--      if(stat("/usr/bin/os-prober", &buf))
--              return(1);
--
--      pp = popen("os-prober 2>/dev/null", "r");
--      if(!pp)
--              return(1);
--      while(fgets(line, PATH_MAX, pp))
--      {
--              entry = (struct fwgrub_entry_t*)malloc(sizeof(struct 
fwgrub_entry_t));
--              if(!entry)
--                      return(1);
--              entry->fp=fp;
--              // rootdev
--              entry->rootdev = strdup(line);
--              ptr = entry->rootdev;
--              while(*++ptr)
--                      if(*ptr==':')
--                              break;
--              *ptr='\0';
--
--              // title
--              entry->title = ptr+1;
--              while(*++ptr)
--                      if(*ptr==':')
--                              break;
--              *ptr='\0';
--
--              // shorname is useless for us
--              while(*++ptr)
--                      if(*ptr==':')
--                              break;
--
--              // type
--              entry->type = ptr+1;
--              while(*++ptr)
--                      if(*ptr==':')
--                              break;
--              *ptr='\0';
--              // this is the last one, slice the \n from the end
--              entry->type[strlen(entry->type)-1]='\0';
--              entries = g_list_append(entries, entry);
--      }
--      pclose(pp);
--      for(i=0;i<g_list_length(entries);i++)
--      {
--              entry = g_list_nth_data(entries, i);
--              if(!strcmp(entry->type, "linux"))
--              {
--                      if(stat("/usr/bin/linux-boot-prober", &buf))
--                              continue;
-+      /* Setup logging. */
-+      strcat(cmd," > " FWGRUB_LOGDEV " 2>&1");
-
--                      ptr = g_strdup_printf("linux-boot-prober %s", 
entry->rootdev);
--                      pp = popen(ptr, "r");
--                      free(ptr);
--                      if(!pp)
--                              return(1);
--                      // only the first line matters
--                      if(fgets(line, PATH_MAX, pp))
--                      {
--                              // rootdev, junk
--                              ptr = line;
--                              while(*++ptr)
--                                      if(*ptr==':')
--                                              break;
--                              // bootdev
--                              bootdev = strdup(ptr+1);
--                              while(*++ptr)
--                                      if(*ptr==':')
--                                              break;
--                              *ptr='\0';
--                              if(!strcmp(entry->rootdev, bootdev))
--                                      entry->bootstr = strdup("/boot");
--                              else
--                                      entry->bootstr = strdup("");
--                              // ->rootdev already included in ->opts. clear 
it here since
--                              // we needed it only for ->bootstr
--                              entry->rootdev='\0';
--                              entry->grubbootdev = grub_convert(bootdev, 0);
--                              // title, junk
--                              while(*++ptr)
--                                      if(*ptr==':')
--                                              break;
--                              // kernel
--                              entry->kernel = ptr+1;
--                              while(*++ptr)
--                                      if(*ptr==':')
--                                              break;
--                              *ptr='\0';
--                              // initrd, maybe useful later
--                              entry->initrd = NULL;
--                              while(*++ptr)
--                                      if(*ptr==':')
--                                              break;
--                              // opts
--                              entry->opts = ptr+1;
--                              // this is the last one, slice the \n from the 
end
--                              entry->opts[strlen(entry->opts)-1]='\0';
--                      }
--                      pclose(pp);
--                      write_entry(entry);
--                      free(entry->grubbootdev);
--                      free(entry->bootstr);
--              }
--              else if(!strcmp(entry->type, "chain"))
--                      write_entry(entry);
--              // TODO: else if(!strcmp(entry->type, "chain"))
--              free(entry->rootdev);
--      }
--      g_list_free(entries);
--      return(0);
-+      return system(cmd) ? 1 : 0;
- }
-
--/** Crates a menu.lst
-- * @param fp file pointer to write the menu.lst to
-+/** Make a grub2 configuration file
-+ * @return 0 on succcess, 1 on error
-  */
--void fwgrub_create_menu(FILE *fp)
-+int fwgrub_make_config(void)
- {
--      char *ptr;
--      char *bootdev;
--      char *swapdev;
--      struct stat buf;
--      struct fwgrub_entry_t entry;
--      char path[PATH_MAX];
--
--      entry.fp = fp;
--      entry.title = gen_title();
--      entry.type=NULL;
--
--      // hack: update mtab
--      system("mount / -o rw,remount");
--
--      ptr = find_mount_point("/boot");
--      bootdev = mount_dev(ptr);
--      free(ptr);
--      entry.grubbootdev=grub_convert(bootdev, 0);
--
--      ptr = find_mount_point("/");
--      entry.rootdev = mount_dev(ptr);
--      free(ptr);
--      if(!strcmp(entry.rootdev, bootdev))
--              entry.bootstr = strdup("/boot");
--      else
--              entry.bootstr = strdup("");
--
--      fprintf(fp, "#\n# %s/grub/menu.lst - configuration file for GRUB\n", 
entry.bootstr);
--      fprintf(fp, "# This file is generated automatically by 
grubconfig\n#\n\n");
--      fprintf(fp, "default=0\ntimeout=5\n");
--      snprintf(path, PATH_MAX, "%s/grub/message", entry.bootstr);
--      if(is_raid1_device(entry.rootdev))
--      {
--              if (entry.grubbootdev)
--                      // in case /boot is not on raid1, it is already
--                      // allocated.
--                      *(entry.grubbootdev) = '\0';
--              else
--                      // otherwise just allocate an empty string
--                      entry.grubbootdev = strdup("");
--      }
--      if(!stat(path, &buf))
--              fprintf(fp, "gfxmenu %s%s/grub/message\n\n", entry.grubbootdev, 
entry.bootstr);
--      entry.kernel = strdup("/vmlinuz");
--      entry.initrd = strdup("/initrd.img.xz");
--      swapdev = get_swap_dev();
--      if (swapdev)
--              entry.opts = g_strdup_printf("ro quiet splash resume=%s", 
swapdev);
--      else
--              entry.opts = strdup("ro quiet splash");
--      write_entry(&entry);
--
--      if(!(stat("/boot/memtest.bin", &buf)))
--      {
--              free(entry.title);
--              entry.title=strdup("Memtest86+");
--              free(entry.kernel);
--              entry.kernel = strdup("/memtest.bin");
--              free(entry.rootdev);
--              entry.rootdev=NULL;
--              free(entry.opts);
--              entry.opts=NULL;
--              free(entry.initrd);
--              entry.initrd=NULL;
--              write_entry(&entry);
--      }
--      entry_free(&entry);
--
--      os_prober(fp);
--
--      free(bootdev);
-+      return system("grub-mkconfig -o /boot/grub/grub.cfg > " FWGRUB_LOGDEV " 
2>&1") ? 1 : 0;
- }
-
--/* @} */
-+/** @} */
-diff --git a/libfwgrubconfig/libfwgrubconfig.h 
b/libfwgrubconfig/libfwgrubconfig.h
-index 5c0dcd0..c14cbca 100644
---- a/libfwgrubconfig/libfwgrubconfig.h
-+++ b/libfwgrubconfig/libfwgrubconfig.h
-@@ -1,8 +1,8 @@
- /*
-  *  libfwgrubconfig.h for frugalwareutils
-- *
-+ *
-  *  Copyright (c) 2006 by Miklos Vajna <[email protected]>
-- *
-+ *
-  *  This program is free software; you can redistribute it and/or modify
-  *  it under the terms of the GNU General Public License as published by
-  *  the Free Software Foundation; either version 2 of the License, or
-@@ -15,9 +15,15 @@
-  *
-  *  You should have received a copy of the GNU General Public License
-  *  along with this program; if not, write to the Free Software
-- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-  *  USA.
-  */
-
--int fwgrub_install(int mode);
--void fwgrub_create_menu(FILE *fp);
-+enum fwgrub_install_mode
-+{
-+      FWGRUB_INSTALL_MBR,
-+      FWGRUB_INSTALL_EFI
-+};
-+
-+int fwgrub_install(enum fwgrub_install_mode mode);
-+int fwgrub_make_config(void);
-diff --git a/libfwraidconfig/libfwraidconfig.c 
b/libfwraidconfig/libfwraidconfig.c
-index 57198c5..74d328d 100644
---- a/libfwraidconfig/libfwraidconfig.c
-+++ b/libfwraidconfig/libfwraidconfig.c
-@@ -157,7 +157,7 @@ int fwraid_create_md(char *devname, int level, GList 
*devices)
- {
-       char *ptr = fwutil_glist_display(devices, " ");
-       // TODO: this "yes" is an ugly hack to pass various warnings
--      char *cmd = g_strdup_printf("yes |mdadm --create --metadata 0.90 
--verbose %s "
-+      char *cmd = g_strdup_printf("yes |mdadm --create --metadata=default 
--verbose %s "
-               "--level=%d --raid-devices=%d %s >%s 2>%s",
-               devname, level, g_list_length(devices), ptr, FWRAID_LOGDEV, 
FWRAID_LOGDEV);
-       int ret;
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to