mirror of
https://src.fedoraproject.org/rpms/grub2.git
synced 2024-11-28 15:46:53 +00:00
7e98da058f
This change reorganizes and cleanups our patches to reduce the patch number from 314 patches to 187. That's achieved by dropping patches that are later reverted and squashing fixes for earlier patches that introduced features. There are no code changes and the diff with upstream is the same before and after the cleanup. Having fewer patches makes easier to manage the patchset and also will ease to rebase them on top of the latest grub-2.04 release. Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
132 lines
3.9 KiB
Diff
132 lines
3.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Peter Jones <pjones@redhat.com>
|
|
Date: Tue, 11 Sep 2018 14:20:37 -0400
|
|
Subject: [PATCH] Add a "version" command.
|
|
|
|
This adds a command that shows you info about grub's version, the grub target
|
|
platform, the compiler version, and if you built with
|
|
--with-rpm-version=<string>, the rpm package version.
|
|
|
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
---
|
|
configure.ac | 13 ++++++++++
|
|
grub-core/Makefile.core.def | 5 ++++
|
|
grub-core/commands/version.c | 56 ++++++++++++++++++++++++++++++++++++++++++++
|
|
config.h.in | 1 +
|
|
4 files changed, 75 insertions(+)
|
|
create mode 100644 grub-core/commands/version.c
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 9323c125469..61c4683cb76 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -287,6 +287,19 @@ AC_SUBST(target_cpu)
|
|
AC_SUBST(platform)
|
|
|
|
# Define default variables
|
|
+have_with_rpm_version=n
|
|
+AC_ARG_WITH([rpm_version],
|
|
+ AS_HELP_STRING([--with-rpm-version=VERSION],
|
|
+ [set the rpm package version [[guessed]]]),
|
|
+ [have_with_rpm_version=y],
|
|
+ [have_with_rpm_version=n])
|
|
+if test x$have_with_rpm_version = xy; then
|
|
+ rpm_version="$with_rpm_version"
|
|
+else
|
|
+ rpm_version=""
|
|
+fi
|
|
+GRUB_RPM_VERSION="$rpm_version"
|
|
+AC_SUBST(GRUB_RPM_VERSION)
|
|
|
|
have_with_bootdir=n
|
|
AC_ARG_WITH([bootdir],
|
|
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
|
|
index 144734e39e1..59ead422028 100644
|
|
--- a/grub-core/Makefile.core.def
|
|
+++ b/grub-core/Makefile.core.def
|
|
@@ -535,6 +535,11 @@ image = {
|
|
enable = mips_loongson;
|
|
};
|
|
|
|
+module = {
|
|
+ name = version;
|
|
+ common = commands/version.c;
|
|
+};
|
|
+
|
|
module = {
|
|
name = disk;
|
|
common = lib/disk.c;
|
|
diff --git a/grub-core/commands/version.c b/grub-core/commands/version.c
|
|
new file mode 100644
|
|
index 00000000000..f0966a518f7
|
|
--- /dev/null
|
|
+++ b/grub-core/commands/version.c
|
|
@@ -0,0 +1,56 @@
|
|
+/* version.c - Command to print the grub version and build info. */
|
|
+/*
|
|
+ * GRUB -- GRand Unified Bootloader
|
|
+ * Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
|
|
+ *
|
|
+ * GRUB 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 3 of the License, or
|
|
+ * (at your option) any later version.
|
|
+ *
|
|
+ * GRUB is distributed in the hope that it will be useful,
|
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
+ * GNU General Public License for more details.
|
|
+ *
|
|
+ * You should have received a copy of the GNU General Public License
|
|
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
+ */
|
|
+
|
|
+#include <grub/dl.h>
|
|
+#include <grub/term.h>
|
|
+#include <grub/time.h>
|
|
+#include <grub/types.h>
|
|
+#include <grub/misc.h>
|
|
+#include <grub/extcmd.h>
|
|
+#include <grub/i18n.h>
|
|
+
|
|
+GRUB_MOD_LICENSE ("GPLv3+");
|
|
+
|
|
+static grub_err_t
|
|
+grub_cmd_version (grub_command_t cmd UNUSED, int argc, char **args UNUSED)
|
|
+{
|
|
+ if (argc != 0)
|
|
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("no arguments expected"));
|
|
+
|
|
+ grub_printf (_("GNU GRUB version %s\n"), PACKAGE_VERSION);
|
|
+ grub_printf (_("Platform %s-%s\n"), GRUB_TARGET_CPU, GRUB_PLATFORM);
|
|
+ if (grub_strlen(GRUB_RPM_VERSION) != 0)
|
|
+ grub_printf (_("RPM package version %s\n"), GRUB_RPM_VERSION);
|
|
+ grub_printf (_("Compiler version %s\n"), __VERSION__);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static grub_command_t cmd;
|
|
+
|
|
+GRUB_MOD_INIT(version)
|
|
+{
|
|
+ cmd = grub_register_command ("version", grub_cmd_version, NULL,
|
|
+ N_("Print version and build information."));
|
|
+}
|
|
+
|
|
+GRUB_MOD_FINI(version)
|
|
+{
|
|
+ grub_unregister_command (cmd);
|
|
+}
|
|
diff --git a/config.h.in b/config.h.in
|
|
index 9e8f9911b18..c7e316f0f1f 100644
|
|
--- a/config.h.in
|
|
+++ b/config.h.in
|
|
@@ -59,6 +59,7 @@
|
|
|
|
#define GRUB_TARGET_CPU "@GRUB_TARGET_CPU@"
|
|
#define GRUB_PLATFORM "@GRUB_PLATFORM@"
|
|
+#define GRUB_RPM_VERSION "@GRUB_RPM_VERSION@"
|
|
|
|
#define RE_ENABLE_I18N 1
|
|
|