File kdm-cope-with-new-grub.diff of Package kdebase4-workspace
Index: kdm/backend/bootman.c
===================================================================
--- kdm/backend/bootman.c.orig
+++ kdm/backend/bootman.c
@@ -84,8 +84,7 @@ getGrub(char ***opts, int *def, int *cur
int len;
char line[1000];
- if (!grubSetDefault && !grub &&
- !(grubSetDefault = locate("grub-set-default")) &&
+ if (!grub &&
!(grub = locate("grub")))
return BO_NOMAN;
@@ -136,31 +135,10 @@ setGrub(const char *opt, SdRec *sdr)
static void
commitGrub(void)
{
- if (sdRec.bmstamp != mTime(GRUB_MENU) &&
- setGrub(sdRec.osname, &sdRec) != BO_OK)
- return;
-
- if (grubSetDefault) {
- /* The grub-set-default command must be used, which is
- * not so good because there is no way of setting an
- * entry for the next boot only. */
- char index[16];
- const char *args[] = { grubSetDefault, index, 0 };
- sprintf(index, "%d", sdRec.osindex);
- runAndWait((char **)args, environ);
- } else {
- /* The grub shell can be used with `savedefault'.
- * That requires a (widely distributed) patch to grub, e.g.
- * grub-0.97-once.patch. It won't work with a vanilla grub.*/
- FILE *f;
- int pid;
- static const char *args[] = { 0, "--batch", "--no-floppy", 0 };
- args[0] = grub;
- if ((f = pOpen((char **)args, 'w', &pid))) {
- fprintf(f, "savedefault --default=%d --once\n", sdRec.osindex);
- pClose(f, &pid);
- }
- }
+ char buffer[PATH_MAX];
+
+ snprintf(buffer, PATH_MAX, "/usr/sbin/grubonce %d", sdRec.osindex);
+ system(buffer);
}
#define GRUB2_MAX_MENU_LEVEL 5