示例#1
0
/**
 * pk_get_distro_version_id:
 *
 * Return value: the distro version, e.g. "23", as specified by VERSION_ID in /etc/os-release
 **/
gchar *
pk_get_distro_version_id (GError **error)
{
	gboolean ret;
	gchar *version_id = NULL;

	ret = pk_parse_os_release (NULL, &version_id, error);
	if (!ret)
		return NULL;

	return version_id;
}
示例#2
0
/**
 * pk_get_distro_name:
 * @error: the #GError to store any failure, or %NULL
 *
 * Get the distribution name for this host as specified by NAME in /etc/os-release, e.g. "Fedora",
 *
 * Return value: a distro name
 **/
gchar *
pk_get_distro_name (GError **error)
{
	gboolean ret;
	gchar *name = NULL;

	ret = pk_parse_os_release (NULL, &name, NULL, error);
	if (!ret)
		return NULL;

	return name;
}
示例#3
0
/**
 * pk_get_distro_id:
 *
 * Return value: the distro-id, typically "distro;version;arch"
 **/
gchar *
pk_get_distro_id (void)
{
	gboolean ret;
	g_autoptr(GError) error = NULL;
	g_autofree gchar *arch = NULL;
	g_autofree gchar *name = NULL;
	g_autofree gchar *version = NULL;

	/* we don't want distro specific results in 'make check' */
	if (g_getenv ("PK_SELF_TEST") != NULL)
		return g_strdup ("selftest;11.91;i686");

	ret = pk_parse_os_release (&name, &version, &error);
	if (!ret) {
		g_warning ("failed to load os-release: %s", error->message);
		return NULL;
	}

	arch = pk_get_distro_id_machine_type ();
	return g_strdup_printf ("%s;%s;%s", name, version, arch);
}