Libosinfo Reference Manual: OsinfoInstallScript

## OsinfoInstallScript OsinfoInstallScript — OS install script generation |

## Functions

OsinfoInstallScript * | osinfo_install_script_new ()
OsinfoInstallScript * | osinfo_install_script_new_uri ()
OsinfoInstallScript * | osinfo_install_script_new_data ()
const gchar * | osinfo_install_script_get_template_uri ()
const gchar * | osinfo_install_script_get_template_data ()
const gchar * | osinfo_install_script_get_profile ()
const gchar * | osinfo_install_script_get_product_key_format ()
void | osinfo_install_script_set_output_prefix ()
const gchar * | osinfo_install_script_get_output_prefix ()
const gchar * | osinfo_install_script_get_output_filename ()
const gchar * | osinfo_install_script_get_expected_filename ()
OsinfoAvatarFormat * | osinfo_install_script_get_avatar_format ()
void | osinfo_install_script_generate_async ()
gchar * | osinfo_install_script_generate_finish ()
gchar * | osinfo_install_script_generate ()
void | osinfo_install_script_generate_output_async ()
GFile * | osinfo_install_script_generate_output_finish ()
GFile * | osinfo_install_script_generate_output ()
gchar * | osinfo_install_script_generate_command_line ()
gboolean | osinfo_install_script_has_config_param ()
gboolean | osinfo_install_script_has_config_param_name ()
OsinfoInstallConfigParam * | osinfo_install_script_get_config_param ()
GList * | osinfo_install_script_get_config_param_list ()
OsinfoInstallConfigParamList * | osinfo_install_script_get_config_params ()
OsinfoPathFormat | osinfo_install_script_get_path_format ()
gboolean | osinfo_install_script_get_can_pre_install_drivers ()
gboolean | osinfo_install_script_get_can_post_install_drivers ()
int | osinfo_install_script_get_pre_install_drivers_signing_req ()
int | osinfo_install_script_get_post_install_drivers_signing_req ()
unsigned int | osinfo_install_script_get_injection_methods ()
gboolean | osinfo_install_script_get_needs_internet ()

## Properties

gchar * | distro | Read
gchar * | family | Read
OsinfoAvatarFormat * | avatar-format | Read
OsinfoPathFormat | path-format | Read
gchar * | product-key-format | Read
gchar * | profile | Read / Write / Construct Only
gchar * | template-data | Read / Write / Construct Only
gchar * | template-uri | Read / Write / Construct Only

## Types and Values

#define | OSINFO_INSTALL_SCRIPT_PROFILE_JEOS
#define | OSINFO_INSTALL_SCRIPT_PROFILE_DESKTOP
#define | OSINFO_INSTALL_SCRIPT_PROP_TEMPLATE_URI
#define | OSINFO_INSTALL_SCRIPT_PROP_TEMPLATE_DATA
#define | OSINFO_INSTALL_SCRIPT_PROP_PROFILE
#define | OSINFO_INSTALL_SCRIPT_PROP_PRODUCT_KEY_FORMAT
#define | OSINFO_INSTALL_SCRIPT_PROP_EXPECTED_FILENAME
#define | OSINFO_INSTALL_SCRIPT_PROP_PATH_FORMAT
#define | OSINFO_INSTALL_SCRIPT_PROP_CAN_PRE_INSTALL_DRIVERS
#define | OSINFO_INSTALL_SCRIPT_PROP_CAN_POST_INSTALL_DRIVERS
#define | OSINFO_INSTALL_SCRIPT_PROP_NEEDS_INTERNET
#define | OSINFO_INSTALL_SCRIPT_PROP_PRE_INSTALL_DRIVERS_SIGNING_REQ
#define | OSINFO_INSTALL_SCRIPT_PROP_POST_INSTALL_DRIVERS_SIGNING_REQ
#define | OSINFO_INSTALL_SCRIPT_PROP_INJECTION_METHOD
enum | OsinfoPathFormat
enum | OsinfoDeviceDriverSigningReq
enum | OsinfoInstallScriptInjectionMethod
| OsinfoOs

## Object Hierarchy

        GEnum
        ├── OsinfoDeviceDriverSigningReq
        ╰── OsinfoPathFormat
        GFlags
        ╰── OsinfoInstallScriptInjectionMethod
        GObject
        ╰── OsinfoEntity
            ├── OsinfoInstallScript
            ╰── OsinfoProduct
                ╰── OsinfoOs

