## osinfo_media

osinfo_media — An installation media for a (guest) OS

## Functions

GQuark | osinfo_media_error_quark ()
OsinfoMedia * | osinfo_media_new ()
OsinfoMedia * | osinfo_media_create_from_location ()
void | osinfo_media_create_from_location_async ()
OsinfoMedia * | osinfo_media_create_from_location_finish ()
OsinfoMedia * | osinfo_media_create_from_location_with_flags ()
void | osinfo_media_create_from_location_with_flags_async ()
OsinfoMedia * | osinfo_media_create_from_location_with_flags_finish ()
const gchar * | osinfo_media_get_architecture ()
const gchar * | osinfo_media_get_url ()
const gchar * | osinfo_media_get_volume_id ()
const gchar * | osinfo_media_get_system_id ()
const gchar * | osinfo_media_get_publisher_id ()
const gchar * | osinfo_media_get_application_id ()
const gchar * | osinfo_media_get_kernel_path ()
const gchar * | osinfo_media_get_initrd_path ()
gboolean | osinfo_media_is_bootable ()
OsinfoOs * | osinfo_media_get_os ()
OsinfoOsVariantList * | osinfo_media_get_os_variants ()
GList * | osinfo_media_get_languages ()
gboolean | osinfo_media_get_installer ()
gboolean | osinfo_media_get_live ()
gint | osinfo_media_get_installer_reboots ()
gint64 | osinfo_media_get_volume_size ()
gboolean | osinfo_media_get_eject_after_install ()
gboolean | osinfo_media_supports_installer_script ()
void | osinfo_media_add_install_script ()
OsinfoInstallScriptList * | osinfo_media_get_install_script_list ()
gboolean | osinfo_media_matches ()

## Types and Values

#define | OSINFO_MEDIA_ERROR
enum | OsinfoMediaError
enum | OsinfoMediaDetectFlags
#define | OSINFO_TYPE_MEDIA
#define | OSINFO_MEDIA_PROP_ARCHITECTURE
#define | OSINFO_MEDIA_PROP_URL
#define | OSINFO_MEDIA_PROP_VOLUME_ID
#define | OSINFO_MEDIA_PROP_SYSTEM_ID
#define | OSINFO_MEDIA_PROP_PUBLISHER_ID
#define | OSINFO_MEDIA_PROP_APPLICATION_ID
#define | OSINFO_MEDIA_PROP_KERNEL
#define | OSINFO_MEDIA_PROP_INITRD
#define | OSINFO_MEDIA_PROP_LIVE
#define | OSINFO_MEDIA_PROP_INSTALLER
#define | OSINFO_MEDIA_PROP_INSTALLER_REBOOTS
#define | OSINFO_MEDIA_PROP_LANG
#define | OSINFO_MEDIA_PROP_LANG_REGEX
#define | OSINFO_MEDIA_PROP_LANG_MAP
#define | OSINFO_MEDIA_PROP_VARIANT
#define | OSINFO_MEDIA_PROP_VOLUME_SIZE
#define | OSINFO_MEDIA_PROP_EJECT_AFTER_INSTALL
#define | OSINFO_MEDIA_PROP_INSTALLER_SCRIPT
#define | OSINFO_MEDIA_PROP_BOOTABLE

## Object Hierarchy

        GEnum
        ╰── OsinfoMediaError
        GFlags
        ╰── OsinfoMediaDetectFlags

## Description

OsinfoMedia is an entity representing an installation media a (guest) operating system.

## Functions

### osinfo_media_error_quark ()

    GQuark
    osinfo_media_error_quark (void);

### osinfo_media_new ()

    OsinfoMedia *
    osinfo_media_new (const gchar *id,
                      const gchar *architecture);

### osinfo_media_create_from_location ()

    OsinfoMedia *
    osinfo_media_create_from_location (const gchar *location,
                                       GCancellable *cancellable,
                                       GError **error);

Creates a new OsinfoMedia for installation media at `location` . The `location` could be a http:// or a https:// URI or a local path.

NOTE: Currently this only works for ISO images/devices.

#### Parameters

location | the location of an installation media |
cancellable | a GCancellable, or `NULL`. | [allow-none]
error | The location where to store any error, or `NULL` |

#### Returns

a new OsinfoMedia , or NULL on error.

[transfer full]

### osinfo_media_create_from_location_async ()

    void
    osinfo_media_create_from_location_async
                                   (const gchar *location,
                                    gint priority,
                                    GCancellable *cancellable,
                                    GAsyncReadyCallback callback,
                                    gpointer user_data);

Asynchronous variant of osinfo_media_create_from_location.

#### Parameters

location | the location of an installation media |
priority | the I/O priority of the request |
cancellable | a GCancellable, or `NULL`. | [allow-none]
callback | Function to call when result of this call is ready |
user_data | The user data to pass to `callback` , or `NULL` |

