OsinfoMedia

## OsinfoMedia OsinfoMedia — An installation media for a (guest) OS |

## Synopsis

    GQuark              osinfo_media_error_quark            (void);
    #define             OSINFO_MEDIA_ERROR
    enum                OsinfoMediaError;
    #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
    struct              OsinfoMedia;
    struct              OsinfoMediaClass;
    OsinfoMedia *       osinfo_media_new                    (const gchar *id,
                                                             const gchar *architecture);
    OsinfoMedia *       osinfo_media_create_from_location   (const gchar *location,
                                                             GCancellable *cancellable,
                                                             GError **error);
    void                osinfo_media_create_from_location_async
                                                            (const gchar *location,
                                                             gint priority,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    OsinfoMedia *       osinfo_media_create_from_location_finish
                                                            (GAsyncResult *res,
                                                             GError **error);
    const gchar *       osinfo_media_get_architecture       (OsinfoMedia *media);
    const gchar *       osinfo_media_get_url                (OsinfoMedia *media);
    const gchar *       osinfo_media_get_volume_id          (OsinfoMedia *media);
    const gchar *       osinfo_media_get_system_id          (OsinfoMedia *media);
    const gchar *       osinfo_media_get_publisher_id       (OsinfoMedia *media);
    const gchar *       osinfo_media_get_application_id     (OsinfoMedia *media);
    const gchar *       osinfo_media_get_kernel_path        (OsinfoMedia *media);
    const gchar *       osinfo_media_get_initrd_path        (OsinfoMedia *media);
    OsinfoOs *          osinfo_media_get_os                 (OsinfoMedia *media);
    GList *             osinfo_media_get_languages          (OsinfoMedia *media);
    gboolean            osinfo_media_get_installer          (OsinfoMedia *media);
    gboolean            osinfo_media_get_live               (OsinfoMedia *media);
    gint                osinfo_media_get_installer_reboots  (OsinfoMedia *media);

## Object Hierarchy

      GEnum
       +----OsinfoMediaError

      GObject
       +----OsinfoEntity
             +----OsinfoMedia

## Properties

      "application-id"           gchar*                : Read / Write
      "architecture"             gchar*                : Read / Write
      "initrd-path"              gchar*                : Read / Write
      "installer"                gboolean              : Read / Write
      "installer-reboots"        gint                  : Read / Write
      "kernel-path"              gchar*                : Read / Write
      "languages"                gpointer              : Read
      "live"                     gboolean              : Read / Write
      "os"                       OsinfoOs*             : Read / Write
      "publisher-id"             gchar*                : Read / Write
      "system-id"                gchar*                : Read / Write
      "url"                      gchar*                : Read / Write
      "volume-id"                gchar*                : Read / Write

## Description

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

## Details

### osinfo_media_error_quark ()

    GQuark              osinfo_media_error_quark            (void);

### OSINFO_MEDIA_ERROR

    #define OSINFO_MEDIA_ERROR (osinfo_media_error_quark ())

### enum OsinfoMediaError

    typedef enum {
        OSINFO_MEDIA_ERROR_NO_DESCRIPTORS,
        OSINFO_MEDIA_ERROR_NO_PVD,
        OSINFO_MEDIA_ERROR_NO_SVD,
        OSINFO_MEDIA_ERROR_INSUFFICIENT_METADATA,
        OSINFO_MEDIA_ERROR_NOT_BOOTABLE
    } OsinfoMediaError;

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

`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_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"

### struct OsinfoMedia

    struct OsinfoMedia;

### struct OsinfoMediaClass

    struct OsinfoMediaClass {
    };

### 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 any URI that GIO can handle or a local path.

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

`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.

`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.

`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.

`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`

`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.

`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.

`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.

`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.

`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.

`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.

`media` : | an OsinfoMedia instance
Returns : | the path to initrd image, or NULL. [transfer none]

### osinfo_media_get_os ()

    OsinfoOs *          osinfo_media_get_os                 (OsinfoMedia *media);

`media` : | an OsinfoMedia instance
Returns : | the operating system, or NULL. [transfer full]

### 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.

`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]

### osinfo_media_get_installer ()

    gboolean            osinfo_media_get_installer          (OsinfoMedia *media);

Whether `media` provides an installer for an OS.

`media` : | an OsinfoMedia instance
Returns : | TRUE if media is installer, FALSE otherwise

### osinfo_media_get_live ()

    gboolean            osinfo_media_get_live               (OsinfoMedia *media);

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

`media` : | an OsinfoMedia instance
Returns : | TRUE if media is live, FALSE otherwise

### 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.

`media` : | an OsinfoMedia instance
Returns : | the number of installer reboots or -1 if media is not an installer. [transfer none]

## Property Details

### The `"application-id"` property

      "application-id"           gchar*                : Read / Write

Expected application ID (regular expression) for ISO9660 image/device.

Default value: NULL

### The `"architecture"` property

      "architecture"             gchar*                : Read / Write

The target hardware architecture of this media.

Default value: NULL

### The `"initrd-path"` property

      "initrd-path"              gchar*                : Read / Write

The path to the initrd image in the install tree.

Default value: NULL

### The `"installer"` property

      "installer"                gboolean              : Read / Write

Whether media provides an installer for an OS.

Default value: TRUE

### The `"installer-reboots"` property

      "installer-reboots"        gint                  : Read / Write

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

This property is not applicable to 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.

Default value: 1

### The `"kernel-path"` property

      "kernel-path"              gchar*                : Read / Write

The path to the kernel image in the install tree.

Default value: NULL

### The `"languages"` property

      "languages"                gpointer              : Read

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.

Type: GLib.List(utf8) Transfer: container

### The `"live"` property

      "live"                     gboolean              : Read / Write

Whether media can boot directly an OS without any installations.

Default value: FALSE

### The `"os"` property

      "os"                       OsinfoOs*             : Read / Write

Os information for the current media. For media stored in an OsinfoDB, it will be filled when the database is loaded, otherwise the property will be filled after a successful call to `osinfo_db_identify_media()`.

### The `"publisher-id"` property

      "publisher-id"             gchar*                : Read / Write

Expected publisher ID (regular expression) for ISO9660 image/device.

Default value: NULL

### The `"system-id"` property

      "system-id"                gchar*                : Read / Write

Expected system ID (regular expression) for ISO9660 image/device.

Default value: NULL

### The `"url"` property

      "url"                      gchar*                : Read / Write

The URL to this media.

Default value: NULL

### The `"volume-id"` property

      "volume-id"                gchar*                : Read / Write

Expected volume ID (regular expression) for ISO9660 image/device.

Default value: NULL

## See Also

OsinfoOs