## Description

OsinfoInstallScript is an object used to generate an automated installation script for an OS. The OS configuration data (language, keyboard, timezone, ...) comes from an OsinfoInstallConfig object.

## Functions

### osinfo_install_script_new ()

    OsinfoInstallScript *
    osinfo_install_script_new (const gchar *id);

### osinfo_install_script_new_uri ()

    OsinfoInstallScript *
    osinfo_install_script_new_uri (const gchar *id,
                                   const gchar *profile,
                                   const gchar *templateUri);

Construct a new install script from a stylesheet URI

#### Parameters

id | a unique identifier |
profile | the profile of script |
templateUri | style sheet URI |

#### Returns

an new install script.

[transfer full]

### osinfo_install_script_new_data ()

    OsinfoInstallScript *
    osinfo_install_script_new_data (const gchar *id,
                                    const gchar *profile,
                                    const gchar *templateData);

Construct a new install script from stylesheet data

#### Parameters

id | a unique identifier |
profile | the profile of script |
templateData | style sheet data |

#### Returns

an new install script.

[transfer full]

### osinfo_install_script_get_template_uri ()

    const gchar *
    osinfo_install_script_get_template_uri
                                   (OsinfoInstallScript *script);

### osinfo_install_script_get_template_data ()

    const gchar *
    osinfo_install_script_get_template_data
                                   (OsinfoInstallScript *script);

### osinfo_install_script_get_profile ()

    const gchar *
    osinfo_install_script_get_profile (OsinfoInstallScript *script);

### osinfo_install_script_get_product_key_format ()

    const gchar *
    osinfo_install_script_get_product_key_format
                                   (OsinfoInstallScript *script);

If this function returns a non-NULL string, it means that the `script` requires you to specify product registration key through OsinfoInstallConfig instance passed to script generation methods.

The returned string specifies the expected format of the product key like this:

@ - any character % - alphabet

### - numeric character

$ - alphanumeric character

All other characters represent themselves.

For example in case of installer for Microsoft Windows XP, you'll get "$$$$$-$$$$$-$$$$$-$$$$$-$$$$$". That means a product key consists of 24 alphanumeric characters and 4 '-' characters at (0-based) indices 5, 11, 17 and 23.

#### Parameters

script | the install script |

#### Returns

Product key format mask, or NULL.

[transfer none]

### osinfo_install_script_set_output_prefix ()

    void
    osinfo_install_script_set_output_prefix
                                   (OsinfoInstallScript *script,
                                    const gchar *prefix);

### osinfo_install_script_get_output_prefix ()

    const gchar *
    osinfo_install_script_get_output_prefix
                                   (OsinfoInstallScript *script);

### osinfo_install_script_get_output_filename ()

    const gchar *
    osinfo_install_script_get_output_filename
                                   (OsinfoInstallScript *script);

Some operating systems are able to use any script filename, allowing the application to set the filename as desired. libosinfo provides this functionality by set the expected filename's prefix using `osinfo_install_script_set_output_prefix()` function.

#### Parameters

script | the install script |

#### Returns

the output script filename.

[transfer none]

### osinfo_install_script_get_expected_filename ()

    const gchar *
    osinfo_install_script_get_expected_filename
                                   (OsinfoInstallScript *script);

Some operating systems (as Windows) expect that script filename has particular name to work.

#### Parameters

script | the install script |

#### Returns

the expected script filename.

[transfer none]

### osinfo_install_script_get_avatar_format ()

    OsinfoAvatarFormat *
    osinfo_install_script_get_avatar_format
                                   (OsinfoInstallScript *script);

Some install scripts have restrictions on the format of the user avatar. Use this method to retrieve those restrictions in the form of an OsinfoAvatarFormat instance.

#### Parameters

script | the install script |

#### Returns

The avatar format, or NULL if there is no restrictions on the format of avatar.

[transfer none]

### osinfo_install_script_generate_async ()

    void
    osinfo_install_script_generate_async (OsinfoInstallScript *script,
                                          OsinfoOs *os,
                                          OsinfoInstallConfig *config,
                                          GCancellable *cancellable,
                                          GAsyncReadyCallback callback,
                                          gpointer user_data);

### osinfo_install_script_generate_finish ()

    gchar *
    osinfo_install_script_generate_finish (OsinfoInstallScript *script,
                                           GAsyncResult *res,
                                           GError **error);

#### Parameters