### osinfo_media_create_from_location_finish ()

    OsinfoMedia *
    osinfo_media_create_from_location_finish
                                   (GAsyncResult *res,
                                    GError **error);

Finishes an asynchronous media object creation process started with osinfo_media_create_from_location_async.

#### Parameters

res | a GAsyncResult |
error | The location where to store any error, or `NULL` |

#### Returns

a new OsinfoMedia , or NULL on error.

[transfer full]

Since: 1.6.0

### osinfo_media_create_from_location_with_flags ()

    OsinfoMedia *
    osinfo_media_create_from_location_with_flags
                                   (const gchar *location,
                                    GCancellable *cancellable,
                                    guint flags,
                                    GError **error);

Creates a new OsinfoMedia for installation media at `location` . The `location` could be a http:// or a https:// URI or a local path.

NOTE: Currently this only works for ISO images/devices.

#### Parameters

location | the location of an installation media |
cancellable | a GCancellable, or `NULL`. | [allow-none]
error | The location where to store any error, or `NULL` |
flags | An OsinfoMediaDetectFlag, or 0. |

#### Returns

a new OsinfoMedia , or NULL on error.

[transfer full]

Since: 1.6.0

### osinfo_media_create_from_location_with_flags_async ()

    void
    osinfo_media_create_from_location_with_flags_async
                                   (const gchar *location,
                                    gint priority,
                                    GCancellable *cancellable,
                                    GAsyncReadyCallback callback,
                                    guint flags,
                                    gpointer user_data);

Asynchronous variant of osinfo_media_create_from_location_with_flags.

#### Parameters

location | the location of an installation media |
priority | the I/O priority of the request |
cancellable | a GCancellable, or `NULL`. | [allow-none]
callback | Function to call when result of this call is ready |
flags | An OsinfoMediaDetectFlag, or 0. |
user_data | The user data to pass to `callback` , or `NULL` |

Since: 1.6.0

### osinfo_media_create_from_location_with_flags_finish ()

    OsinfoMedia *
    osinfo_media_create_from_location_with_flags_finish
                                   (GAsyncResult *res,
                                    GError **error);

Finishes an asynchronous media object creation process started with osinfo_media_create_from_location_async.

#### Parameters

res | a GAsyncResult |
error | The location where to store any error, or `NULL` |

#### Returns

a new OsinfoMedia , or NULL on error.

[transfer full]

### osinfo_media_get_architecture ()

    const gchar *
    osinfo_media_get_architecture (OsinfoMedia *media);

Retrieves the target hardware architecture of the OS `media` provides.

#### Parameters

media | an OsinfoMedia instance |

#### Returns

the hardware architecture, or NULL.

[transfer none]

### osinfo_media_get_url ()

    const gchar *
    osinfo_media_get_url (OsinfoMedia *media);

The URL to the `media`

#### Parameters

media | an OsinfoMedia instance |

#### Returns

the URL, or NULL.

[transfer none]

### osinfo_media_get_volume_id ()

    const gchar *
    osinfo_media_get_volume_id (OsinfoMedia *media);

If `media` is an ISO9660 image/device, this function retrieves the expected volume ID.

Note: In practice, this will usually not be the exact copy of the volume ID string on the ISO image/device but rather a regular expression that matches it.

#### Parameters

media | an OsinfoMedia instance |

#### Returns

the volume id, or NULL.

[transfer none]

### osinfo_media_get_system_id ()

    const gchar *
    osinfo_media_get_system_id (OsinfoMedia *media);

If `media` is an ISO9660 image/device, this function retrieves the expected system ID.

Note: In practice, this will usually not be the exact copy of the system ID string on the ISO image/device but rather a regular expression that matches it.

#### Parameters

media | an OsinfoMedia instance |

#### Returns

the system id, or NULL.

[transfer none]

### osinfo_media_get_publisher_id ()

    const gchar *
    osinfo_media_get_publisher_id (OsinfoMedia *media);

If `media` is an ISO9660 image/device, this function retrieves the expected publisher ID.

Note: In practice, this will usually not be the exact copy of the publisher ID string on the ISO image/device but rather a regular expression that matches it.

#### Parameters

media | an OsinfoMedia instance |

#### Returns

the publisher id, or NULL.

[transfer none]

### osinfo_media_get_application_id ()

    const gchar *
    osinfo_media_get_application_id (OsinfoMedia *media);

If `media` is an ISO9660 image/device, this function retrieves the expected application ID.

Note: In practice, this will usually not be the exact copy of the application ID string on the ISO image/device but rather a regular expression that matches it.

#### Parameters

media | an OsinfoMedia instance |

#### Returns

the application id, or NULL.

[transfer none]

### osinfo_media_get_kernel_path ()

    const gchar *
    osinfo_media_get_kernel_path (OsinfoMedia *media);

