Re: [PATCHv2 1/2] installer: API to generate commandline info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 12, 2013 at 4:09 AM, Fabiano Fidêncio <fidencio@xxxxxxxxxx> wrote:
> Each OS has a specific method to handle unattended installations.
> To start an unattended installation is needed pass a command line to the kernel

'is needed' -> 'one needs to'.

> specifying the method that will be used  (kickstart for Fedora, autoyast for
> OpenSuSE's)

I don't think this part is true. The method name is just part of the
commandline syntax and its fixed for each installer/os.

>and its necessary informations to load the install script.
>
> This API enables apps to query such command line, if any.
> ---
>  osinfo/libosinfo.syms          |  2 ++
>  osinfo/osinfo_install_script.c | 49 ++++++++++++++++++++++++++++++++++++++++--
>  osinfo/osinfo_install_script.h |  4 ++++
>  3 files changed, 53 insertions(+), 2 deletions(-)
>
> diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
> index 8fcf327..bb5fc6f 100644
> --- a/osinfo/libosinfo.syms
> +++ b/osinfo/libosinfo.syms
> @@ -414,6 +414,8 @@ LIBOSINFO_0.2.6 {
>  } LIBOSINFO_0.2.3;
>
>  LIBOSINFO_0.2.7 {
> +       osinfo_install_script_generate_command_line;
> +
>         osinfo_platform_get_all_devices;
>  } LIBOSINFO_0.2.6;
>
> diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c
> index 3d5fe8d..42e977b 100644
> --- a/osinfo/osinfo_install_script.c
> +++ b/osinfo/osinfo_install_script.c
> @@ -732,6 +732,7 @@ static xmlNodePtr osinfo_install_script_generate_entity_xml(OsinfoInstallScript
>  static xmlDocPtr osinfo_install_script_generate_config_xml(OsinfoInstallScript *script,
>                                                             OsinfoOs *os,
>                                                             OsinfoInstallConfig *config,
> +                                                           const gchar *node_name,
>                                                             GError **error)
>  {
>      xmlDocPtr doc = xmlNewDoc((xmlChar *)"1.0");
> @@ -740,7 +741,7 @@ static xmlDocPtr osinfo_install_script_generate_config_xml(OsinfoInstallScript *
>
>      root = xmlNewDocNode(NULL,
>                           NULL,
> -                         (xmlChar*)"install-script-config",
> +                         (xmlChar*)node_name,
>                           NULL);
>      xmlDocSetRootElement(doc, root);
>
> @@ -820,13 +821,14 @@ static gboolean osinfo_install_script_apply_template(OsinfoInstallScript *script
>                                                       OsinfoOs *os,
>                                                       const gchar *templateUri,
>                                                       const gchar *template,
> +                                                     const gchar *node_name,
>                                                       gchar **result,
>                                                       OsinfoInstallConfig *config,
>                                                       GError **error)
>  {
>      gboolean ret = FALSE;
>      xsltStylesheetPtr templateXsl = osinfo_install_script_load_template(templateUri, template, error);
> -    xmlDocPtr configXml = osinfo_install_script_generate_config_xml(script, os, config, error);
> +    xmlDocPtr configXml = osinfo_install_script_generate_config_xml(script, os, config, node_name, error);
>
>      if (!templateXsl || !configXml)
>          goto cleanup;
> @@ -871,6 +873,7 @@ static void osinfo_install_script_template_loaded(GObject *src,
>                                                data->os,
>                                                uri,
>                                                input,
> +                                              "install-script-config",
>                                                &output,
>                                                data->config,
>                                                &error)) {
> @@ -915,6 +918,7 @@ void osinfo_install_script_generate_async(OsinfoInstallScript *script,
>                                                    os,
>                                                    "<data>",
>                                                    templateData,
> +                                                  "install-script-config",
>                                                    &output,
>                                                    data->config,
>                                                    &error)) {
> @@ -1196,6 +1200,46 @@ GFile *osinfo_install_script_generate_output(OsinfoInstallScript *script,
>      return data.file;
>  }
>
> +/**
> + * osinfo_install_script_generate_command_line:
> + * @script: the install script
> + * @os:     the os entity
> + * @config: the install script config
> + *
> + * Some install scripts needs pass a command line to the kernel, specifing the

Same grammatical mistake here.

> + * installation method to be used to provide an unattended installation and the

Same comment about installation method not worth mentioning.

> + * necessary parameters like the media where the install script file can be
> + * found, the install script filename, etc. Such install scripts belongs to OSs

belongs -> belong

> + * that provide paths to the kernel and initrd files that are needed for direct
> + * boot.

IMO: 'that are needed for direct boot' -> 'that can be used to
directly boot[INSERT LINK TO DOC ON QEMU'S DIRECT BOOT HERE] the OS in
order to pass the needed commandline to it.

> + * Returns: (transfer full): The generated command line string, NULL otherwise.
> + */
> +gchar *osinfo_install_script_generate_command_line(OsinfoInstallScript *script,
> +                                                   OsinfoOs *os,
> +                                                   OsinfoInstallConfig *config)
> +{
> +    const gchar *templateData = osinfo_install_script_get_template_data(script);
> +    gchar *output = NULL;
> +
> +    if (templateData) {
> +        GError *error = NULL;
> +        if (!osinfo_install_script_apply_template(script,
> +                                                  os,
> +                                                  "<data>",
> +                                                  templateData,
> +                                                  "command-line",
> +                                                  &output,
> +                                                  config,
> +                                                  &error)) {
> +            g_prefix_error(&error, "%s", _("Failed to apply script template: "));
> +        }
> +    }
> +
> +    return output;
> +}
> +
> +
>  OsinfoPathFormat osinfo_install_script_get_path_format(OsinfoInstallScript *script)
>  {
>      return osinfo_entity_get_param_value_enum
> @@ -1266,6 +1310,7 @@ int osinfo_install_script_get_post_install_drivers_signing_req(OsinfoInstallScri
>           OSINFO_DEVICE_DRIVER_SIGNING_REQ_NONE);
>  }
>
> +
>  /*
>   * Local variables:
>   *  indent-tabs-mode: nil
> diff --git a/osinfo/osinfo_install_script.h b/osinfo/osinfo_install_script.h
> index e94c88c..c3ec3c4 100644
> --- a/osinfo/osinfo_install_script.h
> +++ b/osinfo/osinfo_install_script.h
> @@ -175,6 +175,10 @@ GFile *osinfo_install_script_generate_output(OsinfoInstallScript *script,
>                                               GCancellable *cancellable,
>                                               GError **error);
>
> +gchar *osinfo_install_script_generate_command_line(OsinfoInstallScript *script,
> +                                                   OsinfoOs *os,
> +                                                   OsinfoInstallConfig *config);
> +
>  gboolean osinfo_install_script_has_config_param(const OsinfoInstallScript *script, const OsinfoInstallConfigParam *config_param);
>
>  gboolean osinfo_install_script_has_config_param_name(const OsinfoInstallScript *script, const gchar *name);

ACK with all those fixed.

--
Regards,

Zeeshan Ali (Khattak)
FSF member#5124

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux