char *ret;
switch (fs->distro) {
case OS_DISTRO_ARCHLINUX: ret = safe_strdup (g, "archlinux"); break;
+ case OS_DISTRO_CENTOS: ret = safe_strdup (g, "centos"); break;
case OS_DISTRO_DEBIAN: ret = safe_strdup (g, "debian"); break;
case OS_DISTRO_FEDORA: ret = safe_strdup (g, "fedora"); break;
case OS_DISTRO_GENTOO: ret = safe_strdup (g, "gentoo"); break;
case OS_DISTRO_PARDUS: ret = safe_strdup (g, "pardus"); break;
case OS_DISTRO_REDHAT_BASED: ret = safe_strdup (g, "redhat-based"); break;
case OS_DISTRO_RHEL: ret = safe_strdup (g, "rhel"); break;
+ case OS_DISTRO_SCIENTIFIC_LINUX: ret = safe_strdup (g, "scientificlinux"); break;
case OS_DISTRO_SLACKWARE: ret = safe_strdup (g, "slackware"); break;
case OS_DISTRO_WINDOWS: ret = safe_strdup (g, "windows"); break;
case OS_DISTRO_UBUNTU: ret = safe_strdup (g, "ubuntu"); break;
static pcre *re_rhel_old;
static pcre *re_rhel;
static pcre *re_rhel_no_minor;
+static pcre *re_centos_old;
+static pcre *re_centos;
+static pcre *re_centos_no_minor;
+static pcre *re_scientific_linux_old;
+static pcre *re_scientific_linux;
+static pcre *re_scientific_linux_no_minor;
static pcre *re_major_minor;
static pcre *re_aug_seq;
static pcre *re_xdev;
COMPILE (re_fedora, "Fedora release (\\d+)", 0);
COMPILE (re_rhel_old,
- "(?:Red Hat|CentOS|Scientific Linux).*release (\\d+).*Update (\\d+)", 0);
+ "Red Hat.*release (\\d+).*Update (\\d+)", 0);
COMPILE (re_rhel,
- "(?:Red Hat|CentOS|Scientific Linux).*release (\\d+)\\.(\\d+)", 0);
+ "Red Hat.*release (\\d+)\\.(\\d+)", 0);
COMPILE (re_rhel_no_minor,
- "(?:Red Hat|CentOS|Scientific Linux).*release (\\d+)", 0);
+ "Red Hat.*release (\\d+)", 0);
+ COMPILE (re_centos_old,
+ "CentOS.*release (\\d+).*Update (\\d+)", 0);
+ COMPILE (re_centos,
+ "CentOS.*release (\\d+)\\.(\\d+)", 0);
+ COMPILE (re_centos_no_minor,
+ "CentOS.*release (\\d+)", 0);
+ COMPILE (re_scientific_linux_old,
+ "Scientific Linux.*release (\\d+).*Update (\\d+)", 0);
+ COMPILE (re_scientific_linux,
+ "Scientific Linux.*release (\\d+)\\.(\\d+)", 0);
+ COMPILE (re_scientific_linux_no_minor,
+ "Scientific Linux.*release (\\d+)", 0);
COMPILE (re_major_minor, "(\\d+)\\.(\\d+)", 0);
COMPILE (re_aug_seq, "/\\d+$", 0);
COMPILE (re_xdev, "^/dev/(?:h|s|v|xv)d([a-z]\\d*)$", 0);
pcre_free (re_rhel_old);
pcre_free (re_rhel);
pcre_free (re_rhel_no_minor);
+ pcre_free (re_centos_old);
+ pcre_free (re_centos);
+ pcre_free (re_centos_no_minor);
+ pcre_free (re_scientific_linux_old);
+ pcre_free (re_scientific_linux);
+ pcre_free (re_scientific_linux_no_minor);
pcre_free (re_major_minor);
pcre_free (re_aug_seq);
pcre_free (re_xdev);
return -1;
fs->minor_version = 0;
}
+ else if (match2 (g, fs->product_name, re_centos_old, &major, &minor) ||
+ match2 (g, fs->product_name, re_centos, &major, &minor)) {
+ fs->distro = OS_DISTRO_CENTOS;
+ fs->major_version = guestfs___parse_unsigned_int (g, major);
+ free (major);
+ if (fs->major_version == -1) {
+ free (minor);
+ return -1;
+ }
+ fs->minor_version = guestfs___parse_unsigned_int (g, minor);
+ free (minor);
+ if (fs->minor_version == -1)
+ return -1;
+ }
+ else if ((major = match1 (g, fs->product_name, re_centos_no_minor)) != NULL) {
+ fs->distro = OS_DISTRO_CENTOS;
+ fs->major_version = guestfs___parse_unsigned_int (g, major);
+ free (major);
+ if (fs->major_version == -1)
+ return -1;
+ fs->minor_version = 0;
+ }
+ else if (match2 (g, fs->product_name, re_scientific_linux_old, &major, &minor) ||
+ match2 (g, fs->product_name, re_scientific_linux, &major, &minor)) {
+ fs->distro = OS_DISTRO_SCIENTIFIC_LINUX;
+ fs->major_version = guestfs___parse_unsigned_int (g, major);
+ free (major);
+ if (fs->major_version == -1) {
+ free (minor);
+ return -1;
+ }
+ fs->minor_version = guestfs___parse_unsigned_int (g, minor);
+ free (minor);
+ if (fs->minor_version == -1)
+ return -1;
+ }
+ else if ((major = match1 (g, fs->product_name, re_scientific_linux_no_minor)) != NULL) {
+ fs->distro = OS_DISTRO_SCIENTIFIC_LINUX;
+ fs->major_version = guestfs___parse_unsigned_int (g, major);
+ free (major);
+ if (fs->major_version == -1)
+ return -1;
+ fs->minor_version = 0;
+ }
}
else if (guestfs_exists (g, "/etc/debian_version") > 0) {
fs->distro = OS_DISTRO_DEBIAN;