script | the install script |
res | a GAsyncResult |
error | The location where to store any error, or NULL |

#### Returns

the generated script, or NULL on error.

[transfer full]

### osinfo_install_script_generate ()

    gchar *
    osinfo_install_script_generate (OsinfoInstallScript *script,
                                    OsinfoOs *os,
                                    OsinfoInstallConfig *config,
                                    GCancellable *cancellable,
                                    GError **error);

### osinfo_install_script_generate_output_async ()

    void
    osinfo_install_script_generate_output_async
                                   (OsinfoInstallScript *script,
                                    OsinfoOs *os,
                                    OsinfoInstallConfig *config,
                                    GFile *output_dir,
                                    GCancellable *cancellable,
                                    GAsyncReadyCallback callback,
                                    gpointer user_data);

### osinfo_install_script_generate_output_finish ()

    GFile *
    osinfo_install_script_generate_output_finish
                                   (OsinfoInstallScript *script,
                                    GAsyncResult *res,
                                    GError **error);

#### Parameters

script | the install script |
res | a GAsyncResult |
error | The location where to store any error, or NULL |

#### Returns

a file containing the script, or NULL on error.

[transfer full]

### osinfo_install_script_generate_output ()

    GFile *
    osinfo_install_script_generate_output (OsinfoInstallScript *script,
                                           OsinfoOs *os,
                                           OsinfoInstallConfig *config,
                                           GFile *output_dir,
                                           GCancellable *cancellable,
                                           GError **error);

Creates an install script written in a file

#### Parameters

script | the install script |
os | the os entity |
config | the install script config |
output_dir | the directory where file containing the output script will be written |
cancellable | a GCancellable, or `NULL`. | [allow-none]
error | The location where to store any error, or `NULL` |

#### Returns

a file containing the script.

[transfer full]

### osinfo_install_script_generate_command_line ()

    gchar *
    osinfo_install_script_generate_command_line
                                   (OsinfoInstallScript *script,
                                    OsinfoOs *os,
                                    OsinfoInstallConfig *config);