Retrieves the path to the kernel image in the install tree.

Note: This only applies to installer medias of 'linux' OS family.

#### Parameters

media | an OsinfoMedia instance |

#### Returns

the path to kernel image, or NULL.

[transfer none]

### osinfo_media_get_initrd_path ()

    const gchar *
    osinfo_media_get_initrd_path (OsinfoMedia *media);

Retrieves the path to the initrd image in the install tree.

Note: This only applies to installer medias of 'linux' OS family.

#### Parameters

media | an OsinfoMedia instance |

#### Returns

the path to initrd image, or NULL.

[transfer none]

### osinfo_media_is_bootable ()

    gboolean
    osinfo_media_is_bootable (OsinfoMedia *media);

#### Parameters

media | and OsinfoMedia instance |

#### Returns

TRUE if the `media` is bootable. FALSE otherwise.

Since: 1.6.0

### osinfo_media_get_os ()

    OsinfoOs *
    osinfo_media_get_os (OsinfoMedia *media);

#### Parameters

media | an OsinfoMedia instance |

#### Returns

the operating system, or NULL.

[transfer full]

Since: 0.2.3

### osinfo_media_get_os_variants ()

    OsinfoOsVariantList *
    osinfo_media_get_os_variants (OsinfoMedia *media);

Gets the variants of the associated operating system.

#### Parameters

media | an OsinfoMedia instance |

#### Returns

the operating system variant, or NULL.

[transfer full]

Since: 0.2.9

### osinfo_media_get_languages ()

    GList *
    osinfo_media_get_languages (OsinfoMedia *media);

If media is an installer, this property indicates the languages that can be used during automatic installations.

On media that are not installers, this property will indicate the languages that the user interface can be displayed in. Use osinfo_media_get_installer(or OsinfoMedia::installer) to know if the media is an installer or not.

#### Parameters

media | an OsinfoMedia instance |

#### Returns

a GList containing the list of the UI languages this media supports. The list must be freed with `g_list_free()` when no longer needed. If the supported languages are unknown, NULL will be returned.

[transfer container][element-type utf8]

Since: 0.2.3

### osinfo_media_get_installer ()

    gboolean
    osinfo_media_get_installer (OsinfoMedia *media);

Whether `media` provides an installer for an OS.

#### Parameters

media | an OsinfoMedia instance |

#### Returns

TRUE if media is installer, FALSE otherwise

Since: 0.0.3

### osinfo_media_get_live ()

    gboolean
    osinfo_media_get_live (OsinfoMedia *media);

Whether `media` can boot directly an OS without any installations.

#### Parameters

media | an OsinfoMedia instance |

#### Returns

TRUE if media is live, FALSE otherwise

Since: 0.0.3

### osinfo_media_get_installer_reboots ()

    gint
    osinfo_media_get_installer_reboots (OsinfoMedia *media);

If media is an installer, this method retrieves the number of reboots the installer takes before installation is complete.

This function is not supposed to be called on media that has no installer. You can use osinfo_media_get_installer(or OsinfoMedia::installer) to check that.

Warning: Some media allow you to install from live sessions, in which case number of reboots *alone* is not a reliable method for tracking installation.

#### Parameters

media | an OsinfoMedia instance |

#### Returns

the number of installer reboots or -1 if media is not an installer

Since: 0.2.1

### osinfo_media_get_volume_size ()

    gint64
    osinfo_media_get_volume_size (OsinfoMedia *media);

#### Parameters

media | an OsinfoMedia instance |

#### Returns

the ISO9660 volume size, in bytes or -1 if size is unknown or media is not an ISO9660 device/image.

### osinfo_media_get_eject_after_install ()

    gboolean
    osinfo_media_get_eject_after_install (OsinfoMedia *media);

Whether `media` should ejected after the installation procces.

#### Parameters

media | an OsinfoMedia instance |

#### Returns

TRUE if media should be ejected, FALSE otherwise

Since: 0.2.13

### osinfo_media_supports_installer_script ()

    gboolean
    osinfo_media_supports_installer_script
                                   (OsinfoMedia *media);

Whether `media` supports installation using install scripts.

#### Parameters

media | an OsinfoMedia instance |

#### Returns

TRUE if install-scripts are supported by the media, FALSE otherwise

Since: 1.3.0

### osinfo_media_add_install_script ()

    void
    osinfo_media_add_install_script (OsinfoMedia *media,
                                     OsinfoInstallScript *script);

Adds an `script` to the specified `media`

#### Parameters

media | an OsinfoMedia instance |
script | an OsinfoInstallScript instance |

Since: 1.4.0

### osinfo_media_get_install_script_list ()

    OsinfoInstallScriptList *
    osinfo_media_get_install_script_list (OsinfoMedia *media);

#### Parameters

