diff --git a/grubby.8 b/grubby.8
index aaa061b..ca2c93f 100644
--- a/grubby.8
+++ b/grubby.8
@@ -5,8 +5,8 @@ grubby - command line tool for configuring grub, lilo, and elilo
.SH SYNOPSIS
fBgrubbyfR [--add-kernel=fIkernel-pathfR] [--args=fIargsfR]
[--bad-image-okay] [--boot-filesystem=fIbootfsfR]
- [--bootloader-probe] [--config-file fIpathfR]
- [--copy-default] [--default-kernel]
+ [--bootloader-probe] [--config-file fIpathfR] [--copy-default]
+ [--default-kernel] [--default-index]
[--grub] [--lilo] [--yaboot] [--silo] [--zipl]
[--info=fIkernel-pathfR] [--initrd=fIinitrd-pathfR]
[--make-default] [-o path] [--version]
@@ -98,6 +98,10 @@ and initrd path will never be copied.
Display the full path to the current default kernel and exit.
.TP
+fB--default-indexfR
+Display the numeric index of the current default boot entry and exit.
+
+.TP
fB--elilofR
Use an fBelilofR style configuration file.
diff --git a/grubby.c b/grubby.c
index 7c98978..0158c2e 100644
--- a/grubby.c
+++ b/grubby.c
@@ -3159,6 +3159,7 @@ int main(int argc, const char ** argv) {
struct singleEntry * template = NULL;
int copyDefault = 0, makeDefault = 0;
int displayDefault = 0;
+ int displayDefaultIndex = 0;
struct poptOption options[] = {
{ "add-kernel", 0, POPT_ARG_STRING, &newKernelPath, 0,
_("add an entry for the specified kernel"), _("kernel-path") },
@@ -3191,6 +3192,8 @@ int main(int argc, const char ** argv) {
"template"), NULL },
{ "default-kernel", 0, 0, &displayDefault, 0,
_("display the path of the default kernel") },
+ { "default-index", 0, 0, &displayDefaultIndex, 0,
+ _("display the index of the default kernel") },
{ "elilo", 0, POPT_ARG_NONE, &configureELilo, 0,
_("configure elilo bootloader") },
{ "extlinux", 0, POPT_ARG_NONE, &configureExtLinux, 0,
@@ -3334,7 +3337,7 @@ int main(int argc, const char ** argv) {
if (bootloaderProbe && (displayDefault || kernelInfo || newKernelVersion ||
newKernelPath || removeKernelPath || makeDefault ||
- defaultKernel)) {
+ defaultKernel || displayDefaultIndex)) {
fprintf(stderr, _("grubby: --bootloader-probe may not be used with "
"specified option"));
return 1;
@@ -3385,7 +3388,7 @@ int main(int argc, const char ** argv) {