Some install scripts need to pass a command line to the kernel, Such install scripts belong to OSs that provide paths to the kernel and initrd files that can be used to directly boot (http://wiki.qemu.org/download/qemu-doc.htmldirect_005flinux_005fboot) the OS in order to pass the needed commandline to it.

#### Parameters

script | the install script |
os | the os entity |
config | the install script config |

#### Returns

The generated command line string, NULL otherwise.

[transfer full]

### osinfo_install_script_has_config_param ()

    gboolean
    osinfo_install_script_has_config_param
                                   (const OsinfoInstallScript *script,
                                    const OsinfoInstallConfigParam *config_param);

### osinfo_install_script_has_config_param_name ()

    gboolean
    osinfo_install_script_has_config_param_name
                                   (const OsinfoInstallScript *script,
                                    const gchar *name);

### osinfo_install_script_get_config_param ()

    OsinfoInstallConfigParam *
    osinfo_install_script_get_config_param
                                   (const OsinfoInstallScript *script,
                                    const gchar *name);

Get a config param from the config param's list

#### Parameters

script | the install script |
name | name of the parameter |

#### Returns

the sought config param, if exists. NULL otherwise.

[transfer full]

### osinfo_install_script_get_config_param_list ()

    GList *
    osinfo_install_script_get_config_param_list
                                   (const OsinfoInstallScript *script);

Get the list of valid config parameters for `script` .

#### Returns

the list of valid OsinfoInstallConfigParam parameters. Free with `g_list_free()` when done. The elements are owned by libosinfo.

[transfer container][element-type OsinfoInstallScript]

### osinfo_install_script_get_config_params ()

    OsinfoInstallConfigParamList *
    osinfo_install_script_get_config_params
                                   (const OsinfoInstallScript *script);

Get the list of valid config parameters for `script` .

#### Returns

the list of valid OsinfoInstallConfigParam parameters.

[transfer none]

### osinfo_install_script_get_path_format ()

    OsinfoPathFormat
    osinfo_install_script_get_path_format (OsinfoInstallScript *script);

### osinfo_install_script_get_can_pre_install_drivers ()

    gboolean
    osinfo_install_script_get_can_pre_install_drivers
                                   (OsinfoInstallScript *script);

Whether install script can install drivers at the very beginning of installation. This is needed for devices for which the OS in question does not have out of the box support for and devices are required/prefered to be available during actual installation.

#### Parameters

script | the install script |

#### Returns

TRUE if install script supports pre-installable drivers, FALSE otherwise.

### osinfo_install_script_get_can_post_install_drivers ()

    gboolean
    osinfo_install_script_get_can_post_install_drivers
                                   (OsinfoInstallScript *script);

### osinfo_install_script_get_pre_install_drivers_signing_req ()

    int
    osinfo_install_script_get_pre_install_drivers_signing_req
                                   (OsinfoInstallScript *script);

If install script can install drivers at the very beginning of installation, this function retrieves the requirement about signed status of drivers.

#### Parameters

script | the install script |

#### Returns

.

[type OsinfoDeviceDriverSigningReq]

### osinfo_install_script_get_post_install_drivers_signing_req ()

    int
    osinfo_install_script_get_post_install_drivers_signing_req
                                   (OsinfoInstallScript *script);

If install script can install drivers at the end of installation, this function retrieves the requirement about signed status of drivers.

#### Parameters

script | the install script |

#### Returns

.

[type OsinfoDeviceDriverSigningReq]

### osinfo_install_script_get_injection_methods ()

    unsigned int
    osinfo_install_script_get_injection_methods
                                   (OsinfoInstallScript *script);

Retrieve the supported method to inject the script in to the installation process.

#### Parameters

script | the install script |

#### Returns

bitwise-or of supported methods for install script injection.

[type OsinfoInstallScriptInjectionMethod]

### osinfo_install_script_get_needs_internet ()

    gboolean
    osinfo_install_script_get_needs_internet
                                   (OsinfoInstallScript *script);

Some install scripts cannot ensure that they work without an internet connection.

#### Parameters

script | the install script |

#### Returns

TRUE if script needs an internet connection, FALSE otherwise internet connection.

## Types and Values

### OSINFO_INSTALL_SCRIPT_PROFILE_JEOS

    #define OSINFO_INSTALL_SCRIPT_PROFILE_JEOS    "jeos"

### OSINFO_INSTALL_SCRIPT_PROFILE_DESKTOP

    #define OSINFO_INSTALL_SCRIPT_PROFILE_DESKTOP "desktop"

### OSINFO_INSTALL_SCRIPT_PROP_TEMPLATE_URI

    #define OSINFO_INSTALL_SCRIPT_PROP_TEMPLATE_URI       "template-uri"

### OSINFO_INSTALL_SCRIPT_PROP_TEMPLATE_DATA

    #define OSINFO_INSTALL_SCRIPT_PROP_TEMPLATE_DATA      "template-data"

### OSINFO_INSTALL_SCRIPT_PROP_PROFILE

    #define OSINFO_INSTALL_SCRIPT_PROP_PROFILE            "profile"

### OSINFO_INSTALL_SCRIPT_PROP_PRODUCT_KEY_FORMAT

    #define OSINFO_INSTALL_SCRIPT_PROP_PRODUCT_KEY_FORMAT "product-key-format"

### OSINFO_INSTALL_SCRIPT_PROP_EXPECTED_FILENAME

    #define OSINFO_INSTALL_SCRIPT_PROP_EXPECTED_FILENAME  "expected-filename"

### OSINFO_INSTALL_SCRIPT_PROP_PATH_FORMAT

    #define OSINFO_INSTALL_SCRIPT_PROP_PATH_FORMAT        "path-format"

### OSINFO_INSTALL_SCRIPT_PROP_CAN_PRE_INSTALL_DRIVERS

    #define OSINFO_INSTALL_SCRIPT_PROP_CAN_PRE_INSTALL_DRIVERS "can-pre-install-drivers"

### OSINFO_INSTALL_SCRIPT_PROP_CAN_POST_INSTALL_DRIVERS

    #define OSINFO_INSTALL_SCRIPT_PROP_CAN_POST_INSTALL_DRIVERS "can-post-install-drivers"

### OSINFO_INSTALL_SCRIPT_PROP_NEEDS_INTERNET

    #define OSINFO_INSTALL_SCRIPT_PROP_NEEDS_INTERNET     "needs-internet"

### OSINFO_INSTALL_SCRIPT_PROP_PRE_INSTALL_DRIVERS_SIGNING_REQ

    #define OSINFO_INSTALL_SCRIPT_PROP_PRE_INSTALL_DRIVERS_SIGNING_REQ "pre-install-drivers-signing-req"

### OSINFO_INSTALL_SCRIPT_PROP_POST_INSTALL_DRIVERS_SIGNING_REQ

    #define OSINFO_INSTALL_SCRIPT_PROP_POST_INSTALL_DRIVERS_SIGNING_REQ "post-install-drivers-signing-req"

### OSINFO_INSTALL_SCRIPT_PROP_INJECTION_METHOD

    #define OSINFO_INSTALL_SCRIPT_PROP_INJECTION_METHOD "injection-method"

### enum OsinfoPathFormat

#### Members

OSINFO_PATH_FORMAT_UNIX | Unix/Linux path format, e.g /home/foo/bar.txt |
OSINFO_PATH_FORMAT_DOS | DOS/Windows path format, e.g \My Documents\bar.txt |

### enum OsinfoDeviceDriverSigningReq

`OSINFO_DEVICE_DRIVER_SIGNING_REQ_NONE` : Script do not require device drivers to be signed.

`OSINFO_DEVICE_DRIVER_SIGNING_REQ_STRICT` : Script must only be given signed device drivers. Some scripts will allow overriding this requirement through osinfo_install_config_set_driver_signing function. You can query if a script supports this by checking if OSINFO_INSTALL_CONFIG_PROP_DRIVER_SIGNING configuration parameter is used by the script in question (or other scripts in the same profile).

`OSINFO_DEVICE_DRIVER_SIGNING_REQ_WARN` : A warning will be issued by OS installer if device drivers are not signed and most probably require user input (and thus breaking unattended installation). See OSINFO_DEVICE_DRIVER_SIGNING_REQ_STRICT on how this warning can be disabled for some scripts.

#### Members

OSINFO_DEVICE_DRIVER_SIGNING_REQ_NONE |  |
OSINFO_DEVICE_DRIVER_SIGNING_REQ_STRICT |  |
OSINFO_DEVICE_DRIVER_SIGNING_REQ_WARN |  |

### enum OsinfoInstallScriptInjectionMethod

`OSINFO_INSTALL_SCRIPT_INJECTION_METHOD_CDROM` : Support injection of the installation script trough a CD-ROM. `OSINFO_INSTALL_SCRIPT_INJECTION_METHOD_DISK` : Support injection of the installation script trough a disk. `OSINFO_INSTALL_SCRIPT_INJECTION_METHOD_FLOPPY` : Support injection of the installation script trough a floppy disk. `OSINFO_INSTALL_SCRIPT_INJECTION_METHOD_INITRD` : Support injection of the installation script trough the initrd. `OSINFO_INSTALL_SCRIPT_INJECTION_METHOD_WEB` : Support injection of the installation script from the web.

#### Members

OSINFO_INSTALL_SCRIPT_INJECTION_METHOD_CDROM |  |
OSINFO_INSTALL_SCRIPT_INJECTION_METHOD_DISK |  |
OSINFO_INSTALL_SCRIPT_INJECTION_METHOD_FLOPPY |  |
OSINFO_INSTALL_SCRIPT_INJECTION_METHOD_INITRD |  |
OSINFO_INSTALL_SCRIPT_INJECTION_METHOD_WEB |  |

### OsinfoOs

    typedef struct _OsinfoOs OsinfoOs;

## Property Details

### The `“distro”` property

      “distro”                   gchar *

The generic distro this OS belongs to, for example fedora, windows, solaris, freebsd etc.

Flags: Read

Default value: NULL

### The `“family”` property

      “family”                   gchar *

The generic family this OS belongs to, based upon its kernel, for example linux, winnt, solaris, freebsd etc.

Flags: Read

Default value: NULL

### The `“avatar-format”` property

      “avatar-format”            OsinfoAvatarFormat *

Expected avatar format.

Flags: Read

### The `“path-format”` property

      “path-format”              OsinfoPathFormat

Expected path format.

Flags: Read

Default value: OSINFO_PATH_FORMAT_UNIX

### The `“product-key-format”` property

      “product-key-format”       gchar *

Product key format mask.

Flags: Read

Default value: NULL

### The `“profile”` property

      “profile”                  gchar *

Install script profile name.

Flags: Read / Write / Construct Only

Default value: NULL

### The `“template-data”` property

      “template-data”            gchar *

Data for install script template.

Flags: Read / Write / Construct Only

Default value: NULL

### The `“template-uri”` property

      “template-uri”             gchar *

URI for install script template.

Flags: Read / Write / Construct Only

Default value: NULL

## See Also

OsinfoInstallConfig