X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Fgrub.c;h=c61f9df29ed6f6d59741bc5dd10665d1dd37cafe;hb=e2249b7ce1dd0a2f8f110e0e47aca397185a6373;hp=84766197466675e4a19c9150d91845691e5af42a;hpb=6bda071b5cd8393b37653687027c4ae6c6cf3804;p=libguestfs.git diff --git a/daemon/grub.c b/daemon/grub.c index 8476619..c61f9df 100644 --- a/daemon/grub.c +++ b/daemon/grub.c @@ -1,5 +1,5 @@ /* libguestfs - the guestfsd daemon - * Copyright (C) 2009 Red Hat Inc. + * Copyright (C) 2009-2011 Red Hat Inc. * * 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 @@ -24,27 +24,31 @@ #include "daemon.h" #include "actions.h" +#include "optgroups.h" int -do_grub_install (char *root, char *device) +optgroup_grub_available (void) +{ + return prog_exists ("grub-install"); +} + +int +do_grub_install (const char *root, const char *device) { int r; char *err; char *buf; - NEED_ROOT (return -1); - ABS_PATH (root, return -1); - if (asprintf_nowarn (&buf, "--root-directory=%R", root) == -1) { reply_with_perror ("asprintf"); return -1; } - r = command (NULL, &err, "/sbin/grub-install", buf, device, NULL); + r = command (NULL, &err, "grub-install", buf, device, NULL); free (buf); if (r == -1) { - reply_with_error ("grub-install: %s", err); + reply_with_error ("%s", err); free (err); return -1; }