media | an OsinfoMedia instance |

#### Returns

a list of the install scripts for the specified media.

[transfer full]

Since: 1.4.0

### osinfo_media_matches ()

    gboolean
    osinfo_media_matches (OsinfoMedia *media,
                          OsinfoMedia *reference);

Determines whether the metadata for the unidentified `media` is a match for the `reference` media.

The metadata in the unidentified `media` must be literal strings, while the metadata in the `reference` media must be regular expressions.

#### Parameters

media | an unidentified OsinfoMedia instance |
reference | a reference OsinfoMedia instance |

#### Returns

TRUE if `media` is a match for `reference` . FALSE otherwise

Since: 1.10.0

## Types and Values

### OSINFO_MEDIA_ERROR

    #define OSINFO_MEDIA_ERROR (osinfo_media_error_quark ())

### enum OsinfoMediaError

GError codes used for errors in the OSINFO_MEDIA_ERROR domain, during reading of data from install media location.

#### Members

OSINFO_MEDIA_ERROR_NO_DESCRIPTORS | No descriptors. |
OSINFO_MEDIA_ERROR_NO_PVD | No Primary volume descriptor. |
OSINFO_MEDIA_ERROR_NO_SVD | No supplementary volume descriptor. |
OSINFO_MEDIA_ERROR_INSUFFICIENT_METADATA | Not enough metadata. |
OSINFO_MEDIA_ERROR_NOT_BOOTABLE | Install media not bootable. |
OSINFO_MEDIA_ERROR_NO_DIRECTORY_RECORD_EXTENT | No directory record extent found. |

### enum OsinfoMediaDetectFlags

Flags used for detecting a media.

#### Members

OSINFO_MEDIA_DETECT_REQUIRE_BOOTABLE |  |

Since: 1.6.0

### OSINFO_TYPE_MEDIA

    #define OSINFO_TYPE_MEDIA (osinfo_media_get_type ())

### OSINFO_MEDIA_PROP_ARCHITECTURE

    #define OSINFO_MEDIA_PROP_ARCHITECTURE   "architecture"

### OSINFO_MEDIA_PROP_URL

    #define OSINFO_MEDIA_PROP_URL            "url"

### OSINFO_MEDIA_PROP_VOLUME_ID

    #define OSINFO_MEDIA_PROP_VOLUME_ID      "volume-id"

### OSINFO_MEDIA_PROP_SYSTEM_ID

    #define OSINFO_MEDIA_PROP_SYSTEM_ID      "system-id"

### OSINFO_MEDIA_PROP_PUBLISHER_ID

    #define OSINFO_MEDIA_PROP_PUBLISHER_ID   "publisher-id"

### OSINFO_MEDIA_PROP_APPLICATION_ID

    #define OSINFO_MEDIA_PROP_APPLICATION_ID "application-id"

### OSINFO_MEDIA_PROP_KERNEL

    #define OSINFO_MEDIA_PROP_KERNEL         "kernel"

### OSINFO_MEDIA_PROP_INITRD

    #define OSINFO_MEDIA_PROP_INITRD         "initrd"

### OSINFO_MEDIA_PROP_LIVE

    #define OSINFO_MEDIA_PROP_LIVE           "live"

### OSINFO_MEDIA_PROP_INSTALLER

    #define OSINFO_MEDIA_PROP_INSTALLER      "installer"

### OSINFO_MEDIA_PROP_INSTALLER_REBOOTS

    #define OSINFO_MEDIA_PROP_INSTALLER_REBOOTS "installer-reboots"

### OSINFO_MEDIA_PROP_LANG

    #define OSINFO_MEDIA_PROP_LANG           "l10n-language"

### OSINFO_MEDIA_PROP_LANG_REGEX

    #define OSINFO_MEDIA_PROP_LANG_REGEX     "l10n-language-regex"

### OSINFO_MEDIA_PROP_LANG_MAP

    #define OSINFO_MEDIA_PROP_LANG_MAP       "l10n-language-map"

### OSINFO_MEDIA_PROP_VARIANT

    #define OSINFO_MEDIA_PROP_VARIANT        "variant"

### OSINFO_MEDIA_PROP_VOLUME_SIZE

    #define OSINFO_MEDIA_PROP_VOLUME_SIZE    "volume-size"

### OSINFO_MEDIA_PROP_EJECT_AFTER_INSTALL

    #define OSINFO_MEDIA_PROP_EJECT_AFTER_INSTALL "eject-after-install"

### OSINFO_MEDIA_PROP_INSTALLER_SCRIPT

    #define OSINFO_MEDIA_PROP_INSTALLER_SCRIPT "installer-script"

### OSINFO_MEDIA_PROP_BOOTABLE

    #define OSINFO_MEDIA_PROP_BOOTABLE        "bootable"

## See Also

OsinfoOs