- pushed patch 1,2
- patches 3,4,5 desn't apply to the current master
--Jirka
On 04/08/2013 10:51 AM, Michal Toman wrote:
Signed-off-by: Michal Toman <mtoman(a)redhat.com>
---
src/lib/dump_dir.c | 10 +++++++++-
src/lib/parse_release.c | 28 ++++++++++++++++++++++++++++
2 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/src/lib/dump_dir.c b/src/lib/dump_dir.c
index ac3b0e1..25f581a 100644
--- a/src/lib/dump_dir.c
+++ b/src/lib/dump_dir.c
@@ -640,7 +640,15 @@ void dd_create_basic_files(struct dump_dir *dd, uid_t uid, const
char *chroot_di
release = load_text_file("/etc/system-release",
DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE | DD_OPEN_FOLLOW);
if (!release)
- release = load_text_file("/etc/redhat-release", DD_OPEN_FOLLOW);
+ release = load_text_file("/etc/redhat-release",
+ DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE | DD_OPEN_FOLLOW);
+ if (!release)
+ release = load_text_file("/etc/SuSE-release", DD_OPEN_FOLLOW);
+
+ char *newline = strchr(release, '\n');
+ if (newline)
+ *newline = '\0';
+
dd_save_text(dd, FILENAME_OS_RELEASE, release);
if (chroot_dir)
{
diff --git a/src/lib/parse_release.c b/src/lib/parse_release.c
index 2535fb6..af1d69f 100644
--- a/src/lib/parse_release.c
+++ b/src/lib/parse_release.c
@@ -47,6 +47,7 @@ enum {
// caller is reposible for freeing *product* and *version*
static void parse_release(const char *release, char** product, char** version, int
flags)
{
+ /* Fedora has a single non-numeric release - Rawhide */
if (strstr(release, "Rawhide"))
{
*product = xstrdup("Fedora");
@@ -55,6 +56,29 @@ static void parse_release(const char *release, char** product, char**
version, i
return;
}
+ /* openSUSE has two non-numeric releases - Factory and Tumbleweed
+ None of them is unfortunately identified in any of /etc/SuSE-brand,
+ /etc/SuSE-release or /etc/os-release. Keep this piece of code commented
+ just not to forget about that. */
+
+ /*
+ if (strstr(release, "Factory"))
+ {
+ *product = xstrdup("openSUSE");
+ *version = xstrdup("Factory");
+ VERB3 log("%s: version:'%s' product:'%s'", __func__,
*version, *product);
+ return;
+ }
+
+ if (strstr(release, "Tumbleweed"))
+ {
+ *product = xstrdup("openSUSE");
+ *version = xstrdup("Tumbleweed");
+ VERB3 log("%s: version:'%s' product:'%s'", __func__,
*version, *product);
+ return;
+ }
+ */
+
bool it_is_rhel = false;
struct strbuf *buf_product = strbuf_new();
@@ -67,6 +91,10 @@ static void parse_release(const char *release, char** product, char**
version, i
strbuf_append_str(buf_product, "Red Hat Enterprise Linux");
it_is_rhel = true;
}
+ else if (strstr(release, "openSUSE"))
+ {
+ strbuf_append_str(buf_product, "openSUSE");
+ }
else
{
/* TODO: add logic for parsing other distros' names here */