/* unattended-installer.c generated by valac 0.56.18-dirty, the Vala compiler
 * generated from unattended-installer.vala, do not modify */

/* This file is part of GNOME Boxes. License: LGPLv2+*/

#include <glib-object.h>
#include <libvirt-gconfig/libvirt-gconfig.h>
#include <gio/gio.h>
#include "common.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <osinfo/osinfo.h>
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
#include <handy.h>
#include <float.h>
#include <math.h>

#define BOXES_UNATTENDED_INSTALLER_INPUT_SOURCE_SCHEMA "org.gnome.desktop.input-sources"
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define BOXES_TYPE_INSTALLER_MEDIA (boxes_installer_media_get_type ())
#define BOXES_INSTALLER_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_INSTALLER_MEDIA, BoxesInstallerMedia))
#define BOXES_INSTALLER_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_INSTALLER_MEDIA, BoxesInstallerMediaClass))
#define BOXES_IS_INSTALLER_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_INSTALLER_MEDIA))
#define BOXES_IS_INSTALLER_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_INSTALLER_MEDIA))
#define BOXES_INSTALLER_MEDIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_INSTALLER_MEDIA, BoxesInstallerMediaClass))

typedef struct _BoxesInstallerMedia BoxesInstallerMedia;
typedef struct _BoxesInstallerMediaClass BoxesInstallerMediaClass;
typedef struct _BoxesInstallerMediaPrivate BoxesInstallerMediaPrivate;

#define BOXES_TYPE_VM_CREATOR (boxes_vm_creator_get_type ())
#define BOXES_VM_CREATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_VM_CREATOR, BoxesVMCreator))
#define BOXES_VM_CREATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_VM_CREATOR, BoxesVMCreatorClass))
#define BOXES_IS_VM_CREATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_VM_CREATOR))
#define BOXES_IS_VM_CREATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_VM_CREATOR))
#define BOXES_VM_CREATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_VM_CREATOR, BoxesVMCreatorClass))

typedef struct _BoxesVMCreator BoxesVMCreator;
typedef struct _BoxesVMCreatorClass BoxesVMCreatorClass;

#define BOXES_TYPE_UNATTENDED_INSTALLER (boxes_unattended_installer_get_type ())
#define BOXES_UNATTENDED_INSTALLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_UNATTENDED_INSTALLER, BoxesUnattendedInstaller))
#define BOXES_UNATTENDED_INSTALLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_UNATTENDED_INSTALLER, BoxesUnattendedInstallerClass))
#define BOXES_IS_UNATTENDED_INSTALLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_UNATTENDED_INSTALLER))
#define BOXES_IS_UNATTENDED_INSTALLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_UNATTENDED_INSTALLER))
#define BOXES_UNATTENDED_INSTALLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_UNATTENDED_INSTALLER, BoxesUnattendedInstallerClass))

typedef struct _BoxesUnattendedInstaller BoxesUnattendedInstaller;
typedef struct _BoxesUnattendedInstallerClass BoxesUnattendedInstallerClass;
typedef struct _BoxesUnattendedInstallerPrivate BoxesUnattendedInstallerPrivate;

#define BOXES_TYPE_UNATTENDED_FILE (boxes_unattended_file_get_type ())
#define BOXES_UNATTENDED_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_UNATTENDED_FILE, BoxesUnattendedFile))
#define BOXES_IS_UNATTENDED_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_UNATTENDED_FILE))
#define BOXES_UNATTENDED_FILE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), BOXES_TYPE_UNATTENDED_FILE, BoxesUnattendedFileIface))

typedef struct _BoxesUnattendedFile BoxesUnattendedFile;
typedef struct _BoxesUnattendedFileIface BoxesUnattendedFileIface;
enum  {
	BOXES_UNATTENDED_INSTALLER_0_PROPERTY,
	BOXES_UNATTENDED_INSTALLER_NEED_USER_INPUT_FOR_VM_CREATION_PROPERTY,
	BOXES_UNATTENDED_INSTALLER_SUPPORTED_DEVICES_PROPERTY,
	BOXES_UNATTENDED_INSTALLER_NEEDS_PASSWORD_PROPERTY,
	BOXES_UNATTENDED_INSTALLER_NUM_PROPERTIES
};
static GParamSpec* boxes_unattended_installer_properties[BOXES_UNATTENDED_INSTALLER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))

#define BOXES_TYPE_UNATTENDED_SCRIPT_FILE (boxes_unattended_script_file_get_type ())
#define BOXES_UNATTENDED_SCRIPT_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_UNATTENDED_SCRIPT_FILE, BoxesUnattendedScriptFile))
#define BOXES_UNATTENDED_SCRIPT_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_UNATTENDED_SCRIPT_FILE, BoxesUnattendedScriptFileClass))
#define BOXES_IS_UNATTENDED_SCRIPT_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_UNATTENDED_SCRIPT_FILE))
#define BOXES_IS_UNATTENDED_SCRIPT_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_UNATTENDED_SCRIPT_FILE))
#define BOXES_UNATTENDED_SCRIPT_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_UNATTENDED_SCRIPT_FILE, BoxesUnattendedScriptFileClass))

typedef struct _BoxesUnattendedScriptFile BoxesUnattendedScriptFile;
typedef struct _BoxesUnattendedScriptFileClass BoxesUnattendedScriptFileClass;

#define BOXES_TYPE_ISO_EXTRACTOR (boxes_iso_extractor_get_type ())
#define BOXES_ISO_EXTRACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_ISO_EXTRACTOR, BoxesISOExtractor))
#define BOXES_ISO_EXTRACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_ISO_EXTRACTOR, BoxesISOExtractorClass))
#define BOXES_IS_ISO_EXTRACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_ISO_EXTRACTOR))
#define BOXES_IS_ISO_EXTRACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_ISO_EXTRACTOR))
#define BOXES_ISO_EXTRACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_ISO_EXTRACTOR, BoxesISOExtractorClass))

typedef struct _BoxesISOExtractor BoxesISOExtractor;
typedef struct _BoxesISOExtractorClass BoxesISOExtractorClass;

#define BOXES_TYPE_APP (boxes_app_get_type ())
#define BOXES_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_APP, BoxesApp))
#define BOXES_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_APP, BoxesAppClass))
#define BOXES_IS_APP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_APP))
#define BOXES_IS_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_APP))
#define BOXES_APP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_APP, BoxesAppClass))

typedef struct _BoxesApp BoxesApp;
typedef struct _BoxesAppClass BoxesAppClass;

#define BOXES_TYPE_APP_WINDOW (boxes_app_window_get_type ())
#define BOXES_APP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_APP_WINDOW, BoxesAppWindow))
#define BOXES_APP_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_APP_WINDOW, BoxesAppWindowClass))
#define BOXES_IS_APP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_APP_WINDOW))
#define BOXES_IS_APP_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_APP_WINDOW))
#define BOXES_APP_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_APP_WINDOW, BoxesAppWindowClass))

typedef struct _BoxesAppWindow BoxesAppWindow;
typedef struct _BoxesAppWindowClass BoxesAppWindowClass;

#define BOXES_TYPE_TOAST (boxes_toast_get_type ())
#define BOXES_TOAST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_TOAST, BoxesToast))
#define BOXES_TOAST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_TOAST, BoxesToastClass))
#define BOXES_IS_TOAST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_TOAST))
#define BOXES_IS_TOAST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_TOAST))
#define BOXES_TOAST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_TOAST, BoxesToastClass))

typedef struct _BoxesToast BoxesToast;
typedef struct _BoxesToastClass BoxesToastClass;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _BoxesUnattendedInstallerPrepareForInstallationData BoxesUnattendedInstallerPrepareForInstallationData;
typedef struct _BoxesUnattendedInstallerPrepareData BoxesUnattendedInstallerPrepareData;
typedef struct _BoxesUnattendedInstallerCreateDiskImageData BoxesUnattendedInstallerCreateDiskImageData;
typedef struct _BoxesUnattendedInstallerCreateIsoData BoxesUnattendedInstallerCreateIsoData;
typedef struct _BoxesUnattendedInstallerExtractBootFilesData BoxesUnattendedInstallerExtractBootFilesData;
typedef void (*BoxesUnattendedInstallerAddUnattendedFileFunc) (BoxesUnattendedFile* file, gpointer user_data);
typedef struct _BoxesUnattendedInstallerSetupDriversData BoxesUnattendedInstallerSetupDriversData;
typedef struct _BoxesUnattendedInstallerSetupDriversFromListData BoxesUnattendedInstallerSetupDriversFromListData;

#define BOXES_TYPE_DOWNLOADER (boxes_downloader_get_type ())
#define BOXES_DOWNLOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_DOWNLOADER, BoxesDownloader))
#define BOXES_DOWNLOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_DOWNLOADER, BoxesDownloaderClass))
#define BOXES_IS_DOWNLOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_DOWNLOADER))
#define BOXES_IS_DOWNLOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_DOWNLOADER))
#define BOXES_DOWNLOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_DOWNLOADER, BoxesDownloaderClass))

typedef struct _BoxesDownloader BoxesDownloader;
typedef struct _BoxesDownloaderClass BoxesDownloaderClass;

#define BOXES_TYPE_UNATTENDED_RAW_FILE (boxes_unattended_raw_file_get_type ())
#define BOXES_UNATTENDED_RAW_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_UNATTENDED_RAW_FILE, BoxesUnattendedRawFile))
#define BOXES_UNATTENDED_RAW_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_UNATTENDED_RAW_FILE, BoxesUnattendedRawFileClass))
#define BOXES_IS_UNATTENDED_RAW_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_UNATTENDED_RAW_FILE))
#define BOXES_IS_UNATTENDED_RAW_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_UNATTENDED_RAW_FILE))
#define BOXES_UNATTENDED_RAW_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_UNATTENDED_RAW_FILE, BoxesUnattendedRawFileClass))

typedef struct _BoxesUnattendedRawFile BoxesUnattendedRawFile;
typedef struct _BoxesUnattendedRawFileClass BoxesUnattendedRawFileClass;
typedef struct _BoxesUnattendedInstallerSetupDriverData BoxesUnattendedInstallerSetupDriverData;
typedef gboolean (*BoxesUnattendedInstallerDriverInstallableFunc) (OsinfoDeviceDriver* driver, gpointer user_data);
typedef OsinfoDeviceDriverSigningReq (*BoxesUnattendedInstallerScriptDriverSigningReqFunc) (OsinfoInstallScript* script, gpointer user_data);
typedef struct _Block49Data Block49Data;
typedef gboolean (*BoxesUnattendedInstallerDriverTestFunction) (OsinfoDeviceDriver* driver, gpointer user_data);
typedef enum  {
	BOXES_CPU_ARCH_COMPATIBILITY_INCOMPATIBLE = -1,
	BOXES_CPU_ARCH_COMPATIBILITY_IDENTICAL = 0,
	BOXES_CPU_ARCH_COMPATIBILITY_COMPATIBLE = 1,
	BOXES_CPU_ARCH_COMPATIBILITY_COMPATIBLE_DIFF_WORDSIZE = 2
} BoxesCPUArchCompatibility;

#define BOXES_TYPE_CPU_ARCH_COMPATIBILITY (boxes_cpu_arch_compatibility_get_type ())
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
typedef gboolean (*BoxesUnattendedInstallerScriptTestFunction) (OsinfoInstallScript* script, gpointer user_data);

#define BOXES_TYPE_OS_DATABASE (boxes_os_database_get_type ())
#define BOXES_OS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_OS_DATABASE, BoxesOSDatabase))
#define BOXES_OS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_OS_DATABASE, BoxesOSDatabaseClass))
#define BOXES_IS_OS_DATABASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_OS_DATABASE))
#define BOXES_IS_OS_DATABASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_OS_DATABASE))
#define BOXES_OS_DATABASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_OS_DATABASE, BoxesOSDatabaseClass))

typedef struct _BoxesOSDatabase BoxesOSDatabase;
typedef struct _BoxesOSDatabaseClass BoxesOSDatabaseClass;

#define BOXES_TYPE_MEDIA_MANAGER (boxes_media_manager_get_type ())
#define BOXES_MEDIA_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BOXES_TYPE_MEDIA_MANAGER, BoxesMediaManager))
#define BOXES_MEDIA_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BOXES_TYPE_MEDIA_MANAGER, BoxesMediaManagerClass))
#define BOXES_IS_MEDIA_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BOXES_TYPE_MEDIA_MANAGER))
#define BOXES_IS_MEDIA_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BOXES_TYPE_MEDIA_MANAGER))
#define BOXES_MEDIA_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BOXES_TYPE_MEDIA_MANAGER, BoxesMediaManagerClass))

typedef struct _BoxesMediaManager BoxesMediaManager;
typedef struct _BoxesMediaManagerClass BoxesMediaManagerClass;
#define _g_settings_schema_unref0(var) ((var == NULL) ? NULL : (var = (g_settings_schema_unref (var), NULL)))
#define _g_settings_schema_source_unref0(var) ((var == NULL) ? NULL : (var = (g_settings_schema_source_unref (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))

struct _BoxesInstallerMedia {
	GObject parent_instance;
	BoxesInstallerMediaPrivate * priv;
	OsinfoOs* os;
	OsinfoResources* resources;
	OsinfoMedia* os_media;
	gchar* label;
	gchar* device_file;
	gchar* mount_point;
	gboolean from_image;
};

struct _BoxesInstallerMediaClass {
	GObjectClass parent_class;
	void (*set_direct_boot_params) (BoxesInstallerMedia* self, GVirConfigDomainOs* os);
	void (*prepare) (BoxesInstallerMedia* self, BoxesActivityProgress* progress, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	gboolean (*prepare_finish) (BoxesInstallerMedia* self, GAsyncResult* _res_);
	void (*prepare_for_installation) (BoxesInstallerMedia* self, const gchar* vm_name, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*prepare_for_installation_finish) (BoxesInstallerMedia* self, GAsyncResult* _res_);
	void (*prepare_to_continue_installation) (BoxesInstallerMedia* self, const gchar* vm_name);
	void (*clean_up) (BoxesInstallerMedia* self);
	void (*clean_up_preparation_cache) (BoxesInstallerMedia* self);
	void (*setup_domain_config) (BoxesInstallerMedia* self, GVirConfigDomain* domain);
	void (*setup_post_install_domain_config) (BoxesInstallerMedia* self, GVirConfigDomain* domain);
	BoxesVMCreator* (*get_vm_creator) (BoxesInstallerMedia* self);
	OsinfoDeviceList* (*get_supported_devices) (BoxesInstallerMedia* self);
	guint64 (*get_installed_size) (BoxesInstallerMedia* self);
	gboolean (*get_need_user_input_for_vm_creation) (BoxesInstallerMedia* self);
	gboolean (*get_prefers_q35) (BoxesInstallerMedia* self);
	gboolean (*get_prefers_ich9) (BoxesInstallerMedia* self);
	gboolean (*get_live) (BoxesInstallerMedia* self);
	gboolean (*get_eject_after_install) (BoxesInstallerMedia* self);
	gchar* (*get_architecture) (BoxesInstallerMedia* self);
};

struct _BoxesUnattendedInstaller {
	BoxesInstallerMedia parent_instance;
	BoxesUnattendedInstallerPrivate * priv;
	GFile* disk_file;
	GFile* kernel_file;
	GFile* initrd_file;
	OsinfoInstallConfig* config;
	OsinfoInstallScriptList* scripts;
	gchar* username;
	gchar* password;
	gchar* product_key;
};

struct _BoxesUnattendedInstallerClass {
	BoxesInstallerMediaClass parent_class;
};

struct _BoxesUnattendedFileIface {
	GTypeInterface parent_iface;
	void (*copy) (BoxesUnattendedFile* self, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*copy_finish) (BoxesUnattendedFile* self, GAsyncResult* _res_, GError** error);
	void (*get_source_file) (BoxesUnattendedFile* self, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	GFile* (*get_source_file_finish) (BoxesUnattendedFile* self, GAsyncResult* _res_, GError** error);
	const gchar* (*get_src_path) (BoxesUnattendedFile* self);
	void (*set_src_path) (BoxesUnattendedFile* self, const gchar* value);
	const gchar* (*get_dest_name) (BoxesUnattendedFile* self);
	void (*set_dest_name) (BoxesUnattendedFile* self, const gchar* value);
	BoxesUnattendedInstaller* (*get_installer) (BoxesUnattendedFile* self);
	void (*set_installer) (BoxesUnattendedFile* self, BoxesUnattendedInstaller* value);
};

struct _BoxesUnattendedInstallerPrivate {
	GList* unattended_files;
	GList* secondary_unattended_files;
	gchar* timezone;
	gchar* lang;
	gchar* hostname;
	gchar* kbd;
	gboolean driver_signing;
	OsinfoDeviceList* additional_devices;
};

struct _BoxesUnattendedInstallerPrepareForInstallationData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BoxesUnattendedInstaller* self;
	gchar* vm_name;
	GCancellable* cancellable;
	OsinfoInstallScriptInjectionMethod _tmp0_;
	OsinfoInstallScriptInjectionMethod _tmp1_;
	gboolean _tmp2_;
	OsinfoMedia* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gboolean _tmp7_;
	OsinfoMedia* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	BoxesISOExtractor* extractor;
	const gchar* _tmp12_;
	BoxesISOExtractor* _tmp13_;
	BoxesISOExtractor* _tmp14_;
	OsinfoInstallScriptInjectionMethod _tmp15_;
	OsinfoInstallScriptInjectionMethod _tmp16_;
	GList* _tmp17_;
	GList* unattended_file_collection;
	GList* unattended_file_it;
	BoxesUnattendedFile* _tmp18_;
	BoxesUnattendedFile* unattended_file;
	BoxesUnattendedFile* _tmp19_;
	GError* _error_;
	gchar* msg;
	gchar* _tmp20_;
	BoxesApp* _tmp21_;
	BoxesAppWindow* _tmp22_;
	BoxesAppWindow* _tmp23_;
	const gchar* _tmp24_;
	BoxesToast* _tmp25_;
	BoxesToast* _tmp26_;
	GError* _tmp27_;
	const gchar* _tmp28_;
	GError* _inner_error0_;
};

struct _BoxesUnattendedInstallerPrepareData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BoxesUnattendedInstaller* self;
	BoxesActivityProgress* progress;
	GCancellable* cancellable;
	gboolean result;
};

struct _BoxesUnattendedInstallerCreateDiskImageData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BoxesUnattendedInstaller* self;
	GCancellable* cancellable;
	gchar* template_path;
	gchar* _tmp0_;
	GFile* template_file;
	GFile* _tmp1_;
	GFile* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GFile* _tmp5_;
	GFile* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	GError* _inner_error0_;
};

struct _BoxesUnattendedInstallerCreateIsoData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BoxesUnattendedInstaller* self;
	GCancellable* cancellable;
	gchar* disk_file_path;
	GFile* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar** argv;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	gchar** _tmp10_;
	gint argv_length1;
	gint _argv_size_;
	GList* _tmp11_;
	GList* unattended_file_collection;
	GList* unattended_file_it;
	BoxesUnattendedFile* _tmp12_;
	BoxesUnattendedFile* unattended_file;
	GFile* source_file;
	BoxesUnattendedFile* _tmp13_;
	GFile* _tmp14_;
	gchar* dest_path;
	BoxesUnattendedFile* _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* src_path;
	GFile* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	const gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	const gchar* _tmp27_;
	gchar* _tmp28_;
	GList* _tmp29_;
	GList* _vala1_unattended_file_collection;
	GList* _vala1_unattended_file_it;
	BoxesUnattendedFile* _tmp30_;
	BoxesUnattendedFile* _vala1_unattended_file;
	GFile* _vala1_source_file;
	BoxesUnattendedFile* _tmp31_;
	GFile* _tmp32_;
	gchar* _vala1_dest_path;
	BoxesUnattendedFile* _tmp33_;
	const gchar* _tmp34_;
	const gchar* _tmp35_;
	gchar* _tmp36_;
	gchar* _vala1_src_path;
	GFile* _tmp37_;
	gchar* _tmp38_;
	gchar* _tmp39_;
	gchar* _tmp40_;
	gchar* _tmp41_;
	const gchar* _tmp42_;
	gchar* _tmp43_;
	gchar* _tmp44_;
	const gchar* _tmp45_;
	gchar* _tmp46_;
	gchar** _tmp47_;
	gint _tmp47__length1;
	GError* _inner_error0_;
};

struct _BoxesUnattendedInstallerExtractBootFilesData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BoxesUnattendedInstaller* self;
	BoxesISOExtractor* extractor;
	GCancellable* cancellable;
	OsinfoMedia* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GFile* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	OsinfoMedia* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	GFile* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	GError* _inner_error0_;
};

struct _BoxesUnattendedInstallerSetupDriversData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BoxesUnattendedInstaller* self;
	BoxesActivityProgress* progress;
	GCancellable* cancellable;
	gboolean result;
	GList* scripts;
	GList* _tmp0_;
	GList* drivers;
	GList* _tmp1_;
	GList* _tmp2_;
	gboolean _tmp3_;
	GList* _tmp4_;
	GList* _tmp5_;
	BoxesActivityProgress* drivers_progress;
	BoxesActivityProgress* _tmp6_;
	GList* _tmp7_;
	BoxesActivityProgress* _tmp8_;
	GList* _tmp9_;
	GList* _tmp10_;
	GList* _tmp11_;
	gboolean _tmp12_;
	GList* _tmp13_;
	GList* _tmp14_;
	BoxesActivityProgress* _vala1_drivers_progress;
	BoxesActivityProgress* _tmp15_;
	GList* _tmp16_;
	BoxesActivityProgress* _tmp17_;
};

struct _BoxesUnattendedInstallerSetupDriversFromListData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BoxesUnattendedInstaller* self;
	GList* drivers;
	BoxesActivityProgress* progress;
	BoxesUnattendedInstallerAddUnattendedFileFunc add_func;
	gpointer add_func_target;
	GCancellable* cancellable;
	gboolean result;
	gdouble driver_progress_scale;
	GList* driver_collection;
	GList* driver_it;
	OsinfoDeviceDriver* _tmp0_;
	OsinfoDeviceDriver* driver;
	BoxesActivityProgress* driver_progress;
	BoxesActivityProgress* _tmp1_;
	OsinfoDeviceDriver* _tmp2_;
	BoxesActivityProgress* _tmp3_;
	OsinfoDeviceList* _tmp4_;
	OsinfoDeviceDriver* _tmp5_;
	OsinfoDeviceList* _tmp6_;
	BoxesActivityProgress* _tmp7_;
	GError* e;
	OsinfoDeviceDriver* _tmp8_;
	const gchar* _tmp9_;
	GError* _tmp10_;
	const gchar* _tmp11_;
	GError* _inner_error1_;
	BoxesActivityProgress* _tmp12_;
	GError* _inner_error0_;
};

struct _BoxesUnattendedInstallerSetupDriverData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	BoxesUnattendedInstaller* self;
	OsinfoDeviceDriver* driver;
	BoxesActivityProgress* progress;
	BoxesUnattendedInstallerAddUnattendedFileFunc add_func;
	gpointer add_func_target;
	GCancellable* cancellable;
	BoxesDownloader* downloader;
	BoxesDownloader* _tmp0_;
	GList* driver_files;
	gchar* location;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* location_checksum;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	GList* files;
	GList* _tmp5_;
	gdouble file_progress_scale;
	GList* _tmp6_;
	GList* _tmp7_;
	GList* filename_collection;
	GList* filename_it;
	const gchar* filename;
	gchar* file_uri;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	GFile* file;
	const gchar* _tmp14_;
	GFile* _tmp15_;
	gchar* driver_file_name;
	const gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	GFile* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	gchar* cached_path;
	const gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* system_cached_path;
	const gchar* _tmp26_;
	gchar* _tmp27_;
	gchar** cached_paths;
	const gchar* _tmp28_;
	gchar* _tmp29_;
	gchar** _tmp30_;
	gint cached_paths_length1;
	gint _cached_paths_size_;
	const gchar* _tmp31_;
	const gchar* _tmp32_;
	gchar* _tmp33_;
	BoxesActivityProgress* file_progress;
	BoxesActivityProgress* _tmp34_;
	GFile* _tmp35_;
	BoxesDownloader* _tmp36_;
	GFile* _tmp37_;
	gchar** _tmp38_;
	gint _tmp38__length1;
	BoxesActivityProgress* _tmp39_;
	GFile* _tmp40_;
	GFile* _tmp41_;
	BoxesActivityProgress* _tmp42_;
	GFile* _tmp43_;
	gchar* _tmp44_;
	gchar* _tmp45_;
	const gchar* _tmp46_;
	BoxesUnattendedRawFile* _tmp47_;
	GList* _tmp48_;
	GList* driver_file_collection;
	GList* driver_file_it;
	BoxesUnattendedFile* _tmp49_;
	BoxesUnattendedFile* driver_file;
	BoxesUnattendedFile* _tmp50_;
	GError* _inner_error0_;
};

struct _Block49Data {
	int _ref_count_;
	BoxesUnattendedInstaller* self;
	gboolean signing_required;
	gboolean driver_signing_mutable;
	BoxesUnattendedInstallerDriverInstallableFunc installable_func;
	gpointer installable_func_target;
};

static gint BoxesUnattendedInstaller_private_offset;
static gpointer boxes_unattended_installer_parent_class = NULL;
VALA_EXTERN BoxesApp* boxes_app_app;

VALA_EXTERN GType boxes_installer_media_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesInstallerMedia, g_object_unref)
VALA_EXTERN GType boxes_vm_creator_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesVMCreator, g_object_unref)
VALA_EXTERN GType boxes_unattended_installer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesUnattendedInstaller, g_object_unref)
VALA_EXTERN GType boxes_unattended_file_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesUnattendedFile, g_object_unref)
VALA_EXTERN void boxes_installer_media_prepare_to_continue_installation (BoxesInstallerMedia* self,
                                                             const gchar* vm_name);
VALA_EXTERN void boxes_installer_media_prepare_for_installation (BoxesInstallerMedia* self,
                                                     const gchar* vm_name,
                                                     GCancellable* cancellable,
                                                     GAsyncReadyCallback _callback_,
                                                     gpointer _user_data_);
VALA_EXTERN void boxes_installer_media_prepare_for_installation_finish (BoxesInstallerMedia* self,
                                                            GAsyncResult* _res_);
VALA_EXTERN void boxes_installer_media_setup_domain_config (BoxesInstallerMedia* self,
                                                GVirConfigDomain* domain);
VALA_EXTERN void boxes_installer_media_setup_post_install_domain_config (BoxesInstallerMedia* self,
                                                             GVirConfigDomain* domain);
VALA_EXTERN void boxes_installer_media_set_direct_boot_params (BoxesInstallerMedia* self,
                                                   GVirConfigDomainOs* os);
VALA_EXTERN void boxes_installer_media_clean_up (BoxesInstallerMedia* self);
VALA_EXTERN void boxes_installer_media_clean_up_preparation_cache (BoxesInstallerMedia* self);
VALA_EXTERN void boxes_installer_media_prepare (BoxesInstallerMedia* self,
                                    BoxesActivityProgress* progress,
                                    GCancellable* cancellable,
                                    GAsyncReadyCallback _callback_,
                                    gpointer _user_data_);
VALA_EXTERN gboolean boxes_installer_media_prepare_finish (BoxesInstallerMedia* self,
                                               GAsyncResult* _res_);
VALA_EXTERN gboolean boxes_installer_media_get_need_user_input_for_vm_creation (BoxesInstallerMedia* self);
VALA_EXTERN OsinfoDeviceList* boxes_installer_media_get_supported_devices (BoxesInstallerMedia* self);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
static gchar* boxes_unattended_installer_escape_genisoimage_path (const gchar* path);
VALA_EXTERN BoxesUnattendedInstaller* boxes_unattended_installer_new_from_media (BoxesInstallerMedia* media,
                                                                     OsinfoInstallScriptList* scripts,
                                                                     GError** error);
VALA_EXTERN BoxesUnattendedInstaller* boxes_unattended_installer_construct_from_media (GType object_type,
                                                                           BoxesInstallerMedia* media,
                                                                           OsinfoInstallScriptList* scripts,
                                                                           GError** error);
VALA_EXTERN BoxesInstallerMedia* boxes_installer_media_new (void);
VALA_EXTERN BoxesInstallerMedia* boxes_installer_media_construct (GType object_type);
VALA_EXTERN GType boxes_unattended_script_file_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesUnattendedScriptFile, g_object_unref)
VALA_EXTERN BoxesUnattendedScriptFile* boxes_unattended_script_file_new (BoxesUnattendedInstaller* installer,
                                                             OsinfoInstallScript* script,
                                                             const gchar* dest_name,
                                                             GError** error);
VALA_EXTERN BoxesUnattendedScriptFile* boxes_unattended_script_file_construct (GType object_type,
                                                                   BoxesUnattendedInstaller* installer,
                                                                   OsinfoInstallScript* script,
                                                                   const gchar* dest_name,
                                                                   GError** error);
static void boxes_unattended_installer_add_unattended_file (BoxesUnattendedInstaller* self,
                                                     BoxesUnattendedFile* file);
VALA_EXTERN gchar* boxes_get_timezone (void);
static gchar* boxes_unattended_installer_get_preferred_language (BoxesUnattendedInstaller* self);
static gchar* boxes_unattended_installer_get_preferred_keyboard (BoxesUnattendedInstaller* self,
                                                          const gchar* lang);
static void boxes_unattended_installer_real_prepare_to_continue_installation (BoxesInstallerMedia* base,
                                                                       const gchar* vm_name);
static OsinfoInstallScriptInjectionMethod boxes_unattended_installer_get_injection_method (BoxesUnattendedInstaller* self);
VALA_EXTERN gchar* boxes_unattended_installer_get_user_unattended (BoxesUnattendedInstaller* self,
                                                       const gchar* suffix);
static void boxes_unattended_installer_real_prepare_for_installation_data_free (gpointer _data);
static void boxes_unattended_installer_real_prepare_for_installation (BoxesInstallerMedia* base,
                                                               const gchar* vm_name,
                                                               GCancellable* cancellable,
                                                               GAsyncReadyCallback _callback_,
                                                               gpointer _user_data_);
static gboolean boxes_unattended_installer_real_prepare_for_installation_co (BoxesUnattendedInstallerPrepareForInstallationData* _data_);
static void boxes_unattended_installer_create_iso (BoxesUnattendedInstaller* self,
                                            GCancellable* cancellable,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
static void boxes_unattended_installer_create_iso_finish (BoxesUnattendedInstaller* self,
                                                   GAsyncResult* _res_,
                                                   GError** error);
static void boxes_unattended_installer_prepare_for_installation_ready (GObject* source_object,
                                                                GAsyncResult* _res_,
                                                                gpointer _user_data_);
static void boxes_unattended_installer_create_disk_image (BoxesUnattendedInstaller* self,
                                                   GCancellable* cancellable,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_);
static void boxes_unattended_installer_create_disk_image_finish (BoxesUnattendedInstaller* self,
                                                          GAsyncResult* _res_,
                                                          GError** error);
VALA_EXTERN GType boxes_iso_extractor_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesISOExtractor, g_object_unref)
VALA_EXTERN BoxesISOExtractor* boxes_iso_extractor_new (const gchar* iso_path);
VALA_EXTERN BoxesISOExtractor* boxes_iso_extractor_construct (GType object_type,
                                                  const gchar* iso_path);
static void boxes_unattended_installer_extract_boot_files (BoxesUnattendedInstaller* self,
                                                    BoxesISOExtractor* extractor,
                                                    GCancellable* cancellable,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_);
static void boxes_unattended_installer_extract_boot_files_finish (BoxesUnattendedInstaller* self,
                                                           GAsyncResult* _res_,
                                                           GError** error);
VALA_EXTERN void boxes_unattended_file_copy (BoxesUnattendedFile* self,
                                 GCancellable* cancellable,
                                 GAsyncReadyCallback _callback_,
                                 gpointer _user_data_);
VALA_EXTERN void boxes_unattended_file_copy_finish (BoxesUnattendedFile* self,
                                        GAsyncResult* _res_,
                                        GError** error);
VALA_EXTERN GType boxes_app_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesApp, g_object_unref)
VALA_EXTERN GType boxes_app_window_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesAppWindow, g_object_unref)
VALA_EXTERN BoxesAppWindow* boxes_app_get_main_window (BoxesApp* self);
VALA_EXTERN GType boxes_toast_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesToast, g_object_unref)
VALA_EXTERN void boxes_app_window_display_toast (BoxesAppWindow* self,
                                     BoxesToast* toast);
VALA_EXTERN BoxesToast* boxes_toast_new (const gchar* message);
VALA_EXTERN BoxesToast* boxes_toast_construct (GType object_type,
                                   const gchar* message);
static void boxes_unattended_installer_real_setup_domain_config (BoxesInstallerMedia* base,
                                                          GVirConfigDomain* domain);
static GVirConfigDomainDisk* boxes_unattended_installer_get_unattended_disk_config (BoxesUnattendedInstaller* self);
VALA_EXTERN void boxes_unattended_installer_configure_install_script (BoxesUnattendedInstaller* self,
                                                          OsinfoInstallScript* script);
static void boxes_unattended_installer_real_setup_post_install_domain_config (BoxesInstallerMedia* base,
                                                                       GVirConfigDomain* domain);
static void boxes_unattended_installer_remove_disk_from_domain_config (BoxesUnattendedInstaller* self,
                                                                GVirConfigDomain* domain,
                                                                const gchar* disk_path);
static void boxes_unattended_installer_real_set_direct_boot_params (BoxesInstallerMedia* base,
                                                             GVirConfigDomainOs* domain_os);
static void boxes_unattended_installer_real_clean_up (BoxesInstallerMedia* base);
static void boxes_unattended_installer_real_clean_up_preparation_cache (BoxesInstallerMedia* base);
static void boxes_unattended_installer_real_prepare_data_free (gpointer _data);
static void boxes_unattended_installer_real_prepare (BoxesInstallerMedia* base,
                                              BoxesActivityProgress* progress,
                                              GCancellable* cancellable,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_);
static gboolean boxes_unattended_installer_real_prepare_co (BoxesUnattendedInstallerPrepareData* _data_);
static void boxes_unattended_installer_setup_drivers (BoxesUnattendedInstaller* self,
                                               BoxesActivityProgress* progress,
                                               GCancellable* cancellable,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_);
static gboolean boxes_unattended_installer_setup_drivers_finish (BoxesUnattendedInstaller* self,
                                                          GAsyncResult* _res_);
static void boxes_unattended_installer_prepare_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_);
VALA_EXTERN gboolean boxes_installer_media_get_prefers_q35 (BoxesInstallerMedia* self);
VALA_EXTERN gboolean boxes_installer_media_get_supports_virtio_disk (BoxesInstallerMedia* self);
VALA_EXTERN gboolean boxes_installer_media_get_supports_virtio1_disk (BoxesInstallerMedia* self);
static void boxes_unattended_installer_add_secondary_unattended_file (BoxesUnattendedInstaller* self,
                                                               BoxesUnattendedFile* file);
static void boxes_unattended_installer_create_disk_image_data_free (gpointer _data);
static gboolean boxes_unattended_installer_create_disk_image_co (BoxesUnattendedInstallerCreateDiskImageData* _data_);
static void boxes_unattended_installer_create_disk_image_ready (GObject* source_object,
                                                         GAsyncResult* _res_,
                                                         gpointer _user_data_);
static void boxes_unattended_installer_create_iso_data_free (gpointer _data);
static gboolean boxes_unattended_installer_create_iso_co (BoxesUnattendedInstallerCreateIsoData* _data_);
VALA_EXTERN void boxes_unattended_file_get_source_file (BoxesUnattendedFile* self,
                                            GCancellable* cancellable,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
VALA_EXTERN GFile* boxes_unattended_file_get_source_file_finish (BoxesUnattendedFile* self,
                                                     GAsyncResult* _res_,
                                                     GError** error);
static void boxes_unattended_installer_create_iso_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_);
VALA_EXTERN const gchar* boxes_unattended_file_get_dest_name (BoxesUnattendedFile* self);
static void _vala_array_add8 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void _vala_array_add9 (gchar** * array,
                       gint* length,
                       gint* size,
                       gchar* value);
static void boxes_unattended_installer_extract_boot_files_data_free (gpointer _data);
static gboolean boxes_unattended_installer_extract_boot_files_co (BoxesUnattendedInstallerExtractBootFilesData* _data_);
VALA_EXTERN void boxes_iso_extractor_extract (BoxesISOExtractor* self,
                                  const gchar* path,
                                  const gchar* output_path,
                                  GCancellable* cancellable,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_);
VALA_EXTERN void boxes_iso_extractor_extract_finish (BoxesISOExtractor* self,
                                         GAsyncResult* _res_,
                                         GError** error);
static void boxes_unattended_installer_extract_boot_files_ready (GObject* source_object,
                                                          GAsyncResult* _res_,
                                                          gpointer _user_data_);
VALA_EXTERN gchar* boxes_unattended_installer_get_product_key_format (BoxesUnattendedInstaller* self);
static void boxes_unattended_installer_setup_drivers_data_free (gpointer _data);
static gboolean boxes_unattended_installer_setup_drivers_co (BoxesUnattendedInstallerSetupDriversData* _data_);
static GList* boxes_unattended_installer_get_pre_installer_scripts (BoxesUnattendedInstaller* self);
static GList* boxes_unattended_installer_get_pre_installable_drivers (BoxesUnattendedInstaller* self,
                                                               GList* preinst_scripts);
static void boxes_unattended_installer_setup_drivers_from_list (BoxesUnattendedInstaller* self,
                                                         GList* drivers,
                                                         BoxesActivityProgress* progress,
                                                         BoxesUnattendedInstallerAddUnattendedFileFunc add_func,
                                                         gpointer add_func_target,
                                                         GCancellable* cancellable,
                                                         GAsyncReadyCallback _callback_,
                                                         gpointer _user_data_);
static gboolean boxes_unattended_installer_setup_drivers_from_list_finish (BoxesUnattendedInstaller* self,
                                                                    GAsyncResult* _res_);
static void _boxes_unattended_installer_add_unattended_file_boxes_unattended_installer_add_unattended_file_func (BoxesUnattendedFile* file,
                                                                                                          gpointer self);
static void boxes_unattended_installer_setup_drivers_ready (GObject* source_object,
                                                     GAsyncResult* _res_,
                                                     gpointer _user_data_);
static GList* boxes_unattended_installer_get_post_installer_scripts (BoxesUnattendedInstaller* self);
static GList* boxes_unattended_installer_get_post_installable_drivers (BoxesUnattendedInstaller* self,
                                                                GList* postinst_scripts);
static void _boxes_unattended_installer_add_secondary_unattended_file_boxes_unattended_installer_add_unattended_file_func (BoxesUnattendedFile* file,
                                                                                                                    gpointer self);
static void boxes_unattended_installer_setup_drivers_from_list_data_free (gpointer _data);
static gboolean boxes_unattended_installer_setup_drivers_from_list_co (BoxesUnattendedInstallerSetupDriversFromListData* _data_);
static void boxes_unattended_installer_setup_driver (BoxesUnattendedInstaller* self,
                                              OsinfoDeviceDriver* driver,
                                              BoxesActivityProgress* progress,
                                              BoxesUnattendedInstallerAddUnattendedFileFunc add_func,
                                              gpointer add_func_target,
                                              GCancellable* cancellable,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_);
static void boxes_unattended_installer_setup_driver_finish (BoxesUnattendedInstaller* self,
                                                     GAsyncResult* _res_,
                                                     GError** error);
static void boxes_unattended_installer_setup_drivers_from_list_ready (GObject* source_object,
                                                               GAsyncResult* _res_,
                                                               gpointer _user_data_);
static void boxes_unattended_installer_setup_driver_data_free (gpointer _data);
static gboolean boxes_unattended_installer_setup_driver_co (BoxesUnattendedInstallerSetupDriverData* _data_);
VALA_EXTERN GType boxes_downloader_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesDownloader, g_object_unref)
VALA_EXTERN BoxesDownloader* boxes_downloader_get_default (void);
static void _vala_array_add10 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
VALA_EXTERN void boxes_downloader_download (BoxesDownloader* self,
                                GFile* remote_file,
                                gchar** cached_paths,
                                gint cached_paths_length1,
                                BoxesActivityProgress* progress,
                                GCancellable* cancellable,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_);
VALA_EXTERN GFile* boxes_downloader_download_finish (BoxesDownloader* self,
                                         GAsyncResult* _res_,
                                         GError** error);
static void boxes_unattended_installer_setup_driver_ready (GObject* source_object,
                                                    GAsyncResult* _res_,
                                                    gpointer _user_data_);
VALA_EXTERN BoxesUnattendedRawFile* boxes_unattended_raw_file_new (BoxesUnattendedInstaller* installer,
                                                       const gchar* src_path,
                                                       const gchar* dest_name);
VALA_EXTERN BoxesUnattendedRawFile* boxes_unattended_raw_file_construct (GType object_type,
                                                             BoxesUnattendedInstaller* installer,
                                                             const gchar* src_path,
                                                             const gchar* dest_name);
VALA_EXTERN GType boxes_unattended_raw_file_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesUnattendedRawFile, g_object_unref)
static GList* boxes_unattended_installer_get_installable_drivers (BoxesUnattendedInstaller* self,
                                                           GList* scripts,
                                                           BoxesUnattendedInstallerDriverInstallableFunc installable_func,
                                                           gpointer installable_func_target,
                                                           BoxesUnattendedInstallerScriptDriverSigningReqFunc signing_req_func,
                                                           gpointer signing_req_func_target);
static gboolean __lambda33_ (BoxesUnattendedInstaller* self,
                      OsinfoDeviceDriver* driver);
static gboolean ___lambda33__boxes_unattended_installer_driver_installable_func (OsinfoDeviceDriver* driver,
                                                                          gpointer self);
static OsinfoDeviceDriverSigningReq __lambda34_ (BoxesUnattendedInstaller* self,
                                          OsinfoInstallScript* script);
static OsinfoDeviceDriverSigningReq ___lambda34__boxes_unattended_installer_script_driver_signing_req_func (OsinfoInstallScript* script,
                                                                                                     gpointer self);
static gboolean __lambda36_ (BoxesUnattendedInstaller* self,
                      OsinfoDeviceDriver* driver);
static gboolean ___lambda36__boxes_unattended_installer_driver_installable_func (OsinfoDeviceDriver* driver,
                                                                          gpointer self);
static OsinfoDeviceDriverSigningReq __lambda37_ (BoxesUnattendedInstaller* self,
                                          OsinfoInstallScript* script);
static OsinfoDeviceDriverSigningReq ___lambda37__boxes_unattended_installer_script_driver_signing_req_func (OsinfoInstallScript* script,
                                                                                                     gpointer self);
static Block49Data* block49_data_ref (Block49Data* _data49_);
static void block49_data_unref (void * _userdata_);
static GList* boxes_unattended_installer_get_drivers (BoxesUnattendedInstaller* self,
                                               BoxesUnattendedInstallerDriverTestFunction test_func,
                                               gpointer test_func_target);
static gboolean __lambda32_ (Block49Data* _data49_,
                      OsinfoDeviceDriver* driver);
static gboolean ___lambda32__boxes_unattended_installer_driver_test_function (OsinfoDeviceDriver* driver,
                                                                       gpointer self);
static void _g_free0_ (gpointer var);
VALA_EXTERN GType boxes_cpu_arch_compatibility_get_type (void) G_GNUC_CONST ;
VALA_EXTERN BoxesCPUArchCompatibility boxes_compare_cpu_architectures (const gchar* arch1,
                                                           const gchar* arch2);
static GList* boxes_unattended_installer_get_scripts (BoxesUnattendedInstaller* self,
                                               BoxesUnattendedInstallerScriptTestFunction test_func,
                                               gpointer test_func_target);
static gboolean __lambda31_ (BoxesUnattendedInstaller* self,
                      OsinfoInstallScript* script);
static gboolean ___lambda31__boxes_unattended_installer_script_test_function (OsinfoInstallScript* script,
                                                                       gpointer self);
static gboolean __lambda35_ (BoxesUnattendedInstaller* self,
                      OsinfoInstallScript* script);
static gboolean ___lambda35__boxes_unattended_installer_script_test_function (OsinfoInstallScript* script,
                                                                       gpointer self);
VALA_EXTERN GType boxes_os_database_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesOSDatabase, g_object_unref)
VALA_EXTERN GType boxes_media_manager_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (BoxesMediaManager, g_object_unref)
VALA_EXTERN BoxesMediaManager* boxes_media_manager_get_default (void);
VALA_EXTERN BoxesOSDatabase* boxes_media_manager_get_os_db (BoxesMediaManager* self);
VALA_EXTERN OsinfoDatamap* boxes_os_database_get_datamap (BoxesOSDatabase* self,
                                              const gchar* id);
static gchar* boxes_unattended_installer_get_preferred_keyboard_from_gsettings (BoxesUnattendedInstaller* self);
static gchar** _vala_array_dup4 (gchar** self,
                          gssize length);
static void _vala_array_add11 (gchar** * array,
                        gint* length,
                        gint* size,
                        gchar* value);
static gboolean _vala_string_array_contains (gchar* * stack,
                                      gssize stack_length,
                                      const gchar* needle);
VALA_EXTERN BoxesUnattendedInstaller* boxes_unattended_installer_new (void);
VALA_EXTERN BoxesUnattendedInstaller* boxes_unattended_installer_construct (GType object_type);
VALA_EXTERN gboolean boxes_unattended_installer_get_needs_password (BoxesUnattendedInstaller* self);
VALA_EXTERN OsinfoInstallScriptInjectionMethod boxes_unattended_script_file_get_injection_method (BoxesUnattendedScriptFile* self);
static void boxes_unattended_installer_finalize (GObject * obj);
static GType boxes_unattended_installer_get_type_once (void);
static void _vala_boxes_unattended_installer_get_property (GObject * object,
                                                    guint property_id,
                                                    GValue * value,
                                                    GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);

static inline gpointer
boxes_unattended_installer_get_instance_private (BoxesUnattendedInstaller* self)
{
	return G_STRUCT_MEMBER_P (self, BoxesUnattendedInstaller_private_offset);
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

static gchar*
string_replace (const gchar* self,
                const gchar* old,
                const gchar* replacement)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (old != NULL, NULL);
	g_return_val_if_fail (replacement != NULL, NULL);
	if ((*((gchar*) self)) == '\0') {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = (*((gchar*) old)) == '\0';
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = g_strcmp0 (old, replacement) == 0;
	}
	if (_tmp0_) {
		gchar* _tmp2_;
		_tmp2_ = g_strdup (self);
		result = _tmp2_;
		return result;
	}
	{
		GRegex* regex = NULL;
		gchar* _tmp3_;
		gchar* _tmp4_;
		GRegex* _tmp5_;
		GRegex* _tmp6_;
		gchar* _tmp7_ = NULL;
		GRegex* _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		_tmp3_ = g_regex_escape_string (old, -1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		regex = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp8_ = regex;
		_tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
		_tmp7_ = _tmp9_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_regex_unref0 (regex);
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp10_ = _tmp7_;
		_tmp7_ = NULL;
		result = _tmp10_;
		_g_free0 (_tmp7_);
		_g_regex_unref0 (regex);
		return result;
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return NULL;
}

static gchar*
boxes_unattended_installer_escape_genisoimage_path (const gchar* path)
{
	gchar* str = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* result;
	g_return_val_if_fail (path != NULL, NULL);
	_tmp0_ = string_replace (path, "\\", "\\\\");
	str = _tmp0_;
	_tmp1_ = string_replace (str, "=", "\\=");
	result = _tmp1_;
	_g_free0 (str);
	return result;
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

BoxesUnattendedInstaller*
boxes_unattended_installer_construct_from_media (GType object_type,
                                                 BoxesInstallerMedia* media,
                                                 OsinfoInstallScriptList* scripts,
                                                 GError** error)
{
	BoxesUnattendedInstaller * self = NULL;
	OsinfoOs* _tmp0_;
	OsinfoOs* _tmp1_;
	OsinfoMedia* _tmp2_;
	OsinfoMedia* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	OsinfoResources* _tmp10_;
	OsinfoResources* _tmp11_;
	OsinfoInstallScriptList* _tmp12_;
	OsinfoInstallConfig* _tmp13_;
	gboolean needs_internet = FALSE;
	GList* _tmp14_;
	OsinfoDeviceList* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	const gchar* _tmp29_;
	gchar* _tmp30_;
	GError* _inner_error0_ = NULL;
	g_return_val_if_fail (media != NULL, NULL);
	g_return_val_if_fail (scripts != NULL, NULL);
	self = (BoxesUnattendedInstaller*) boxes_installer_media_construct (object_type);
	_tmp0_ = media->os;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (((BoxesInstallerMedia*) self)->os);
	((BoxesInstallerMedia*) self)->os = _tmp1_;
	_tmp2_ = media->os_media;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	_g_object_unref0 (((BoxesInstallerMedia*) self)->os_media);
	((BoxesInstallerMedia*) self)->os_media = _tmp3_;
	_tmp4_ = media->label;
	_tmp5_ = g_strdup (_tmp4_);
	_g_free0 (((BoxesInstallerMedia*) self)->label);
	((BoxesInstallerMedia*) self)->label = _tmp5_;
	_tmp6_ = media->device_file;
	_tmp7_ = g_strdup (_tmp6_);
	_g_free0 (((BoxesInstallerMedia*) self)->device_file);
	((BoxesInstallerMedia*) self)->device_file = _tmp7_;
	((BoxesInstallerMedia*) self)->from_image = media->from_image;
	_tmp8_ = media->mount_point;
	_tmp9_ = g_strdup (_tmp8_);
	_g_free0 (((BoxesInstallerMedia*) self)->mount_point);
	((BoxesInstallerMedia*) self)->mount_point = _tmp9_;
	_tmp10_ = media->resources;
	_tmp11_ = _g_object_ref0 (_tmp10_);
	_g_object_unref0 (((BoxesInstallerMedia*) self)->resources);
	((BoxesInstallerMedia*) self)->resources = _tmp11_;
	_tmp12_ = _g_object_ref0 (scripts);
	_g_object_unref0 (self->scripts);
	self->scripts = _tmp12_;
	_tmp13_ = osinfo_install_config_new ("https://wiki.gnome.org/Boxes/unattended");
	_g_object_unref0 (self->config);
	self->config = _tmp13_;
	(self->priv->unattended_files == NULL) ? NULL : (self->priv->unattended_files = (_g_list_free__g_object_unref0_ (self->priv->unattended_files), NULL));
	self->priv->unattended_files = NULL;
	(self->priv->secondary_unattended_files == NULL) ? NULL : (self->priv->secondary_unattended_files = (_g_list_free__g_object_unref0_ (self->priv->secondary_unattended_files), NULL));
	self->priv->secondary_unattended_files = NULL;
	needs_internet = FALSE;
	_tmp14_ = osinfo_list_get_elements ((OsinfoList*) scripts);
	{
		GList* s_collection = NULL;
		GList* s_it = NULL;
		s_collection = _tmp14_;
		for (s_it = s_collection; s_it != NULL; s_it = s_it->next) {
			OsinfoEntity* s = NULL;
			s = (OsinfoEntity*) s_it->data;
			{
				OsinfoInstallScript* script = NULL;
				OsinfoEntity* _tmp15_;
				OsinfoInstallScript* _tmp16_;
				gchar* filename = NULL;
				OsinfoInstallScript* _tmp17_;
				const gchar* _tmp18_;
				gchar* _tmp19_;
				BoxesUnattendedScriptFile* _tmp20_ = NULL;
				OsinfoInstallScript* _tmp21_;
				const gchar* _tmp22_;
				BoxesUnattendedScriptFile* _tmp23_;
				gboolean _tmp24_ = FALSE;
				_tmp15_ = s;
				_tmp16_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp15_, osinfo_install_script_get_type ()) ? ((OsinfoInstallScript*) _tmp15_) : NULL);
				script = _tmp16_;
				_tmp17_ = script;
				_tmp18_ = osinfo_install_script_get_expected_filename (_tmp17_);
				_tmp19_ = g_strdup (_tmp18_);
				filename = _tmp19_;
				_tmp21_ = script;
				_tmp22_ = filename;
				_tmp23_ = boxes_unattended_script_file_new (self, _tmp21_, _tmp22_, &_inner_error0_);
				_tmp20_ = _tmp23_;
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					g_propagate_error (error, _inner_error0_);
					_g_free0 (filename);
					_g_object_unref0 (script);
					(s_collection == NULL) ? NULL : (s_collection = (g_list_free (s_collection), NULL));
					_g_object_unref0 (self);
					return NULL;
				}
				boxes_unattended_installer_add_unattended_file (self, (BoxesUnattendedFile*) _tmp20_);
				if (needs_internet) {
					_tmp24_ = TRUE;
				} else {
					OsinfoInstallScript* _tmp25_;
					_tmp25_ = script;
					_tmp24_ = osinfo_install_script_get_needs_internet (_tmp25_);
				}
				needs_internet = _tmp24_;
				_g_object_unref0 (_tmp20_);
				_g_free0 (filename);
				_g_object_unref0 (script);
			}
		}
		(s_collection == NULL) ? NULL : (s_collection = (g_list_free (s_collection), NULL));
	}
	_tmp26_ = osinfo_devicelist_new ();
	_g_object_unref0 (self->priv->additional_devices);
	self->priv->additional_devices = _tmp26_;
	_tmp27_ = boxes_get_timezone ();
	_g_free0 (self->priv->timezone);
	self->priv->timezone = _tmp27_;
	_tmp28_ = boxes_unattended_installer_get_preferred_language (self);
	_g_free0 (self->priv->lang);
	self->priv->lang = _tmp28_;
	_tmp29_ = self->priv->lang;
	_tmp30_ = boxes_unattended_installer_get_preferred_keyboard (self, _tmp29_);
	_g_free0 (self->priv->kbd);
	self->priv->kbd = _tmp30_;
	return self;
}

BoxesUnattendedInstaller*
boxes_unattended_installer_new_from_media (BoxesInstallerMedia* media,
                                           OsinfoInstallScriptList* scripts,
                                           GError** error)
{
	return boxes_unattended_installer_construct_from_media (BOXES_TYPE_UNATTENDED_INSTALLER, media, scripts, error);
}

static void
boxes_unattended_installer_real_prepare_to_continue_installation (BoxesInstallerMedia* base,
                                                                  const gchar* vm_name)
{
	BoxesUnattendedInstaller * self;
	gchar* _tmp0_;
	gchar* unattended = NULL;
	gchar* _tmp1_;
	OsinfoInstallScriptInjectionMethod _tmp2_;
	OsinfoInstallScriptInjectionMethod _tmp3_;
	gchar* path = NULL;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	const gchar* _tmp7_;
	GFile* _tmp8_;
	gboolean _tmp9_ = FALSE;
	OsinfoMedia* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gboolean _tmp14_;
	self = (BoxesUnattendedInstaller*) base;
	g_return_if_fail (vm_name != NULL);
	_tmp0_ = boxes_replace_regex (vm_name, "[{|}~[\\]^':; <=>?@!\"#$%`()+/.,*&]", "");
	_g_free0 (self->priv->hostname);
	self->priv->hostname = _tmp0_;
	_tmp1_ = g_strdup ("unattended.img");
	unattended = _tmp1_;
	_tmp2_ = boxes_unattended_installer_get_injection_method (self);
	_tmp3_ = _tmp2_;
	if (_tmp3_ == OSINFO_INSTALL_SCRIPT_INJECTION_METHOD_CDROM) {
		gchar* _tmp4_;
		_tmp4_ = g_strdup ("unattended.iso");
		_g_free0 (unattended);
		unattended = _tmp4_;
	}
	_tmp5_ = unattended;
	_tmp6_ = boxes_unattended_installer_get_user_unattended (self, _tmp5_);
	path = _tmp6_;
	_tmp7_ = path;
	_tmp8_ = g_file_new_for_path (_tmp7_);
	_g_object_unref0 (self->disk_file);
	self->disk_file = _tmp8_;
	_tmp10_ = ((BoxesInstallerMedia*) self)->os_media;
	g_object_get (_tmp10_, "kernel-path", &_tmp11_, NULL);
	_tmp12_ = _tmp11_;
	_tmp13_ = _tmp12_;
	_tmp14_ = _tmp13_ != NULL;
	_g_free0 (_tmp13_);
	if (_tmp14_) {
		OsinfoMedia* _tmp15_;
		gchar* _tmp16_;
		gchar* _tmp17_;
		gchar* _tmp18_;
		_tmp15_ = ((BoxesInstallerMedia*) self)->os_media;
		g_object_get (_tmp15_, "initrd-path", &_tmp16_, NULL);
		_tmp17_ = _tmp16_;
		_tmp18_ = _tmp17_;
		_tmp9_ = _tmp18_ != NULL;
		_g_free0 (_tmp18_);
	} else {
		_tmp9_ = FALSE;
	}
	if (_tmp9_) {
		gchar* _tmp19_;
		const gchar* _tmp20_;
		GFile* _tmp21_;
		gchar* _tmp22_;
		const gchar* _tmp23_;
		GFile* _tmp24_;
		_tmp19_ = boxes_unattended_installer_get_user_unattended (self, "kernel");
		_g_free0 (path);
		path = _tmp19_;
		_tmp20_ = path;
		_tmp21_ = g_file_new_for_path (_tmp20_);
		_g_object_unref0 (self->kernel_file);
		self->kernel_file = _tmp21_;
		_tmp22_ = boxes_unattended_installer_get_user_unattended (self, "initrd");
		_g_free0 (path);
		path = _tmp22_;
		_tmp23_ = path;
		_tmp24_ = g_file_new_for_path (_tmp23_);
		_g_object_unref0 (self->initrd_file);
		self->initrd_file = _tmp24_;
	}
	_g_free0 (path);
	_g_free0 (unattended);
}

static void
boxes_unattended_installer_real_prepare_for_installation_data_free (gpointer _data)
{
	BoxesUnattendedInstallerPrepareForInstallationData* _data_;
	_data_ = _data;
	_g_free0 (_data_->vm_name);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (BoxesUnattendedInstallerPrepareForInstallationData, _data_);
}

static void
boxes_unattended_installer_real_prepare_for_installation (BoxesInstallerMedia* base,
                                                          const gchar* vm_name,
                                                          GCancellable* cancellable,
                                                          GAsyncReadyCallback _callback_,
                                                          gpointer _user_data_)
{
	BoxesUnattendedInstaller * self;
	BoxesUnattendedInstallerPrepareForInstallationData* _data_;
	BoxesUnattendedInstaller* _tmp0_;
	gchar* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (vm_name != NULL);
	self = (BoxesUnattendedInstaller*) base;
	_data_ = g_slice_new0 (BoxesUnattendedInstallerPrepareForInstallationData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_unattended_installer_real_prepare_for_installation_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (vm_name);
	_g_free0 (_data_->vm_name);
	_data_->vm_name = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	boxes_unattended_installer_real_prepare_for_installation_co (_data_);
}

static void
boxes_unattended_installer_prepare_for_installation_finish (BoxesInstallerMedia* base,
                                                            GAsyncResult* _res_)
{
	BoxesUnattendedInstallerPrepareForInstallationData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	if (NULL == _data_) {
		return;
	}
}

static void
boxes_unattended_installer_prepare_for_installation_ready (GObject* source_object,
                                                           GAsyncResult* _res_,
                                                           gpointer _user_data_)
{
	BoxesUnattendedInstallerPrepareForInstallationData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	boxes_unattended_installer_real_prepare_for_installation_co (_data_);
}

static gboolean
boxes_unattended_installer_real_prepare_for_installation_co (BoxesUnattendedInstallerPrepareForInstallationData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	boxes_installer_media_prepare_to_continue_installation ((BoxesInstallerMedia*) _data_->self, _data_->vm_name);
	{
		_data_->_tmp0_ = boxes_unattended_installer_get_injection_method (_data_->self);
		_data_->_tmp1_ = _data_->_tmp0_;
		if (_data_->_tmp1_ == OSINFO_INSTALL_SCRIPT_INJECTION_METHOD_CDROM) {
			_data_->_state_ = 1;
			boxes_unattended_installer_create_iso (_data_->self, _data_->cancellable, boxes_unattended_installer_prepare_for_installation_ready, _data_);
			return FALSE;
			_state_1:
			boxes_unattended_installer_create_iso_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		} else {
			_data_->_state_ = 2;
			boxes_unattended_installer_create_disk_image (_data_->self, _data_->cancellable, boxes_unattended_installer_prepare_for_installation_ready, _data_);
			return FALSE;
			_state_2:
			boxes_unattended_installer_create_disk_image_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		}
		_data_->_tmp3_ = ((BoxesInstallerMedia*) _data_->self)->os_media;
		g_object_get (_data_->_tmp3_, "kernel-path", &_data_->_tmp4_, NULL);
		_data_->_tmp5_ = _data_->_tmp4_;
		_data_->_tmp6_ = _data_->_tmp5_;
		_data_->_tmp7_ = _data_->_tmp6_ != NULL;
		_g_free0 (_data_->_tmp6_);
		if (_data_->_tmp7_) {
			_data_->_tmp8_ = ((BoxesInstallerMedia*) _data_->self)->os_media;
			g_object_get (_data_->_tmp8_, "initrd-path", &_data_->_tmp9_, NULL);
			_data_->_tmp10_ = _data_->_tmp9_;
			_data_->_tmp11_ = _data_->_tmp10_;
			_data_->_tmp2_ = _data_->_tmp11_ != NULL;
			_g_free0 (_data_->_tmp11_);
		} else {
			_data_->_tmp2_ = FALSE;
		}
		if (_data_->_tmp2_) {
			_data_->_tmp12_ = ((BoxesInstallerMedia*) _data_->self)->device_file;
			_data_->_tmp13_ = boxes_iso_extractor_new (_data_->_tmp12_);
			_data_->extractor = _data_->_tmp13_;
			_data_->_tmp14_ = _data_->extractor;
			_data_->_state_ = 3;
			boxes_unattended_installer_extract_boot_files (_data_->self, _data_->_tmp14_, _data_->cancellable, boxes_unattended_installer_prepare_for_installation_ready, _data_);
			return FALSE;
			_state_3:
			boxes_unattended_installer_extract_boot_files_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_g_object_unref0 (_data_->extractor);
				goto __catch0_g_error;
			}
			_g_object_unref0 (_data_->extractor);
		}
		_data_->_tmp15_ = boxes_unattended_installer_get_injection_method (_data_->self);
		_data_->_tmp16_ = _data_->_tmp15_;
		if (_data_->_tmp16_ != OSINFO_INSTALL_SCRIPT_INJECTION_METHOD_CDROM) {
			_data_->_tmp17_ = _data_->self->priv->unattended_files;
			{
				_data_->unattended_file_collection = _data_->_tmp17_;
				for (_data_->unattended_file_it = _data_->unattended_file_collection; _data_->unattended_file_it != NULL; _data_->unattended_file_it = _data_->unattended_file_it->next) {
					_data_->_tmp18_ = _g_object_ref0 ((BoxesUnattendedFile*) _data_->unattended_file_it->data);
					_data_->unattended_file = _data_->_tmp18_;
					{
						_data_->_tmp19_ = _data_->unattended_file;
						_data_->_state_ = 4;
						boxes_unattended_file_copy (_data_->_tmp19_, _data_->cancellable, boxes_unattended_installer_prepare_for_installation_ready, _data_);
						return FALSE;
						_state_4:
						boxes_unattended_file_copy_finish (_data_->_tmp19_, _data_->_res_, &_data_->_inner_error0_);
						if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
							_g_object_unref0 (_data_->unattended_file);
							goto __catch0_g_error;
						}
						_g_object_unref0 (_data_->unattended_file);
					}
				}
			}
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->_error_ = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		boxes_installer_media_clean_up ((BoxesInstallerMedia*) _data_->self);
		_data_->_tmp20_ = g_strdup (_ ("An error occurred during installation preparation. Express Install dis" \
"abled."));
		_data_->msg = _data_->_tmp20_;
		_data_->_tmp21_ = boxes_app_app;
		_data_->_tmp22_ = boxes_app_get_main_window (_data_->_tmp21_);
		_data_->_tmp23_ = _data_->_tmp22_;
		_data_->_tmp24_ = _data_->msg;
		_data_->_tmp25_ = boxes_toast_new (_data_->_tmp24_);
		g_object_ref_sink (_data_->_tmp25_);
		_data_->_tmp26_ = _data_->_tmp25_;
		boxes_app_window_display_toast (_data_->_tmp23_, _data_->_tmp26_);
		_g_object_unref0 (_data_->_tmp26_);
		_data_->_tmp27_ = _data_->_error_;
		_data_->_tmp28_ = _data_->_tmp27_->message;
		g_debug ("unattended-installer.vala:176: Disabling unattended installation: %s", _data_->_tmp28_);
		_g_free0 (_data_->msg);
		_g_error_free0 (_data_->_error_);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
boxes_unattended_installer_real_setup_domain_config (BoxesInstallerMedia* base,
                                                     GVirConfigDomain* domain)
{
	BoxesUnattendedInstaller * self;
	GFile* _tmp0_;
	GVirConfigDomainDisk* disk = NULL;
	GVirConfigDomainDisk* _tmp1_;
	self = (BoxesUnattendedInstaller*) base;
	g_return_if_fail (domain != NULL);
	BOXES_INSTALLER_MEDIA_CLASS (boxes_unattended_installer_parent_class)->setup_domain_config (G_TYPE_CHECK_INSTANCE_CAST (self, BOXES_TYPE_INSTALLER_MEDIA, BoxesInstallerMedia), domain);
	_tmp0_ = self->disk_file;
	g_return_if_fail (_tmp0_ != NULL);
	_tmp1_ = boxes_unattended_installer_get_unattended_disk_config (self);
	disk = _tmp1_;
	gvir_config_domain_add_device (domain, (GVirConfigDomainDevice*) disk);
	_g_object_unref0 (disk);
}

void
boxes_unattended_installer_configure_install_script (BoxesUnattendedInstaller* self,
                                                     OsinfoInstallScript* script)
{
	const gchar* _tmp0_;
	const gchar* _tmp5_;
	const gchar* _tmp10_;
	const gchar* _tmp13_;
	OsinfoInstallConfig* _tmp16_;
	const gchar* _tmp17_;
	OsinfoInstallConfig* _tmp18_;
	const gchar* _tmp19_;
	OsinfoInstallConfig* _tmp20_;
	const gchar* _tmp21_;
	OsinfoInstallConfig* _tmp22_;
	OsinfoMedia* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	OsinfoInstallScriptInjectionMethod _tmp27_;
	OsinfoInstallScriptInjectionMethod _tmp28_;
	OsinfoInstallConfig* _tmp29_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (script != NULL);
	_tmp0_ = self->password;
	if (_tmp0_ != NULL) {
		OsinfoInstallConfig* _tmp1_;
		const gchar* _tmp2_;
		OsinfoInstallConfig* _tmp3_;
		const gchar* _tmp4_;
		_tmp1_ = self->config;
		_tmp2_ = self->password;
		osinfo_install_config_set_user_password (_tmp1_, _tmp2_);
		_tmp3_ = self->config;
		_tmp4_ = self->password;
		osinfo_install_config_set_admin_password (_tmp3_, _tmp4_);
	}
	_tmp5_ = self->username;
	if (_tmp5_ != NULL) {
		OsinfoInstallConfig* _tmp6_;
		const gchar* _tmp7_;
		OsinfoInstallConfig* _tmp8_;
		const gchar* _tmp9_;
		_tmp6_ = self->config;
		_tmp7_ = self->username;
		osinfo_install_config_set_user_login (_tmp6_, _tmp7_);
		_tmp8_ = self->config;
		_tmp9_ = self->username;
		osinfo_install_config_set_user_realname (_tmp8_, _tmp9_);
	}
	_tmp10_ = self->product_key;
	if (_tmp10_ != NULL) {
		OsinfoInstallConfig* _tmp11_;
		const gchar* _tmp12_;
		_tmp11_ = self->config;
		_tmp12_ = self->product_key;
		osinfo_install_config_set_reg_product_key (_tmp11_, _tmp12_);
	}
	_tmp13_ = self->priv->timezone;
	if (_tmp13_ != NULL) {
		OsinfoInstallConfig* _tmp14_;
		const gchar* _tmp15_;
		_tmp14_ = self->config;
		_tmp15_ = self->priv->timezone;
		osinfo_install_config_set_l10n_timezone (_tmp14_, _tmp15_);
	}
	_tmp16_ = self->config;
	_tmp17_ = self->priv->lang;
	osinfo_install_config_set_l10n_language (_tmp16_, _tmp17_);
	_tmp18_ = self->config;
	_tmp19_ = self->priv->kbd;
	osinfo_install_config_set_l10n_keyboard (_tmp18_, _tmp19_);
	_tmp20_ = self->config;
	_tmp21_ = self->priv->hostname;
	osinfo_install_config_set_hostname (_tmp20_, _tmp21_);
	_tmp22_ = self->config;
	_tmp23_ = ((BoxesInstallerMedia*) self)->os_media;
	g_object_get (_tmp23_, "architecture", &_tmp24_, NULL);
	_tmp25_ = _tmp24_;
	_tmp26_ = _tmp25_;
	osinfo_install_config_set_hardware_arch (_tmp22_, _tmp26_);
	_g_free0 (_tmp26_);
	_tmp27_ = boxes_unattended_installer_get_injection_method (self);
	_tmp28_ = _tmp27_;
	osinfo_install_script_set_preferred_injection_method (script, _tmp28_);
	_tmp29_ = self->config;
	osinfo_install_config_set_driver_signing (_tmp29_, self->priv->driver_signing);
}

static void
boxes_unattended_installer_real_setup_post_install_domain_config (BoxesInstallerMedia* base,
                                                                  GVirConfigDomain* domain)
{
	BoxesUnattendedInstaller * self;
	GFile* _tmp0_;
	self = (BoxesUnattendedInstaller*) base;
	g_return_if_fail (domain != NULL);
	_tmp0_ = self->disk_file;
	if (_tmp0_ != NULL) {
		gchar* path = NULL;
		GFile* _tmp1_;
		gchar* _tmp2_;
		const gchar* _tmp3_;
		_tmp1_ = self->disk_file;
		_tmp2_ = g_file_get_path (_tmp1_);
		path = _tmp2_;
		_tmp3_ = path;
		boxes_unattended_installer_remove_disk_from_domain_config (self, domain, _tmp3_);
		_g_free0 (path);
	}
	BOXES_INSTALLER_MEDIA_CLASS (boxes_unattended_installer_parent_class)->setup_post_install_domain_config (G_TYPE_CHECK_INSTANCE_CAST (self, BOXES_TYPE_INSTALLER_MEDIA, BoxesInstallerMedia), domain);
}

static void
boxes_unattended_installer_real_set_direct_boot_params (BoxesInstallerMedia* base,
                                                        GVirConfigDomainOs* domain_os)
{
	BoxesUnattendedInstaller * self;
	gboolean _tmp0_ = FALSE;
	GFile* _tmp1_;
	OsinfoInstallScript* script = NULL;
	OsinfoInstallScriptList* _tmp3_;
	OsinfoEntity* _tmp4_;
	OsinfoInstallScript* _tmp5_;
	GFile* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	GFile* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	OsinfoInstallScript* _tmp12_;
	OsinfoMedia* _tmp13_;
	OsinfoInstallConfig* _tmp14_;
	gchar* _tmp15_;
	gchar* _tmp16_;
	self = (BoxesUnattendedInstaller*) base;
	g_return_if_fail (domain_os != NULL);
	_tmp1_ = self->kernel_file;
	if (_tmp1_ == NULL) {
		_tmp0_ = TRUE;
	} else {
		GFile* _tmp2_;
		_tmp2_ = self->initrd_file;
		_tmp0_ = _tmp2_ == NULL;
	}
	if (_tmp0_) {
		return;
	}
	_tmp3_ = self->scripts;
	_tmp4_ = osinfo_list_get_nth ((OsinfoList*) _tmp3_, 0);
	_tmp5_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp4_, osinfo_install_script_get_type ()) ? ((OsinfoInstallScript*) _tmp4_) : NULL);
	script = _tmp5_;
	_tmp6_ = self->kernel_file;
	_tmp7_ = g_file_get_path (_tmp6_);
	_tmp8_ = _tmp7_;
	gvir_config_domain_os_set_kernel (domain_os, _tmp8_);
	_g_free0 (_tmp8_);
	_tmp9_ = self->initrd_file;
	_tmp10_ = g_file_get_path (_tmp9_);
	_tmp11_ = _tmp10_;
	gvir_config_domain_os_set_ramdisk (domain_os, _tmp11_);
	_g_free0 (_tmp11_);
	_tmp12_ = script;
	_tmp13_ = ((BoxesInstallerMedia*) self)->os_media;
	_tmp14_ = self->config;
	_tmp15_ = osinfo_install_script_generate_command_line_for_media (_tmp12_, _tmp13_, _tmp14_);
	_tmp16_ = _tmp15_;
	gvir_config_domain_os_set_cmdline (domain_os, _tmp16_);
	_g_free0 (_tmp16_);
	_g_object_unref0 (script);
}

static void
boxes_unattended_installer_real_clean_up (BoxesInstallerMedia* base)
{
	BoxesUnattendedInstaller * self;
	GError* _inner_error0_ = NULL;
	self = (BoxesUnattendedInstaller*) base;
	BOXES_INSTALLER_MEDIA_CLASS (boxes_unattended_installer_parent_class)->clean_up (G_TYPE_CHECK_INSTANCE_CAST (self, BOXES_TYPE_INSTALLER_MEDIA, BoxesInstallerMedia));
	{
		GFile* _tmp0_;
		GFile* _tmp2_;
		GFile* _tmp4_;
		_tmp0_ = self->disk_file;
		if (_tmp0_ != NULL) {
			GFile* _tmp1_;
			_tmp1_ = self->disk_file;
			boxes_delete_file (_tmp1_, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_g_object_unref0 (self->disk_file);
			self->disk_file = NULL;
		}
		_tmp2_ = self->kernel_file;
		if (_tmp2_ != NULL) {
			GFile* _tmp3_;
			_tmp3_ = self->kernel_file;
			boxes_delete_file (_tmp3_, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_g_object_unref0 (self->kernel_file);
			self->kernel_file = NULL;
		}
		_tmp4_ = self->initrd_file;
		if (_tmp4_ != NULL) {
			GFile* _tmp5_;
			_tmp5_ = self->initrd_file;
			boxes_delete_file (_tmp5_, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_g_object_unref0 (self->initrd_file);
			self->initrd_file = NULL;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		GError* _tmp6_;
		const gchar* _tmp7_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp6_ = _error_;
		_tmp7_ = _tmp6_->message;
		g_debug ("unattended-installer.vala:258: Failed to clean-up: %s", _tmp7_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static void
boxes_unattended_installer_real_clean_up_preparation_cache (BoxesInstallerMedia* base)
{
	BoxesUnattendedInstaller * self;
	self = (BoxesUnattendedInstaller*) base;
	BOXES_INSTALLER_MEDIA_CLASS (boxes_unattended_installer_parent_class)->clean_up_preparation_cache (G_TYPE_CHECK_INSTANCE_CAST (self, BOXES_TYPE_INSTALLER_MEDIA, BoxesInstallerMedia));
	(self->priv->unattended_files == NULL) ? NULL : (self->priv->unattended_files = (_g_list_free__g_object_unref0_ (self->priv->unattended_files), NULL));
	self->priv->unattended_files = NULL;
	(self->priv->secondary_unattended_files == NULL) ? NULL : (self->priv->secondary_unattended_files = (_g_list_free__g_object_unref0_ (self->priv->secondary_unattended_files), NULL));
	self->priv->secondary_unattended_files = NULL;
}

gchar*
boxes_unattended_installer_get_user_unattended (BoxesUnattendedInstaller* self,
                                                const gchar* suffix)
{
	gchar* filename = NULL;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->hostname;
	_tmp1_ = g_strdup (_tmp0_);
	filename = _tmp1_;
	if (suffix != NULL) {
		const gchar* _tmp2_;
		gchar* _tmp3_;
		gchar* _tmp4_;
		gchar* _tmp5_;
		_tmp2_ = filename;
		_tmp3_ = g_strconcat ("-", suffix, NULL);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_strconcat (_tmp2_, _tmp4_, NULL);
		_g_free0 (filename);
		filename = _tmp5_;
		_g_free0 (_tmp4_);
	}
	_tmp6_ = filename;
	_tmp7_ = boxes_get_user_pkgcache (_tmp6_);
	result = _tmp7_;
	_g_free0 (filename);
	return result;
}

static void
boxes_unattended_installer_real_prepare_data_free (gpointer _data)
{
	BoxesUnattendedInstallerPrepareData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->progress);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (BoxesUnattendedInstallerPrepareData, _data_);
}

static void
boxes_unattended_installer_real_prepare (BoxesInstallerMedia* base,
                                         BoxesActivityProgress* progress,
                                         GCancellable* cancellable,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_)
{
	BoxesUnattendedInstaller * self;
	BoxesUnattendedInstallerPrepareData* _data_;
	BoxesUnattendedInstaller* _tmp0_;
	BoxesActivityProgress* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (progress != NULL);
	self = (BoxesUnattendedInstaller*) base;
	_data_ = g_slice_new0 (BoxesUnattendedInstallerPrepareData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_unattended_installer_real_prepare_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (progress);
	_g_object_unref0 (_data_->progress);
	_data_->progress = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	boxes_unattended_installer_real_prepare_co (_data_);
}

static gboolean
boxes_unattended_installer_prepare_finish (BoxesInstallerMedia* base,
                                           GAsyncResult* _res_)
{
	gboolean result;
	BoxesUnattendedInstallerPrepareData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	if (NULL == _data_) {
		gboolean _tmp0_ = FALSE;
		return _tmp0_;
	}
	result = _data_->result;
	return result;
}

static void
boxes_unattended_installer_prepare_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_)
{
	BoxesUnattendedInstallerPrepareData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	boxes_unattended_installer_real_prepare_co (_data_);
}

static gboolean
boxes_unattended_installer_real_prepare_co (BoxesUnattendedInstallerPrepareData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	boxes_unattended_installer_setup_drivers (_data_->self, _data_->progress, _data_->cancellable, boxes_unattended_installer_prepare_ready, _data_);
	return FALSE;
	_state_1:
	_data_->result = boxes_unattended_installer_setup_drivers_finish (_data_->self, _data_->_res_);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static GVirConfigDomainDisk*
boxes_unattended_installer_get_unattended_disk_config (BoxesUnattendedInstaller* self)
{
	GVirConfigDomainDisk* disk = NULL;
	GVirConfigDomainDisk* _tmp0_;
	GVirConfigDomainDisk* _tmp1_;
	GVirConfigDomainDisk* _tmp2_;
	GVirConfigDomainDisk* _tmp3_;
	GVirConfigDomainDisk* _tmp4_;
	GFile* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	OsinfoInstallScriptInjectionMethod _tmp8_;
	OsinfoInstallScriptInjectionMethod _tmp9_;
	GVirConfigDomainDisk* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gvir_config_domain_disk_new ();
	disk = _tmp0_;
	_tmp1_ = disk;
	gvir_config_domain_disk_set_type (_tmp1_, GVIR_CONFIG_DOMAIN_DISK_FILE);
	_tmp2_ = disk;
	gvir_config_domain_disk_set_driver_name (_tmp2_, "qemu");
	_tmp3_ = disk;
	gvir_config_domain_disk_set_driver_format (_tmp3_, GVIR_CONFIG_DOMAIN_DISK_FORMAT_RAW);
	_tmp4_ = disk;
	_tmp5_ = self->disk_file;
	_tmp6_ = g_file_get_path (_tmp5_);
	_tmp7_ = _tmp6_;
	gvir_config_domain_disk_set_source (_tmp4_, _tmp7_);
	_g_free0 (_tmp7_);
	_tmp8_ = boxes_unattended_installer_get_injection_method (self);
	_tmp9_ = _tmp8_;
	if (_tmp9_ == OSINFO_INSTALL_SCRIPT_INJECTION_METHOD_CDROM) {
		GVirConfigDomainDisk* _tmp10_;
		GVirConfigDomainDisk* _tmp11_;
		GVirConfigDomainDiskBus _tmp12_ = 0;
		gboolean _tmp13_;
		gboolean _tmp14_;
		GVirConfigDomainDisk* _tmp15_;
		_tmp10_ = disk;
		gvir_config_domain_disk_set_target_dev (_tmp10_, "hdd");
		_tmp11_ = disk;
		gvir_config_domain_disk_set_guest_device_type (_tmp11_, GVIR_CONFIG_DOMAIN_DISK_GUEST_DEVICE_CDROM);
		_tmp13_ = boxes_installer_media_get_prefers_q35 ((BoxesInstallerMedia*) self);
		_tmp14_ = _tmp13_;
		if (_tmp14_) {
			_tmp12_ = GVIR_CONFIG_DOMAIN_DISK_BUS_SATA;
		} else {
			_tmp12_ = GVIR_CONFIG_DOMAIN_DISK_BUS_IDE;
		}
		_tmp15_ = disk;
		gvir_config_domain_disk_set_target_bus (_tmp15_, _tmp12_);
	} else {
		const gchar* _tmp16_ = NULL;
		gboolean _tmp17_ = FALSE;
		gboolean _tmp18_;
		gboolean _tmp19_;
		GVirConfigDomainDisk* _tmp22_;
		GVirConfigDomainDisk* _tmp23_;
		GVirConfigDomainDisk* _tmp24_;
		_tmp18_ = boxes_installer_media_get_supports_virtio_disk ((BoxesInstallerMedia*) self);
		_tmp19_ = _tmp18_;
		if (_tmp19_) {
			_tmp17_ = TRUE;
		} else {
			gboolean _tmp20_;
			gboolean _tmp21_;
			_tmp20_ = boxes_installer_media_get_supports_virtio1_disk ((BoxesInstallerMedia*) self);
			_tmp21_ = _tmp20_;
			_tmp17_ = _tmp21_;
		}
		if (_tmp17_) {
			_tmp16_ = "sda";
		} else {
			_tmp16_ = "sdb";
		}
		_tmp22_ = disk;
		gvir_config_domain_disk_set_target_dev (_tmp22_, _tmp16_);
		_tmp23_ = disk;
		gvir_config_domain_disk_set_guest_device_type (_tmp23_, GVIR_CONFIG_DOMAIN_DISK_GUEST_DEVICE_DISK);
		_tmp24_ = disk;
		gvir_config_domain_disk_set_target_bus (_tmp24_, GVIR_CONFIG_DOMAIN_DISK_BUS_USB);
	}
	result = disk;
	return result;
}

static void
boxes_unattended_installer_add_unattended_file (BoxesUnattendedInstaller* self,
                                                BoxesUnattendedFile* file)
{
	BoxesUnattendedFile* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (file != NULL);
	_tmp0_ = _g_object_ref0 (file);
	self->priv->unattended_files = g_list_append (self->priv->unattended_files, _tmp0_);
}

static void
boxes_unattended_installer_add_secondary_unattended_file (BoxesUnattendedInstaller* self,
                                                          BoxesUnattendedFile* file)
{
	BoxesUnattendedFile* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (file != NULL);
	_tmp0_ = _g_object_ref0 (file);
	self->priv->secondary_unattended_files = g_list_append (self->priv->secondary_unattended_files, _tmp0_);
}

static void
boxes_unattended_installer_create_disk_image_data_free (gpointer _data)
{
	BoxesUnattendedInstallerCreateDiskImageData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (BoxesUnattendedInstallerCreateDiskImageData, _data_);
}

static void
boxes_unattended_installer_create_disk_image (BoxesUnattendedInstaller* self,
                                              GCancellable* cancellable,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_)
{
	BoxesUnattendedInstallerCreateDiskImageData* _data_;
	BoxesUnattendedInstaller* _tmp0_;
	GCancellable* _tmp1_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (BoxesUnattendedInstallerCreateDiskImageData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_unattended_installer_create_disk_image_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp1_;
	boxes_unattended_installer_create_disk_image_co (_data_);
}

static void
boxes_unattended_installer_create_disk_image_finish (BoxesUnattendedInstaller* self,
                                                     GAsyncResult* _res_,
                                                     GError** error)
{
	BoxesUnattendedInstallerCreateDiskImageData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
boxes_unattended_installer_create_disk_image_ready (GObject* source_object,
                                                    GAsyncResult* _res_,
                                                    gpointer _user_data_)
{
	BoxesUnattendedInstallerCreateDiskImageData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	boxes_unattended_installer_create_disk_image_co (_data_);
}

static gboolean
boxes_unattended_installer_create_disk_image_co (BoxesUnattendedInstallerCreateDiskImageData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = boxes_get_unattended ("disk.img");
	_data_->template_path = _data_->_tmp0_;
	_data_->_tmp1_ = g_file_new_for_path (_data_->template_path);
	_data_->template_file = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->self->disk_file;
	_data_->_tmp3_ = g_file_get_path (_data_->_tmp2_);
	_data_->_tmp4_ = _data_->_tmp3_;
	g_debug ("unattended-installer.vala:316: Creating disk image for unattended inst" \
"allation at '%s'..", _data_->_tmp4_);
	_g_free0 (_data_->_tmp4_);
	_data_->_tmp5_ = _data_->self->disk_file;
	_data_->_state_ = 1;
	g_file_copy_async (_data_->template_file, _data_->_tmp5_, G_FILE_COPY_OVERWRITE | G_FILE_COPY_TARGET_DEFAULT_PERMS, G_PRIORITY_DEFAULT, _data_->cancellable, NULL, NULL, boxes_unattended_installer_create_disk_image_ready, _data_);
	return FALSE;
	_state_1:
	g_file_copy_finish (_data_->template_file, _data_->_res_, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->template_file);
		_g_free0 (_data_->template_path);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp6_ = _data_->self->disk_file;
	_data_->_tmp7_ = g_file_get_path (_data_->_tmp6_);
	_data_->_tmp8_ = _data_->_tmp7_;
	g_debug ("unattended-installer.vala:318: Floppy image for unattended installatio" \
"n created at '%s'", _data_->_tmp8_);
	_g_free0 (_data_->_tmp8_);
	_g_object_unref0 (_data_->template_file);
	_g_free0 (_data_->template_path);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
boxes_unattended_installer_create_iso_data_free (gpointer _data)
{
	BoxesUnattendedInstallerCreateIsoData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (BoxesUnattendedInstallerCreateIsoData, _data_);
}

static void
boxes_unattended_installer_create_iso (BoxesUnattendedInstaller* self,
                                       GCancellable* cancellable,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	BoxesUnattendedInstallerCreateIsoData* _data_;
	BoxesUnattendedInstaller* _tmp0_;
	GCancellable* _tmp1_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (BoxesUnattendedInstallerCreateIsoData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_unattended_installer_create_iso_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp1_;
	boxes_unattended_installer_create_iso_co (_data_);
}

static void
boxes_unattended_installer_create_iso_finish (BoxesUnattendedInstaller* self,
                                              GAsyncResult* _res_,
                                              GError** error)
{
	BoxesUnattendedInstallerCreateIsoData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
boxes_unattended_installer_create_iso_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_)
{
	BoxesUnattendedInstallerCreateIsoData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	boxes_unattended_installer_create_iso_co (_data_);
}

static void
_vala_array_add8 (gchar** * array,
                  gint* length,
                  gint* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
_vala_array_add9 (gchar** * array,
                  gint* length,
                  gint* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static gboolean
boxes_unattended_installer_create_iso_co (BoxesUnattendedInstallerCreateIsoData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->disk_file;
	_data_->_tmp1_ = g_file_get_path (_data_->_tmp0_);
	_data_->disk_file_path = _data_->_tmp1_;
	_data_->_tmp2_ = _data_->disk_file_path;
	g_debug ("unattended-installer.vala:324: Creating cdrom iso '%s'...", _data_->_tmp2_);
	_data_->_tmp3_ = g_strdup ("genisoimage");
	_data_->_tmp4_ = g_strdup ("-graft-points");
	_data_->_tmp5_ = g_strdup ("-J");
	_data_->_tmp6_ = g_strdup ("-rock");
	_data_->_tmp7_ = g_strdup ("-o");
	_data_->_tmp8_ = _data_->disk_file_path;
	_data_->_tmp9_ = g_strdup (_data_->_tmp8_);
	_data_->_tmp10_ = g_new0 (gchar*, 6 + 1);
	_data_->_tmp10_[0] = _data_->_tmp3_;
	_data_->_tmp10_[1] = _data_->_tmp4_;
	_data_->_tmp10_[2] = _data_->_tmp5_;
	_data_->_tmp10_[3] = _data_->_tmp6_;
	_data_->_tmp10_[4] = _data_->_tmp7_;
	_data_->_tmp10_[5] = _data_->_tmp9_;
	_data_->argv = _data_->_tmp10_;
	_data_->argv_length1 = 6;
	_data_->_argv_size_ = _data_->argv_length1;
	_data_->_tmp11_ = _data_->self->priv->unattended_files;
	{
		_data_->unattended_file_collection = _data_->_tmp11_;
		for (_data_->unattended_file_it = _data_->unattended_file_collection; _data_->unattended_file_it != NULL; _data_->unattended_file_it = _data_->unattended_file_it->next) {
			_data_->_tmp12_ = _g_object_ref0 ((BoxesUnattendedFile*) _data_->unattended_file_it->data);
			_data_->unattended_file = _data_->_tmp12_;
			{
				_data_->_tmp13_ = _data_->unattended_file;
				_data_->_state_ = 1;
				boxes_unattended_file_get_source_file (_data_->_tmp13_, _data_->cancellable, boxes_unattended_installer_create_iso_ready, _data_);
				return FALSE;
				_state_1:
				_data_->_tmp14_ = boxes_unattended_file_get_source_file_finish (_data_->_tmp13_, _data_->_res_, &_data_->_inner_error0_);
				_data_->source_file = _data_->_tmp14_;
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_object_unref0 (_data_->unattended_file);
					_data_->argv = (_vala_array_free (_data_->argv, _data_->argv_length1, (GDestroyNotify) g_free), NULL);
					_g_free0 (_data_->disk_file_path);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_data_->_tmp15_ = _data_->unattended_file;
				_data_->_tmp16_ = boxes_unattended_file_get_dest_name (_data_->_tmp15_);
				_data_->_tmp17_ = _data_->_tmp16_;
				_data_->_tmp18_ = boxes_unattended_installer_escape_genisoimage_path (_data_->_tmp17_);
				_data_->dest_path = _data_->_tmp18_;
				_data_->_tmp19_ = _data_->source_file;
				_data_->_tmp20_ = g_file_get_path (_data_->_tmp19_);
				_data_->_tmp21_ = _data_->_tmp20_;
				_data_->_tmp22_ = boxes_unattended_installer_escape_genisoimage_path (_data_->_tmp21_);
				_data_->_tmp23_ = _data_->_tmp22_;
				_g_free0 (_data_->_tmp21_);
				_data_->src_path = _data_->_tmp23_;
				_data_->_tmp24_ = _data_->dest_path;
				_data_->_tmp25_ = g_strconcat (_data_->_tmp24_, "=", NULL);
				_data_->_tmp26_ = _data_->_tmp25_;
				_data_->_tmp27_ = _data_->src_path;
				_data_->_tmp28_ = g_strconcat (_data_->_tmp26_, _data_->_tmp27_, NULL);
				_vala_array_add8 (&_data_->argv, &_data_->argv_length1, &_data_->_argv_size_, _data_->_tmp28_);
				_g_free0 (_data_->_tmp26_);
				_g_free0 (_data_->src_path);
				_g_free0 (_data_->dest_path);
				_g_object_unref0 (_data_->source_file);
				_g_object_unref0 (_data_->unattended_file);
			}
		}
	}
	_data_->_tmp29_ = _data_->self->priv->secondary_unattended_files;
	{
		_data_->_vala1_unattended_file_collection = _data_->_tmp29_;
		for (_data_->_vala1_unattended_file_it = _data_->_vala1_unattended_file_collection; _data_->_vala1_unattended_file_it != NULL; _data_->_vala1_unattended_file_it = _data_->_vala1_unattended_file_it->next) {
			_data_->_tmp30_ = _g_object_ref0 ((BoxesUnattendedFile*) _data_->_vala1_unattended_file_it->data);
			_data_->_vala1_unattended_file = _data_->_tmp30_;
			{
				_data_->_tmp31_ = _data_->_vala1_unattended_file;
				_data_->_state_ = 2;
				boxes_unattended_file_get_source_file (_data_->_tmp31_, _data_->cancellable, boxes_unattended_installer_create_iso_ready, _data_);
				return FALSE;
				_state_2:
				_data_->_tmp32_ = boxes_unattended_file_get_source_file_finish (_data_->_tmp31_, _data_->_res_, &_data_->_inner_error0_);
				_data_->_vala1_source_file = _data_->_tmp32_;
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_object_unref0 (_data_->_vala1_unattended_file);
					_data_->argv = (_vala_array_free (_data_->argv, _data_->argv_length1, (GDestroyNotify) g_free), NULL);
					_g_free0 (_data_->disk_file_path);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_data_->_tmp33_ = _data_->_vala1_unattended_file;
				_data_->_tmp34_ = boxes_unattended_file_get_dest_name (_data_->_tmp33_);
				_data_->_tmp35_ = _data_->_tmp34_;
				_data_->_tmp36_ = boxes_unattended_installer_escape_genisoimage_path (_data_->_tmp35_);
				_data_->_vala1_dest_path = _data_->_tmp36_;
				_data_->_tmp37_ = _data_->_vala1_source_file;
				_data_->_tmp38_ = g_file_get_path (_data_->_tmp37_);
				_data_->_tmp39_ = _data_->_tmp38_;
				_data_->_tmp40_ = boxes_unattended_installer_escape_genisoimage_path (_data_->_tmp39_);
				_data_->_tmp41_ = _data_->_tmp40_;
				_g_free0 (_data_->_tmp39_);
				_data_->_vala1_src_path = _data_->_tmp41_;
				_data_->_tmp42_ = _data_->_vala1_dest_path;
				_data_->_tmp43_ = g_strconcat (_data_->_tmp42_, "=", NULL);
				_data_->_tmp44_ = _data_->_tmp43_;
				_data_->_tmp45_ = _data_->_vala1_src_path;
				_data_->_tmp46_ = g_strconcat (_data_->_tmp44_, _data_->_tmp45_, NULL);
				_vala_array_add9 (&_data_->argv, &_data_->argv_length1, &_data_->_argv_size_, _data_->_tmp46_);
				_g_free0 (_data_->_tmp44_);
				_g_free0 (_data_->_vala1_src_path);
				_g_free0 (_data_->_vala1_dest_path);
				_g_object_unref0 (_data_->_vala1_source_file);
				_g_object_unref0 (_data_->_vala1_unattended_file);
			}
		}
	}
	_data_->_tmp47_ = _data_->argv;
	_data_->_tmp47__length1 = _data_->argv_length1;
	_data_->_state_ = 3;
	boxes_exec (_data_->_tmp47_, (gint) _data_->_tmp47__length1, _data_->cancellable, boxes_unattended_installer_create_iso_ready, _data_);
	return FALSE;
	_state_3:
	boxes_exec_finish (_data_->_res_, NULL, NULL, &_data_->_inner_error0_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_data_->argv = (_vala_array_free (_data_->argv, _data_->argv_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (_data_->disk_file_path);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->argv = (_vala_array_free (_data_->argv, _data_->argv_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (_data_->disk_file_path);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
boxes_unattended_installer_extract_boot_files_data_free (gpointer _data)
{
	BoxesUnattendedInstallerExtractBootFilesData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->extractor);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (BoxesUnattendedInstallerExtractBootFilesData, _data_);
}

static void
boxes_unattended_installer_extract_boot_files (BoxesUnattendedInstaller* self,
                                               BoxesISOExtractor* extractor,
                                               GCancellable* cancellable,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_)
{
	BoxesUnattendedInstallerExtractBootFilesData* _data_;
	BoxesUnattendedInstaller* _tmp0_;
	BoxesISOExtractor* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (extractor != NULL);
	_data_ = g_slice_new0 (BoxesUnattendedInstallerExtractBootFilesData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_unattended_installer_extract_boot_files_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (extractor);
	_g_object_unref0 (_data_->extractor);
	_data_->extractor = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	boxes_unattended_installer_extract_boot_files_co (_data_);
}

static void
boxes_unattended_installer_extract_boot_files_finish (BoxesUnattendedInstaller* self,
                                                      GAsyncResult* _res_,
                                                      GError** error)
{
	BoxesUnattendedInstallerExtractBootFilesData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
boxes_unattended_installer_extract_boot_files_ready (GObject* source_object,
                                                     GAsyncResult* _res_,
                                                     gpointer _user_data_)
{
	BoxesUnattendedInstallerExtractBootFilesData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	boxes_unattended_installer_extract_boot_files_co (_data_);
}

static gboolean
boxes_unattended_installer_extract_boot_files_co (BoxesUnattendedInstallerExtractBootFilesData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = ((BoxesInstallerMedia*) _data_->self)->os_media;
	g_object_get (_data_->_tmp0_, "kernel-path", &_data_->_tmp1_, NULL);
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = _data_->self->kernel_file;
	_data_->_tmp5_ = g_file_get_path (_data_->_tmp4_);
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_state_ = 1;
	boxes_iso_extractor_extract (_data_->extractor, _data_->_tmp3_, _data_->_tmp6_, _data_->cancellable, boxes_unattended_installer_extract_boot_files_ready, _data_);
	return FALSE;
	_state_1:
	boxes_iso_extractor_extract_finish (_data_->extractor, _data_->_res_, &_data_->_inner_error0_);
	_g_free0 (_data_->_tmp6_);
	_g_free0 (_data_->_tmp3_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp7_ = ((BoxesInstallerMedia*) _data_->self)->os_media;
	g_object_get (_data_->_tmp7_, "initrd-path", &_data_->_tmp8_, NULL);
	_data_->_tmp9_ = _data_->_tmp8_;
	_data_->_tmp10_ = _data_->_tmp9_;
	_data_->_tmp11_ = _data_->self->initrd_file;
	_data_->_tmp12_ = g_file_get_path (_data_->_tmp11_);
	_data_->_tmp13_ = _data_->_tmp12_;
	_data_->_state_ = 2;
	boxes_iso_extractor_extract (_data_->extractor, _data_->_tmp10_, _data_->_tmp13_, _data_->cancellable, boxes_unattended_installer_extract_boot_files_ready, _data_);
	return FALSE;
	_state_2:
	boxes_iso_extractor_extract_finish (_data_->extractor, _data_->_res_, &_data_->_inner_error0_);
	_g_free0 (_data_->_tmp13_);
	_g_free0 (_data_->_tmp10_);
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

gchar*
boxes_unattended_installer_get_product_key_format (BoxesUnattendedInstaller* self)
{
	OsinfoInstallScriptList* _tmp0_;
	GList* _tmp1_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->scripts;
	_tmp1_ = osinfo_list_get_elements ((OsinfoList*) _tmp0_);
	{
		GList* s_collection = NULL;
		GList* s_it = NULL;
		s_collection = _tmp1_;
		for (s_it = s_collection; s_it != NULL; s_it = s_it->next) {
			OsinfoEntity* s = NULL;
			s = (OsinfoEntity*) s_it->data;
			{
				OsinfoInstallScript* script = NULL;
				OsinfoEntity* _tmp2_;
				OsinfoInstallScript* _tmp3_;
				OsinfoInstallConfigParam* param = NULL;
				OsinfoInstallScript* _tmp4_;
				OsinfoInstallConfigParam* _tmp5_;
				gboolean _tmp6_ = FALSE;
				OsinfoInstallConfigParam* _tmp7_;
				gchar* format = NULL;
				OsinfoInstallScript* _tmp9_;
				const gchar* _tmp10_;
				gchar* _tmp11_;
				const gchar* _tmp12_;
				_tmp2_ = s;
				_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, osinfo_install_script_get_type ()) ? ((OsinfoInstallScript*) _tmp2_) : NULL);
				script = _tmp3_;
				_tmp4_ = script;
				_tmp5_ = osinfo_install_script_get_config_param (_tmp4_, OSINFO_INSTALL_CONFIG_PROP_REG_PRODUCTKEY);
				param = _tmp5_;
				_tmp7_ = param;
				if (_tmp7_ == NULL) {
					_tmp6_ = TRUE;
				} else {
					OsinfoInstallConfigParam* _tmp8_;
					_tmp8_ = param;
					_tmp6_ = osinfo_install_config_param_is_optional (_tmp8_);
				}
				if (_tmp6_) {
					_g_object_unref0 (param);
					_g_object_unref0 (script);
					continue;
				}
				_tmp9_ = script;
				_tmp10_ = osinfo_install_script_get_product_key_format (_tmp9_);
				_tmp11_ = g_strdup (_tmp10_);
				format = _tmp11_;
				_tmp12_ = format;
				if (_tmp12_ != NULL) {
					result = format;
					_g_object_unref0 (param);
					_g_object_unref0 (script);
					(s_collection == NULL) ? NULL : (s_collection = (g_list_free (s_collection), NULL));
					return result;
				}
				_g_free0 (format);
				_g_object_unref0 (param);
				_g_object_unref0 (script);
			}
		}
		(s_collection == NULL) ? NULL : (s_collection = (g_list_free (s_collection), NULL));
	}
	result = NULL;
	return result;
}

static void
boxes_unattended_installer_setup_drivers_data_free (gpointer _data)
{
	BoxesUnattendedInstallerSetupDriversData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->progress);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (BoxesUnattendedInstallerSetupDriversData, _data_);
}

static void
boxes_unattended_installer_setup_drivers (BoxesUnattendedInstaller* self,
                                          BoxesActivityProgress* progress,
                                          GCancellable* cancellable,
                                          GAsyncReadyCallback _callback_,
                                          gpointer _user_data_)
{
	BoxesUnattendedInstallerSetupDriversData* _data_;
	BoxesUnattendedInstaller* _tmp0_;
	BoxesActivityProgress* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (progress != NULL);
	_data_ = g_slice_new0 (BoxesUnattendedInstallerSetupDriversData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_unattended_installer_setup_drivers_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (progress);
	_g_object_unref0 (_data_->progress);
	_data_->progress = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	boxes_unattended_installer_setup_drivers_co (_data_);
}

static gboolean
boxes_unattended_installer_setup_drivers_finish (BoxesUnattendedInstaller* self,
                                                 GAsyncResult* _res_)
{
	gboolean result;
	BoxesUnattendedInstallerSetupDriversData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	if (NULL == _data_) {
		gboolean _tmp0_ = FALSE;
		return _tmp0_;
	}
	result = _data_->result;
	return result;
}

static void
_boxes_unattended_installer_add_unattended_file_boxes_unattended_installer_add_unattended_file_func (BoxesUnattendedFile* file,
                                                                                                     gpointer self)
{
	boxes_unattended_installer_add_unattended_file ((BoxesUnattendedInstaller*) self, file);
}

static void
boxes_unattended_installer_setup_drivers_ready (GObject* source_object,
                                                GAsyncResult* _res_,
                                                gpointer _user_data_)
{
	BoxesUnattendedInstallerSetupDriversData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	boxes_unattended_installer_setup_drivers_co (_data_);
}

static void
_boxes_unattended_installer_add_secondary_unattended_file_boxes_unattended_installer_add_unattended_file_func (BoxesUnattendedFile* file,
                                                                                                               gpointer self)
{
	boxes_unattended_installer_add_secondary_unattended_file ((BoxesUnattendedInstaller*) self, file);
}

static gboolean
boxes_unattended_installer_setup_drivers_co (BoxesUnattendedInstallerSetupDriversData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	boxes_activity_progress_set_info (_data_->progress, _ ("Downloading device drivers…"));
	_data_->_tmp0_ = boxes_unattended_installer_get_pre_installer_scripts (_data_->self);
	_data_->scripts = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->scripts;
	_data_->_tmp2_ = boxes_unattended_installer_get_pre_installable_drivers (_data_->self, _data_->_tmp1_);
	_data_->drivers = _data_->_tmp2_;
	_data_->_tmp4_ = _data_->drivers;
	if (g_list_length (_data_->_tmp4_) != ((guint) 0)) {
		_data_->_tmp5_ = _data_->scripts;
		_data_->_tmp3_ = g_list_length (_data_->_tmp5_) != ((guint) 0);
	} else {
		_data_->_tmp3_ = FALSE;
	}
	if (_data_->_tmp3_) {
		_data_->_tmp6_ = boxes_activity_progress_add_child_activity (_data_->progress, 0.5);
		_data_->drivers_progress = _data_->_tmp6_;
		_data_->_tmp7_ = _data_->drivers;
		_data_->_tmp8_ = _data_->drivers_progress;
		_data_->_state_ = 1;
		boxes_unattended_installer_setup_drivers_from_list (_data_->self, _data_->_tmp7_, _data_->_tmp8_, _boxes_unattended_installer_add_unattended_file_boxes_unattended_installer_add_unattended_file_func, _data_->self, _data_->cancellable, boxes_unattended_installer_setup_drivers_ready, _data_);
		return FALSE;
		_state_1:
		if (!boxes_unattended_installer_setup_drivers_from_list_finish (_data_->self, _data_->_res_)) {
			_data_->result = FALSE;
			_g_object_unref0 (_data_->drivers_progress);
			(_data_->drivers == NULL) ? NULL : (_data_->drivers = (_g_list_free__g_object_unref0_ (_data_->drivers), NULL));
			(_data_->scripts == NULL) ? NULL : (_data_->scripts = (_g_list_free__g_object_unref0_ (_data_->scripts), NULL));
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_g_object_unref0 (_data_->drivers_progress);
	} else {
		boxes_activity_progress_set_progress (_data_->progress, 0.5);
	}
	_data_->_tmp9_ = boxes_unattended_installer_get_post_installer_scripts (_data_->self);
	(_data_->scripts == NULL) ? NULL : (_data_->scripts = (_g_list_free__g_object_unref0_ (_data_->scripts), NULL));
	_data_->scripts = _data_->_tmp9_;
	_data_->_tmp10_ = _data_->scripts;
	_data_->_tmp11_ = boxes_unattended_installer_get_post_installable_drivers (_data_->self, _data_->_tmp10_);
	(_data_->drivers == NULL) ? NULL : (_data_->drivers = (_g_list_free__g_object_unref0_ (_data_->drivers), NULL));
	_data_->drivers = _data_->_tmp11_;
	_data_->_tmp13_ = _data_->drivers;
	if (g_list_length (_data_->_tmp13_) != ((guint) 0)) {
		_data_->_tmp14_ = _data_->scripts;
		_data_->_tmp12_ = g_list_length (_data_->_tmp14_) != ((guint) 0);
	} else {
		_data_->_tmp12_ = FALSE;
	}
	if (_data_->_tmp12_) {
		_data_->_tmp15_ = boxes_activity_progress_add_child_activity (_data_->progress, 0.5);
		_data_->_vala1_drivers_progress = _data_->_tmp15_;
		_data_->_tmp16_ = _data_->drivers;
		_data_->_tmp17_ = _data_->_vala1_drivers_progress;
		_data_->_state_ = 2;
		boxes_unattended_installer_setup_drivers_from_list (_data_->self, _data_->_tmp16_, _data_->_tmp17_, _boxes_unattended_installer_add_secondary_unattended_file_boxes_unattended_installer_add_unattended_file_func, _data_->self, _data_->cancellable, boxes_unattended_installer_setup_drivers_ready, _data_);
		return FALSE;
		_state_2:
		_data_->result = boxes_unattended_installer_setup_drivers_from_list_finish (_data_->self, _data_->_res_);
		_g_object_unref0 (_data_->_vala1_drivers_progress);
		(_data_->drivers == NULL) ? NULL : (_data_->drivers = (_g_list_free__g_object_unref0_ (_data_->drivers), NULL));
		(_data_->scripts == NULL) ? NULL : (_data_->scripts = (_g_list_free__g_object_unref0_ (_data_->scripts), NULL));
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	} else {
		boxes_activity_progress_set_progress (_data_->progress, 1.0);
	}
	_data_->result = TRUE;
	(_data_->drivers == NULL) ? NULL : (_data_->drivers = (_g_list_free__g_object_unref0_ (_data_->drivers), NULL));
	(_data_->scripts == NULL) ? NULL : (_data_->scripts = (_g_list_free__g_object_unref0_ (_data_->scripts), NULL));
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
boxes_unattended_installer_setup_drivers_from_list_data_free (gpointer _data)
{
	BoxesUnattendedInstallerSetupDriversFromListData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->progress);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (BoxesUnattendedInstallerSetupDriversFromListData, _data_);
}

static void
boxes_unattended_installer_setup_drivers_from_list (BoxesUnattendedInstaller* self,
                                                    GList* drivers,
                                                    BoxesActivityProgress* progress,
                                                    BoxesUnattendedInstallerAddUnattendedFileFunc add_func,
                                                    gpointer add_func_target,
                                                    GCancellable* cancellable,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_)
{
	BoxesUnattendedInstallerSetupDriversFromListData* _data_;
	BoxesUnattendedInstaller* _tmp0_;
	BoxesActivityProgress* _tmp1_;
	GCancellable* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (progress != NULL);
	_data_ = g_slice_new0 (BoxesUnattendedInstallerSetupDriversFromListData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_unattended_installer_setup_drivers_from_list_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->drivers = drivers;
	_tmp1_ = _g_object_ref0 (progress);
	_g_object_unref0 (_data_->progress);
	_data_->progress = _tmp1_;
	_data_->add_func = add_func;
	_data_->add_func_target = add_func_target;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	boxes_unattended_installer_setup_drivers_from_list_co (_data_);
}

static gboolean
boxes_unattended_installer_setup_drivers_from_list_finish (BoxesUnattendedInstaller* self,
                                                           GAsyncResult* _res_)
{
	gboolean result;
	BoxesUnattendedInstallerSetupDriversFromListData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	if (NULL == _data_) {
		gboolean _tmp0_ = FALSE;
		return _tmp0_;
	}
	result = _data_->result;
	return result;
}

static void
boxes_unattended_installer_setup_drivers_from_list_ready (GObject* source_object,
                                                          GAsyncResult* _res_,
                                                          gpointer _user_data_)
{
	BoxesUnattendedInstallerSetupDriversFromListData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	boxes_unattended_installer_setup_drivers_from_list_co (_data_);
}

static gboolean
boxes_unattended_installer_setup_drivers_from_list_co (BoxesUnattendedInstallerSetupDriversFromListData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->driver_progress_scale = 1. / g_list_length (_data_->drivers);
	{
		_data_->driver_collection = _data_->drivers;
		for (_data_->driver_it = _data_->driver_collection; _data_->driver_it != NULL; _data_->driver_it = _data_->driver_it->next) {
			_data_->_tmp0_ = _g_object_ref0 ((OsinfoDeviceDriver*) _data_->driver_it->data);
			_data_->driver = _data_->_tmp0_;
			{
				_data_->_tmp1_ = boxes_activity_progress_add_child_activity (_data_->progress, _data_->driver_progress_scale);
				_data_->driver_progress = _data_->_tmp1_;
				{
					_data_->_tmp2_ = _data_->driver;
					_data_->_tmp3_ = _data_->driver_progress;
					_data_->_state_ = 1;
					boxes_unattended_installer_setup_driver (_data_->self, _data_->_tmp2_, _data_->_tmp3_, _data_->add_func, _data_->add_func_target, _data_->cancellable, boxes_unattended_installer_setup_drivers_from_list_ready, _data_);
					return FALSE;
					_state_1:
					boxes_unattended_installer_setup_driver_finish (_data_->self, _data_->_res_, &_data_->_inner_error0_);
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						if (g_error_matches (_data_->_inner_error0_, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
							goto __catch0_g_io_error_cancelled;
						}
						goto __catch0_g_error;
					}
					_data_->_tmp4_ = _data_->self->priv->additional_devices;
					_data_->_tmp5_ = _data_->driver;
					_data_->_tmp6_ = osinfo_device_driver_get_devices (_data_->_tmp5_);
					osinfo_list_add_all ((OsinfoList*) _data_->_tmp4_, (OsinfoList*) _data_->_tmp6_);
				}
				goto __finally0;
				__catch0_g_io_error_cancelled:
				{
					g_clear_error (&_data_->_inner_error0_);
					g_debug ("unattended-installer.vala:407: Media preparation cancelled during driv" \
"er setup.");
					_data_->result = FALSE;
					{
						_data_->_tmp7_ = _data_->driver_progress;
						boxes_activity_progress_set_progress (_data_->_tmp7_, 1.0);
					}
					_g_object_unref0 (_data_->driver_progress);
					_g_object_unref0 (_data_->driver);
					g_task_return_pointer (_data_->_async_result, _data_, NULL);
					if (_data_->_state_ != 0) {
						while (!g_task_get_completed (_data_->_async_result)) {
							g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
						}
					}
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				goto __finally0;
				__catch0_g_error:
				{
					_data_->e = _data_->_inner_error0_;
					_data_->_inner_error0_ = NULL;
					_data_->_tmp8_ = _data_->driver;
					_data_->_tmp9_ = osinfo_device_driver_get_location (_data_->_tmp8_);
					_data_->_tmp10_ = _data_->e;
					_data_->_tmp11_ = _data_->_tmp10_->message;
					g_debug ("unattended-installer.vala:411: Failed to make use of drivers at '%s': " \
"%s", _data_->_tmp9_, _data_->_tmp11_);
					_g_error_free0 (_data_->e);
				}
				__finally0:
				{
					_data_->_tmp12_ = _data_->driver_progress;
					boxes_activity_progress_set_progress (_data_->_tmp12_, 1.0);
				}
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					_g_object_unref0 (_data_->driver_progress);
					_g_object_unref0 (_data_->driver);
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
					g_clear_error (&_data_->_inner_error0_);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_g_object_unref0 (_data_->driver_progress);
				_g_object_unref0 (_data_->driver);
			}
		}
	}
	_data_->result = TRUE;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
boxes_unattended_installer_setup_driver_data_free (gpointer _data)
{
	BoxesUnattendedInstallerSetupDriverData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->driver);
	_g_object_unref0 (_data_->progress);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->self);
	g_slice_free (BoxesUnattendedInstallerSetupDriverData, _data_);
}

static void
boxes_unattended_installer_setup_driver (BoxesUnattendedInstaller* self,
                                         OsinfoDeviceDriver* driver,
                                         BoxesActivityProgress* progress,
                                         BoxesUnattendedInstallerAddUnattendedFileFunc add_func,
                                         gpointer add_func_target,
                                         GCancellable* cancellable,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_)
{
	BoxesUnattendedInstallerSetupDriverData* _data_;
	BoxesUnattendedInstaller* _tmp0_;
	OsinfoDeviceDriver* _tmp1_;
	BoxesActivityProgress* _tmp2_;
	GCancellable* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (driver != NULL);
	g_return_if_fail (progress != NULL);
	_data_ = g_slice_new0 (BoxesUnattendedInstallerSetupDriverData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, boxes_unattended_installer_setup_driver_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (driver);
	_g_object_unref0 (_data_->driver);
	_data_->driver = _tmp1_;
	_tmp2_ = _g_object_ref0 (progress);
	_g_object_unref0 (_data_->progress);
	_data_->progress = _tmp2_;
	_data_->add_func = add_func;
	_data_->add_func_target = add_func_target;
	_tmp3_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp3_;
	boxes_unattended_installer_setup_driver_co (_data_);
}

static void
boxes_unattended_installer_setup_driver_finish (BoxesUnattendedInstaller* self,
                                                GAsyncResult* _res_,
                                                GError** error)
{
	BoxesUnattendedInstallerSetupDriverData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
_vala_array_add10 (gchar** * array,
                   gint* length,
                   gint* size,
                   gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
boxes_unattended_installer_setup_driver_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_)
{
	BoxesUnattendedInstallerSetupDriverData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	boxes_unattended_installer_setup_driver_co (_data_);
}

static gboolean
boxes_unattended_installer_setup_driver_co (BoxesUnattendedInstallerSetupDriverData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = boxes_downloader_get_default ();
	_data_->downloader = _data_->_tmp0_;
	_data_->driver_files = NULL;
	_data_->_tmp1_ = osinfo_device_driver_get_location (_data_->driver);
	_data_->_tmp2_ = g_strdup (_data_->_tmp1_);
	_data_->location = _data_->_tmp2_;
	_data_->_tmp3_ = _data_->location;
	_data_->_tmp4_ = g_compute_checksum_for_string (G_CHECKSUM_MD5, _data_->_tmp3_, (gsize) -1);
	_data_->location_checksum = _data_->_tmp4_;
	_data_->_tmp5_ = osinfo_device_driver_get_files (_data_->driver);
	_data_->files = _data_->_tmp5_;
	_data_->_tmp6_ = _data_->files;
	_data_->file_progress_scale = 1. / g_list_length (_data_->_tmp6_);
	_data_->_tmp7_ = _data_->files;
	{
		_data_->filename_collection = _data_->_tmp7_;
		for (_data_->filename_it = _data_->filename_collection; _data_->filename_it != NULL; _data_->filename_it = _data_->filename_it->next) {
			_data_->filename = (const gchar*) _data_->filename_it->data;
			{
				_data_->_tmp8_ = _data_->location;
				_data_->_tmp9_ = g_strconcat (_data_->_tmp8_, "/", NULL);
				_data_->_tmp10_ = _data_->_tmp9_;
				_data_->_tmp11_ = _data_->filename;
				_data_->_tmp12_ = g_strconcat (_data_->_tmp10_, _data_->_tmp11_, NULL);
				_data_->_tmp13_ = _data_->_tmp12_;
				_g_free0 (_data_->_tmp10_);
				_data_->file_uri = _data_->_tmp13_;
				_data_->_tmp14_ = _data_->file_uri;
				_data_->_tmp15_ = g_file_new_for_uri (_data_->_tmp14_);
				_data_->file = _data_->_tmp15_;
				_data_->_tmp16_ = _data_->location_checksum;
				_data_->_tmp17_ = g_strconcat (_data_->_tmp16_, "-", NULL);
				_data_->_tmp18_ = _data_->_tmp17_;
				_data_->_tmp19_ = _data_->file;
				_data_->_tmp20_ = g_file_get_basename (_data_->_tmp19_);
				_data_->_tmp21_ = _data_->_tmp20_;
				_data_->_tmp22_ = g_strconcat (_data_->_tmp18_, _data_->_tmp21_, NULL);
				_data_->_tmp23_ = _data_->_tmp22_;
				_g_free0 (_data_->_tmp21_);
				_g_free0 (_data_->_tmp18_);
				_data_->driver_file_name = _data_->_tmp23_;
				_data_->_tmp24_ = _data_->driver_file_name;
				_data_->_tmp25_ = boxes_get_drivers_cache (_data_->_tmp24_);
				_data_->cached_path = _data_->_tmp25_;
				_data_->_tmp26_ = _data_->driver_file_name;
				_data_->_tmp27_ = boxes_get_system_drivers_cache (_data_->_tmp26_);
				_data_->system_cached_path = _data_->_tmp27_;
				_data_->_tmp28_ = _data_->cached_path;
				_data_->_tmp29_ = g_strdup (_data_->_tmp28_);
				_data_->_tmp30_ = g_new0 (gchar*, 1 + 1);
				_data_->_tmp30_[0] = _data_->_tmp29_;
				_data_->cached_paths = _data_->_tmp30_;
				_data_->cached_paths_length1 = 1;
				_data_->_cached_paths_size_ = _data_->cached_paths_length1;
				_data_->_tmp31_ = _data_->system_cached_path;
				if (_data_->_tmp31_ != NULL) {
					_data_->_tmp32_ = _data_->system_cached_path;
					_data_->_tmp33_ = g_strdup (_data_->_tmp32_);
					_vala_array_add10 (&_data_->cached_paths, &_data_->cached_paths_length1, &_data_->_cached_paths_size_, _data_->_tmp33_);
				}
				_data_->_tmp34_ = boxes_activity_progress_add_child_activity (_data_->progress, _data_->file_progress_scale);
				_data_->file_progress = _data_->_tmp34_;
				_data_->_tmp36_ = _data_->downloader;
				_data_->_tmp37_ = _data_->file;
				_data_->_tmp38_ = _data_->cached_paths;
				_data_->_tmp38__length1 = _data_->cached_paths_length1;
				_data_->_tmp39_ = _data_->file_progress;
				_data_->_state_ = 1;
				boxes_downloader_download (_data_->_tmp36_, _data_->_tmp37_, _data_->_tmp38_, (gint) _data_->_tmp38__length1, _data_->_tmp39_, _data_->cancellable, boxes_unattended_installer_setup_driver_ready, _data_);
				return FALSE;
				_state_1:
				_data_->_tmp40_ = boxes_downloader_download_finish (_data_->_tmp36_, _data_->_res_, &_data_->_inner_error0_);
				_data_->_tmp35_ = _data_->_tmp40_;
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
					_g_object_unref0 (_data_->file_progress);
					_data_->cached_paths = (_vala_array_free (_data_->cached_paths, _data_->cached_paths_length1, (GDestroyNotify) g_free), NULL);
					_g_free0 (_data_->system_cached_path);
					_g_free0 (_data_->cached_path);
					_g_free0 (_data_->driver_file_name);
					_g_object_unref0 (_data_->file);
					_g_free0 (_data_->file_uri);
					(_data_->files == NULL) ? NULL : (_data_->files = (g_list_free (_data_->files), NULL));
					_g_free0 (_data_->location_checksum);
					_g_free0 (_data_->location);
					(_data_->driver_files == NULL) ? NULL : (_data_->driver_files = (_g_list_free__g_object_unref0_ (_data_->driver_files), NULL));
					_g_object_unref0 (_data_->downloader);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_data_->_tmp41_ = _data_->_tmp35_;
				_data_->_tmp35_ = NULL;
				_g_object_unref0 (_data_->file);
				_data_->file = _data_->_tmp41_;
				_data_->_tmp42_ = _data_->file_progress;
				boxes_activity_progress_set_progress (_data_->_tmp42_, 1.0);
				_data_->_tmp43_ = _data_->file;
				_data_->_tmp44_ = g_file_get_path (_data_->_tmp43_);
				_data_->_tmp45_ = _data_->_tmp44_;
				_data_->_tmp46_ = _data_->filename;
				_data_->_tmp47_ = boxes_unattended_raw_file_new (_data_->self, _data_->_tmp45_, _data_->_tmp46_);
				_data_->driver_files = g_list_append (_data_->driver_files, (BoxesUnattendedFile*) _data_->_tmp47_);
				_g_free0 (_data_->_tmp45_);
				_g_object_unref0 (_data_->_tmp35_);
				_g_object_unref0 (_data_->file_progress);
				_data_->cached_paths = (_vala_array_free (_data_->cached_paths, _data_->cached_paths_length1, (GDestroyNotify) g_free), NULL);
				_g_free0 (_data_->system_cached_path);
				_g_free0 (_data_->cached_path);
				_g_free0 (_data_->driver_file_name);
				_g_object_unref0 (_data_->file);
				_g_free0 (_data_->file_uri);
			}
		}
	}
	_data_->_tmp48_ = _data_->driver_files;
	{
		_data_->driver_file_collection = _data_->_tmp48_;
		for (_data_->driver_file_it = _data_->driver_file_collection; _data_->driver_file_it != NULL; _data_->driver_file_it = _data_->driver_file_it->next) {
			_data_->_tmp49_ = _g_object_ref0 ((BoxesUnattendedFile*) _data_->driver_file_it->data);
			_data_->driver_file = _data_->_tmp49_;
			{
				_data_->_tmp50_ = _data_->driver_file;
				_data_->add_func (_data_->_tmp50_, _data_->add_func_target);
				_g_object_unref0 (_data_->driver_file);
			}
		}
	}
	(_data_->files == NULL) ? NULL : (_data_->files = (g_list_free (_data_->files), NULL));
	_g_free0 (_data_->location_checksum);
	_g_free0 (_data_->location);
	(_data_->driver_files == NULL) ? NULL : (_data_->driver_files = (_g_list_free__g_object_unref0_ (_data_->driver_files), NULL));
	_g_object_unref0 (_data_->downloader);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static gboolean
__lambda33_ (BoxesUnattendedInstaller* self,
             OsinfoDeviceDriver* driver)
{
	gboolean result;
	g_return_val_if_fail (driver != NULL, FALSE);
	result = osinfo_device_driver_get_pre_installable (driver);
	return result;
}

static gboolean
___lambda33__boxes_unattended_installer_driver_installable_func (OsinfoDeviceDriver* driver,
                                                                 gpointer self)
{
	gboolean result;
	result = __lambda33_ ((BoxesUnattendedInstaller*) self, driver);
	return result;
}

static OsinfoDeviceDriverSigningReq
__lambda34_ (BoxesUnattendedInstaller* self,
             OsinfoInstallScript* script)
{
	OsinfoDeviceDriverSigningReq result;
	g_return_val_if_fail (script != NULL, 0);
	result = osinfo_install_script_get_pre_install_drivers_signing_req (script);
	return result;
}

static OsinfoDeviceDriverSigningReq
___lambda34__boxes_unattended_installer_script_driver_signing_req_func (OsinfoInstallScript* script,
                                                                        gpointer self)
{
	OsinfoDeviceDriverSigningReq result;
	result = __lambda34_ ((BoxesUnattendedInstaller*) self, script);
	return result;
}

static GList*
boxes_unattended_installer_get_pre_installable_drivers (BoxesUnattendedInstaller* self,
                                                        GList* preinst_scripts)
{
	GList* _tmp0_;
	GList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = boxes_unattended_installer_get_installable_drivers (self, preinst_scripts, ___lambda33__boxes_unattended_installer_driver_installable_func, self, ___lambda34__boxes_unattended_installer_script_driver_signing_req_func, self);
	result = _tmp0_;
	return result;
}

static gboolean
__lambda36_ (BoxesUnattendedInstaller* self,
             OsinfoDeviceDriver* driver)
{
	gboolean result;
	g_return_val_if_fail (driver != NULL, FALSE);
	result = !osinfo_device_driver_get_pre_installable (driver);
	return result;
}

static gboolean
___lambda36__boxes_unattended_installer_driver_installable_func (OsinfoDeviceDriver* driver,
                                                                 gpointer self)
{
	gboolean result;
	result = __lambda36_ ((BoxesUnattendedInstaller*) self, driver);
	return result;
}

static OsinfoDeviceDriverSigningReq
__lambda37_ (BoxesUnattendedInstaller* self,
             OsinfoInstallScript* script)
{
	OsinfoDeviceDriverSigningReq result;
	g_return_val_if_fail (script != NULL, 0);
	result = osinfo_install_script_get_post_install_drivers_signing_req (script);
	return result;
}

static OsinfoDeviceDriverSigningReq
___lambda37__boxes_unattended_installer_script_driver_signing_req_func (OsinfoInstallScript* script,
                                                                        gpointer self)
{
	OsinfoDeviceDriverSigningReq result;
	result = __lambda37_ ((BoxesUnattendedInstaller*) self, script);
	return result;
}

static GList*
boxes_unattended_installer_get_post_installable_drivers (BoxesUnattendedInstaller* self,
                                                         GList* postinst_scripts)
{
	GList* _tmp0_;
	GList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = boxes_unattended_installer_get_installable_drivers (self, postinst_scripts, ___lambda36__boxes_unattended_installer_driver_installable_func, self, ___lambda37__boxes_unattended_installer_script_driver_signing_req_func, self);
	result = _tmp0_;
	return result;
}

static Block49Data*
block49_data_ref (Block49Data* _data49_)
{
	g_atomic_int_inc (&_data49_->_ref_count_);
	return _data49_;
}

static void
block49_data_unref (void * _userdata_)
{
	Block49Data* _data49_;
	_data49_ = (Block49Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data49_->_ref_count_)) {
		BoxesUnattendedInstaller* self;
		self = _data49_->self;
		_g_object_unref0 (self);
		g_slice_free (Block49Data, _data49_);
	}
}

static gboolean
__lambda32_ (Block49Data* _data49_,
             OsinfoDeviceDriver* driver)
{
	BoxesUnattendedInstaller* self;
	gboolean _tmp0_ = FALSE;
	gboolean result;
	self = _data49_->self;
	g_return_val_if_fail (driver != NULL, FALSE);
	if (!_data49_->installable_func (driver, _data49_->installable_func_target)) {
		result = FALSE;
		return result;
	}
	if (!osinfo_device_driver_get_signed (driver)) {
		_tmp0_ = _data49_->signing_required;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		if (_data49_->driver_signing_mutable) {
			self->priv->driver_signing = FALSE;
		} else {
			const gchar* _tmp1_;
			_tmp1_ = osinfo_device_driver_get_location (driver);
			g_debug ("unattended-installer.vala:508: Driver from location '%s' is not signed" \
". Ignoring..", _tmp1_);
			result = FALSE;
			return result;
		}
	}
	result = TRUE;
	return result;
}

static gboolean
___lambda32__boxes_unattended_installer_driver_test_function (OsinfoDeviceDriver* driver,
                                                              gpointer self)
{
	gboolean result;
	result = __lambda32_ (self, driver);
	return result;
}

static GList*
boxes_unattended_installer_get_installable_drivers (BoxesUnattendedInstaller* self,
                                                    GList* scripts,
                                                    BoxesUnattendedInstallerDriverInstallableFunc installable_func,
                                                    gpointer installable_func_target,
                                                    BoxesUnattendedInstallerScriptDriverSigningReqFunc signing_req_func,
                                                    gpointer signing_req_func_target)
{
	Block49Data* _data49_;
	GList* _tmp15_;
	GList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_data49_ = g_slice_new0 (Block49Data);
	_data49_->_ref_count_ = 1;
	_data49_->self = g_object_ref (self);
	_data49_->installable_func = installable_func;
	_data49_->installable_func_target = installable_func_target;
	_data49_->signing_required = FALSE;
	{
		GList* script_collection = NULL;
		GList* script_it = NULL;
		script_collection = scripts;
		for (script_it = script_collection; script_it != NULL; script_it = script_it->next) {
			OsinfoInstallScript* _tmp0_;
			OsinfoInstallScript* script = NULL;
			_tmp0_ = _g_object_ref0 ((OsinfoInstallScript*) script_it->data);
			script = _tmp0_;
			{
				OsinfoInstallScript* _tmp1_;
				_tmp1_ = script;
				if (signing_req_func (_tmp1_, signing_req_func_target) != OSINFO_DEVICE_DRIVER_SIGNING_REQ_NONE) {
					OsinfoInstallScript* _tmp2_;
					gchar* _tmp3_;
					gchar* _tmp4_;
					gchar* _tmp5_;
					_tmp2_ = script;
					g_object_get ((OsinfoEntity*) _tmp2_, "id", &_tmp3_, NULL);
					_tmp4_ = _tmp3_;
					_tmp5_ = _tmp4_;
					g_debug ("unattended-installer.vala:480: Script '%s' requires signed drivers.", _tmp5_);
					_g_free0 (_tmp5_);
					_data49_->signing_required = TRUE;
					_g_object_unref0 (script);
					break;
				}
				_g_object_unref0 (script);
			}
		}
	}
	_data49_->driver_signing_mutable = FALSE;
	if (_data49_->signing_required) {
		OsinfoInstallScriptList* _tmp6_;
		GList* _tmp7_;
		_tmp6_ = self->scripts;
		_tmp7_ = osinfo_list_get_elements ((OsinfoList*) _tmp6_);
		{
			GList* s_collection = NULL;
			GList* s_it = NULL;
			s_collection = _tmp7_;
			for (s_it = s_collection; s_it != NULL; s_it = s_it->next) {
				OsinfoEntity* s = NULL;
				s = (OsinfoEntity*) s_it->data;
				{
					OsinfoInstallScript* script = NULL;
					OsinfoEntity* _tmp8_;
					OsinfoInstallScript* _tmp9_;
					OsinfoInstallScript* _tmp10_;
					_tmp8_ = s;
					_tmp9_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp8_, osinfo_install_script_get_type ()) ? ((OsinfoInstallScript*) _tmp8_) : NULL);
					script = _tmp9_;
					_tmp10_ = script;
					if (osinfo_install_script_has_config_param_name (_tmp10_, OSINFO_INSTALL_CONFIG_PROP_DRIVER_SIGNING)) {
						OsinfoInstallScript* _tmp11_;
						gchar* _tmp12_;
						gchar* _tmp13_;
						gchar* _tmp14_;
						_tmp11_ = script;
						g_object_get ((OsinfoEntity*) _tmp11_, "id", &_tmp12_, NULL);
						_tmp13_ = _tmp12_;
						_tmp14_ = _tmp13_;
						g_debug ("unattended-installer.vala:493: Script '%s' allows disabling of driver " \
"signature checks.", _tmp14_);
						_g_free0 (_tmp14_);
						_data49_->driver_signing_mutable = TRUE;
						_g_object_unref0 (script);
						break;
					}
					_g_object_unref0 (script);
				}
			}
			(s_collection == NULL) ? NULL : (s_collection = (g_list_free (s_collection), NULL));
		}
	}
	_tmp15_ = boxes_unattended_installer_get_drivers (self, ___lambda32__boxes_unattended_installer_driver_test_function, _data49_);
	result = _tmp15_;
	block49_data_unref (_data49_);
	_data49_ = NULL;
	return result;
}

static void
_g_free0_ (gpointer var)
{
	var = (g_free (var), NULL);
}

static GList*
boxes_unattended_installer_get_drivers (BoxesUnattendedInstaller* self,
                                        BoxesUnattendedInstallerDriverTestFunction test_func,
                                        gpointer test_func_target)
{
	GHashTable* drivers = NULL;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	OsinfoOs* _tmp3_;
	OsinfoDeviceDriverList* _tmp4_;
	GList* _tmp5_;
	GList* ret = NULL;
	GHashTable* _tmp32_;
	GList* _tmp33_;
	GList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_str_hash;
	_tmp1_ = g_str_equal;
	_tmp2_ = g_hash_table_new_full (_tmp0_, _tmp1_, _g_free0_, _g_object_unref0_);
	drivers = _tmp2_;
	_tmp3_ = ((BoxesInstallerMedia*) self)->os;
	_tmp4_ = osinfo_os_get_device_drivers (_tmp3_);
	_tmp5_ = osinfo_list_get_elements ((OsinfoList*) _tmp4_);
	{
		GList* d_collection = NULL;
		GList* d_it = NULL;
		d_collection = _tmp5_;
		for (d_it = d_collection; d_it != NULL; d_it = d_it->next) {
			OsinfoEntity* d = NULL;
			d = (OsinfoEntity*) d_it->data;
			{
				OsinfoDeviceDriver* driver = NULL;
				OsinfoEntity* _tmp6_;
				OsinfoDeviceDriver* _tmp7_;
				BoxesCPUArchCompatibility compatibility = 0;
				OsinfoMedia* _tmp8_;
				gchar* _tmp9_;
				gchar* _tmp10_;
				gchar* _tmp11_;
				OsinfoDeviceDriver* _tmp12_;
				const gchar* _tmp13_;
				BoxesCPUArchCompatibility _tmp14_;
				gchar* location = NULL;
				OsinfoDeviceDriver* _tmp15_;
				const gchar* _tmp16_;
				gchar* _tmp17_;
				_tmp6_ = d;
				_tmp7_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp6_, osinfo_device_driver_get_type ()) ? ((OsinfoDeviceDriver*) _tmp6_) : NULL);
				driver = _tmp7_;
				_tmp8_ = ((BoxesInstallerMedia*) self)->os_media;
				g_object_get (_tmp8_, "architecture", &_tmp9_, NULL);
				_tmp10_ = _tmp9_;
				_tmp11_ = _tmp10_;
				_tmp12_ = driver;
				_tmp13_ = osinfo_device_driver_get_architecture (_tmp12_);
				_tmp14_ = boxes_compare_cpu_architectures (_tmp11_, _tmp13_);
				_g_free0 (_tmp11_);
				compatibility = _tmp14_;
				_tmp15_ = driver;
				_tmp16_ = osinfo_device_driver_get_location (_tmp15_);
				_tmp17_ = g_strdup (_tmp16_);
				location = _tmp17_;
				if (compatibility == BOXES_CPU_ARCH_COMPATIBILITY_IDENTICAL) {
					GHashTable* _tmp18_;
					const gchar* _tmp19_;
					gchar* _tmp20_;
					OsinfoDeviceDriver* _tmp21_;
					OsinfoDeviceDriver* _tmp22_;
					_tmp18_ = drivers;
					_tmp19_ = location;
					_tmp20_ = g_strdup (_tmp19_);
					_tmp21_ = driver;
					_tmp22_ = _g_object_ref0 (_tmp21_);
					g_hash_table_replace (_tmp18_, _tmp20_, _tmp22_);
				} else {
					gboolean _tmp23_ = FALSE;
					if (compatibility == BOXES_CPU_ARCH_COMPATIBILITY_COMPATIBLE) {
						GHashTable* _tmp24_;
						const gchar* _tmp25_;
						gconstpointer _tmp26_;
						_tmp24_ = drivers;
						_tmp25_ = location;
						_tmp26_ = g_hash_table_lookup (_tmp24_, _tmp25_);
						_tmp23_ = ((OsinfoDeviceDriver*) _tmp26_) == NULL;
					} else {
						_tmp23_ = FALSE;
					}
					if (_tmp23_) {
						GHashTable* _tmp27_;
						const gchar* _tmp28_;
						gchar* _tmp29_;
						OsinfoDeviceDriver* _tmp30_;
						OsinfoDeviceDriver* _tmp31_;
						_tmp27_ = drivers;
						_tmp28_ = location;
						_tmp29_ = g_strdup (_tmp28_);
						_tmp30_ = driver;
						_tmp31_ = _g_object_ref0 (_tmp30_);
						g_hash_table_insert (_tmp27_, _tmp29_, _tmp31_);
					}
				}
				_g_free0 (location);
				_g_object_unref0 (driver);
			}
		}
		(d_collection == NULL) ? NULL : (d_collection = (g_list_free (d_collection), NULL));
	}
	ret = NULL;
	_tmp32_ = drivers;
	_tmp33_ = g_hash_table_get_values (_tmp32_);
	{
		GList* driver_collection = NULL;
		GList* driver_it = NULL;
		driver_collection = _tmp33_;
		for (driver_it = driver_collection; driver_it != NULL; driver_it = driver_it->next) {
			OsinfoDeviceDriver* driver = NULL;
			driver = (OsinfoDeviceDriver*) driver_it->data;
			{
				OsinfoDeviceDriver* _tmp34_;
				_tmp34_ = driver;
				if (test_func (_tmp34_, test_func_target)) {
					OsinfoDeviceDriver* _tmp35_;
					OsinfoDeviceDriver* _tmp36_;
					_tmp35_ = driver;
					_tmp36_ = _g_object_ref0 (_tmp35_);
					ret = g_list_prepend (ret, _tmp36_);
				}
			}
		}
		(driver_collection == NULL) ? NULL : (driver_collection = (g_list_free (driver_collection), NULL));
	}
	ret = g_list_reverse (ret);
	result = ret;
	_g_hash_table_unref0 (drivers);
	return result;
}

static gboolean
__lambda31_ (BoxesUnattendedInstaller* self,
             OsinfoInstallScript* script)
{
	gboolean result;
	g_return_val_if_fail (script != NULL, FALSE);
	result = osinfo_install_script_get_can_pre_install_drivers (script);
	return result;
}

static gboolean
___lambda31__boxes_unattended_installer_script_test_function (OsinfoInstallScript* script,
                                                              gpointer self)
{
	gboolean result;
	result = __lambda31_ ((BoxesUnattendedInstaller*) self, script);
	return result;
}

static GList*
boxes_unattended_installer_get_pre_installer_scripts (BoxesUnattendedInstaller* self)
{
	GList* _tmp0_;
	GList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = boxes_unattended_installer_get_scripts (self, ___lambda31__boxes_unattended_installer_script_test_function, self);
	result = _tmp0_;
	return result;
}

static gboolean
__lambda35_ (BoxesUnattendedInstaller* self,
             OsinfoInstallScript* script)
{
	gboolean result;
	g_return_val_if_fail (script != NULL, FALSE);
	result = osinfo_install_script_get_can_post_install_drivers (script);
	return result;
}

static gboolean
___lambda35__boxes_unattended_installer_script_test_function (OsinfoInstallScript* script,
                                                              gpointer self)
{
	gboolean result;
	result = __lambda35_ ((BoxesUnattendedInstaller*) self, script);
	return result;
}

static GList*
boxes_unattended_installer_get_post_installer_scripts (BoxesUnattendedInstaller* self)
{
	GList* _tmp0_;
	GList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = boxes_unattended_installer_get_scripts (self, ___lambda35__boxes_unattended_installer_script_test_function, self);
	result = _tmp0_;
	return result;
}

static GList*
boxes_unattended_installer_get_scripts (BoxesUnattendedInstaller* self,
                                        BoxesUnattendedInstallerScriptTestFunction test_func,
                                        gpointer test_func_target)
{
	GList* scripts = NULL;
	OsinfoInstallScriptList* _tmp0_;
	GList* _tmp1_;
	GList* result;
	g_return_val_if_fail (self != NULL, NULL);
	scripts = NULL;
	_tmp0_ = self->scripts;
	_tmp1_ = osinfo_list_get_elements ((OsinfoList*) _tmp0_);
	{
		GList* s_collection = NULL;
		GList* s_it = NULL;
		s_collection = _tmp1_;
		for (s_it = s_collection; s_it != NULL; s_it = s_it->next) {
			OsinfoEntity* s = NULL;
			s = (OsinfoEntity*) s_it->data;
			{
				OsinfoInstallScript* script = NULL;
				OsinfoEntity* _tmp2_;
				OsinfoInstallScript* _tmp3_;
				OsinfoInstallScript* _tmp4_;
				_tmp2_ = s;
				_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, osinfo_install_script_get_type ()) ? ((OsinfoInstallScript*) _tmp2_) : NULL);
				script = _tmp3_;
				_tmp4_ = script;
				if (test_func (_tmp4_, test_func_target)) {
					OsinfoInstallScript* _tmp5_;
					OsinfoInstallScript* _tmp6_;
					_tmp5_ = script;
					_tmp6_ = _g_object_ref0 (_tmp5_);
					scripts = g_list_append (scripts, _tmp6_);
				}
				_g_object_unref0 (script);
			}
		}
		(s_collection == NULL) ? NULL : (s_collection = (g_list_free (s_collection), NULL));
	}
	result = scripts;
	return result;
}

static gchar*
boxes_unattended_installer_get_preferred_keyboard (BoxesUnattendedInstaller* self,
                                                   const gchar* lang)
{
	BoxesOSDatabase* os_db = NULL;
	BoxesMediaManager* _tmp0_;
	BoxesMediaManager* _tmp1_;
	BoxesOSDatabase* _tmp2_;
	BoxesOSDatabase* _tmp3_;
	BoxesOSDatabase* _tmp4_;
	BoxesOSDatabase* _tmp5_;
	OsinfoDatamap* datamap = NULL;
	BoxesOSDatabase* _tmp6_;
	OsinfoDatamap* _tmp7_;
	gchar* kbd_layout = NULL;
	gchar* _tmp8_;
	gboolean _tmp9_ = FALSE;
	const gchar* _tmp10_;
	OsinfoDatamap* _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	const gchar* _tmp17_;
	gchar* _tmp18_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (lang != NULL, NULL);
	_tmp0_ = boxes_media_manager_get_default ();
	_tmp1_ = _tmp0_;
	_tmp2_ = boxes_media_manager_get_os_db (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_tmp5_ = _tmp4_;
	_g_object_unref0 (_tmp1_);
	os_db = _tmp5_;
	_tmp6_ = os_db;
	_tmp7_ = boxes_os_database_get_datamap (_tmp6_, "http://x.org/x11-keyboard");
	datamap = _tmp7_;
	_tmp8_ = boxes_unattended_installer_get_preferred_keyboard_from_gsettings (self);
	kbd_layout = _tmp8_;
	_tmp10_ = kbd_layout;
	if (_tmp10_ != NULL) {
		OsinfoDatamap* _tmp11_;
		const gchar* _tmp12_;
		const gchar* _tmp13_;
		_tmp11_ = datamap;
		_tmp12_ = kbd_layout;
		_tmp13_ = osinfo_datamap_reverse_lookup (_tmp11_, _tmp12_);
		_tmp9_ = _tmp13_ != NULL;
	} else {
		_tmp9_ = FALSE;
	}
	if (_tmp9_) {
		result = kbd_layout;
		_g_object_unref0 (datamap);
		_g_object_unref0 (os_db);
		return result;
	}
	_tmp14_ = datamap;
	_tmp15_ = osinfo_datamap_lookup (_tmp14_, lang);
	_tmp16_ = g_strdup (_tmp15_);
	_g_free0 (kbd_layout);
	kbd_layout = _tmp16_;
	_tmp17_ = kbd_layout;
	if (_tmp17_ != NULL) {
		result = kbd_layout;
		_g_object_unref0 (datamap);
		_g_object_unref0 (os_db);
		return result;
	}
	_tmp18_ = g_strdup (lang);
	result = _tmp18_;
	_g_free0 (kbd_layout);
	_g_object_unref0 (datamap);
	_g_object_unref0 (os_db);
	return result;
}

static gpointer
_g_settings_schema_source_ref0 (gpointer self)
{
	return self ? g_settings_schema_source_ref (self) : NULL;
}

static gchar*
boxes_unattended_installer_get_preferred_keyboard_from_gsettings (BoxesUnattendedInstaller* self)
{
	GSettingsSchemaSource* schema_source = NULL;
	GSettingsSchemaSource* _tmp0_;
	GSettingsSchemaSource* _tmp1_;
	GSettingsSchema* input_schema = NULL;
	GSettingsSchemaSource* _tmp2_;
	GSettingsSchema* _tmp3_;
	GSettingsSchema* _tmp4_;
	GSettings* input_settings = NULL;
	GSettings* _tmp5_;
	GVariant* sources = NULL;
	GSettings* _tmp6_;
	GVariant* _tmp7_;
	gboolean _tmp8_ = FALSE;
	GVariant* _tmp9_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_settings_schema_source_get_default ();
	_tmp1_ = _g_settings_schema_source_ref0 (_tmp0_);
	schema_source = _tmp1_;
	_tmp2_ = schema_source;
	_tmp3_ = g_settings_schema_source_lookup (_tmp2_, BOXES_UNATTENDED_INSTALLER_INPUT_SOURCE_SCHEMA, FALSE);
	input_schema = _tmp3_;
	_tmp4_ = input_schema;
	if (_tmp4_ == NULL) {
		result = NULL;
		_g_settings_schema_unref0 (input_schema);
		_g_settings_schema_source_unref0 (schema_source);
		return result;
	}
	_tmp5_ = g_settings_new (BOXES_UNATTENDED_INSTALLER_INPUT_SOURCE_SCHEMA);
	input_settings = _tmp5_;
	_tmp6_ = input_settings;
	_tmp7_ = g_settings_get_value (_tmp6_, "sources");
	sources = _tmp7_;
	_tmp9_ = sources;
	if (_tmp9_ != NULL) {
		GVariant* _tmp10_;
		_tmp10_ = sources;
		_tmp8_ = g_variant_n_children (_tmp10_) >= ((gsize) 1);
	} else {
		_tmp8_ = FALSE;
	}
	if (_tmp8_) {
		GVariant* sources_pair = NULL;
		GVariant* _tmp11_;
		GVariant* _tmp12_;
		GVariant* _tmp13_;
		_tmp11_ = sources;
		_tmp12_ = g_variant_get_child_value (_tmp11_, (gsize) 0);
		sources_pair = _tmp12_;
		_tmp13_ = sources_pair;
		if (_tmp13_ != NULL) {
			GVariant* sources_pair_value = NULL;
			GVariant* _tmp14_;
			GVariant* _tmp15_;
			GVariant* _tmp16_;
			_tmp14_ = sources_pair;
			_tmp15_ = g_variant_get_child_value (_tmp14_, (gsize) 1);
			sources_pair_value = _tmp15_;
			_tmp16_ = sources_pair_value;
			if (_tmp16_ != NULL) {
				GVariant* _tmp17_;
				const gchar* _tmp18_;
				gchar* _tmp19_;
				_tmp17_ = sources_pair_value;
				_tmp18_ = g_variant_get_string (_tmp17_, NULL);
				_tmp19_ = g_strdup (_tmp18_);
				result = _tmp19_;
				_g_variant_unref0 (sources_pair_value);
				_g_variant_unref0 (sources_pair);
				_g_variant_unref0 (sources);
				_g_object_unref0 (input_settings);
				_g_settings_schema_unref0 (input_schema);
				_g_settings_schema_source_unref0 (schema_source);
				return result;
			}
			_g_variant_unref0 (sources_pair_value);
		}
		_g_variant_unref0 (sources_pair);
	}
	result = NULL;
	_g_variant_unref0 (sources);
	_g_object_unref0 (input_settings);
	_g_settings_schema_unref0 (input_schema);
	_g_settings_schema_source_unref0 (schema_source);
	return result;
}

static gchar**
_vala_array_dup4 (gchar** self,
                  gssize length)
{
	if (length >= 0) {
		gchar** result;
		gssize i;
		result = g_new0 (gchar*, length + 1);
		for (i = 0; i < length; i++) {
			gchar* _tmp0_;
			_tmp0_ = g_strdup (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

static void
_vala_array_add11 (gchar** * array,
                   gint* length,
                   gint* size,
                   gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static gboolean
_vala_string_array_contains (gchar* * stack,
                             gssize stack_length,
                             const gchar* needle)
{
	gssize i;
	for (i = 0; i < stack_length; i++) {
		if (g_strcmp0 (stack[i], needle) == 0) {
			return TRUE;
		}
	}
	return FALSE;
}

static gchar*
boxes_unattended_installer_get_preferred_language (BoxesUnattendedInstaller* self)
{
	gchar** system_langs = NULL;
	gchar** _tmp0_;
	gchar** _tmp1_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	gint system_langs_length1;
	gint _system_langs_size_;
	gchar** media_langs = NULL;
	gchar** _tmp3_;
	gint media_langs_length1;
	gint _media_langs_size_;
	GList* media_langs_list = NULL;
	OsinfoMedia* _tmp4_;
	GList* _tmp5_;
	GList* _tmp6_;
	GList* _tmp7_;
	gchar** _tmp10_;
	gint _tmp10__length1;
	GList* _tmp15_;
	gchar* lang = NULL;
	gchar** _tmp21_;
	gint _tmp21__length1;
	const gchar* _tmp22_;
	gchar* _tmp23_;
	const gchar* _tmp24_;
	gchar* _tmp25_;
	const gchar* _tmp26_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = _tmp0_ = g_get_language_names ();
	_tmp2_ = (_tmp1_ != NULL) ? _vala_array_dup4 (_tmp1_, _vala_array_length (_tmp0_)) : _tmp1_;
	_tmp2__length1 = _vala_array_length (_tmp0_);
	system_langs = _tmp2_;
	system_langs_length1 = _tmp2__length1;
	_system_langs_size_ = system_langs_length1;
	_tmp3_ = g_new0 (gchar*, 0 + 1);
	media_langs = _tmp3_;
	media_langs_length1 = 0;
	_media_langs_size_ = media_langs_length1;
	_tmp4_ = ((BoxesInstallerMedia*) self)->os_media;
	_tmp5_ = osinfo_media_get_languages (_tmp4_);
	_tmp6_ = _tmp5_;
	media_langs_list = _tmp6_;
	_tmp7_ = media_langs_list;
	{
		GList* lang_collection = NULL;
		GList* lang_it = NULL;
		lang_collection = _tmp7_;
		for (lang_it = lang_collection; lang_it != NULL; lang_it = lang_it->next) {
			const gchar* lang = NULL;
			lang = (const gchar*) lang_it->data;
			{
				const gchar* _tmp8_;
				gchar* _tmp9_;
				_tmp8_ = lang;
				_tmp9_ = g_strdup (_tmp8_);
				_vala_array_add11 (&media_langs, &media_langs_length1, &_media_langs_size_, _tmp9_);
			}
		}
	}
	_tmp10_ = system_langs;
	_tmp10__length1 = system_langs_length1;
	{
		gchar** lang_collection = NULL;
		gint lang_collection_length1 = 0;
		gint _lang_collection_size_ = 0;
		gint lang_it = 0;
		lang_collection = _tmp10_;
		lang_collection_length1 = _tmp10__length1;
		for (lang_it = 0; lang_it < lang_collection_length1; lang_it = lang_it + 1) {
			gchar* _tmp11_;
			gchar* lang = NULL;
			_tmp11_ = g_strdup (lang_collection[lang_it]);
			lang = _tmp11_;
			{
				const gchar* _tmp12_;
				gchar** _tmp13_;
				gint _tmp13__length1;
				_tmp12_ = lang;
				_tmp13_ = media_langs;
				_tmp13__length1 = media_langs_length1;
				if (_vala_string_array_contains (_tmp13_, _tmp13__length1, _tmp12_)) {
					const gchar* _tmp14_;
					_tmp14_ = lang;
					g_debug ("unattended-installer.vala:618: matched %s", _tmp14_);
					result = lang;
					(media_langs_list == NULL) ? NULL : (media_langs_list = (g_list_free (media_langs_list), NULL));
					media_langs = (_vala_array_free (media_langs, media_langs_length1, (GDestroyNotify) g_free), NULL);
					system_langs = (_vala_array_free (system_langs, system_langs_length1, (GDestroyNotify) g_free), NULL);
					return result;
				}
				_g_free0 (lang);
			}
		}
	}
	_tmp15_ = media_langs_list;
	if (_tmp15_ != NULL) {
		GList* _tmp16_;
		gconstpointer _tmp17_;
		GList* _tmp18_;
		gconstpointer _tmp19_;
		gchar* _tmp20_;
		_tmp16_ = media_langs_list;
		_tmp17_ = g_list_nth_data (_tmp16_, (guint) 0);
		g_debug ("unattended-installer.vala:624: Failed to match system locales with med" \
"ia languages, falling back to %s media language", (const gchar*) _tmp17_);
		_tmp18_ = media_langs_list;
		_tmp19_ = g_list_nth_data (_tmp18_, (guint) 0);
		_tmp20_ = g_strdup ((const gchar*) _tmp19_);
		result = _tmp20_;
		(media_langs_list == NULL) ? NULL : (media_langs_list = (g_list_free (media_langs_list), NULL));
		media_langs = (_vala_array_free (media_langs, media_langs_length1, (GDestroyNotify) g_free), NULL);
		system_langs = (_vala_array_free (system_langs, system_langs_length1, (GDestroyNotify) g_free), NULL);
		return result;
	}
	_tmp21_ = system_langs;
	_tmp21__length1 = system_langs_length1;
	_tmp22_ = _tmp21_[0];
	_tmp23_ = string_replace (_tmp22_, ".utf8", "");
	lang = _tmp23_;
	_tmp24_ = lang;
	_tmp25_ = string_replace (_tmp24_, ".UTF-8", "");
	_g_free0 (lang);
	lang = _tmp25_;
	_tmp26_ = lang;
	g_debug ("unattended-installer.vala:631: No media language, using %s locale", _tmp26_);
	result = lang;
	(media_langs_list == NULL) ? NULL : (media_langs_list = (g_list_free (media_langs_list), NULL));
	media_langs = (_vala_array_free (media_langs, media_langs_length1, (GDestroyNotify) g_free), NULL);
	system_langs = (_vala_array_free (system_langs, system_langs_length1, (GDestroyNotify) g_free), NULL);
	return result;
}

static GList*
vala_g_list_remove_full (GList* self,
                         gconstpointer data,
                         GFreeFunc func)
{
	GList* l = NULL;
	GList* result;
	l = self;
	while (TRUE) {
		GList* _tmp0_;
		GList* _tmp1_;
		gconstpointer _tmp2_;
		_tmp0_ = l;
		if (!(_tmp0_ != NULL)) {
			break;
		}
		_tmp1_ = l;
		_tmp2_ = ((GList*) _tmp1_)->data;
		if (_tmp2_ != data) {
			GList* _tmp3_;
			GList* _tmp4_;
			_tmp3_ = l;
			_tmp4_ = ((GList*) _tmp3_)->next;
			l = _tmp4_;
		} else {
			GList* _tmp5_;
			gconstpointer _tmp6_;
			GList* _tmp7_;
			_tmp5_ = l;
			_tmp6_ = ((GList*) _tmp5_)->data;
			func (_tmp6_);
			_tmp7_ = l;
			self = g_list_delete_link (self, (GList*) _tmp7_);
			break;
		}
	}
	result = self;
	return result;
}

static void
boxes_unattended_installer_remove_disk_from_domain_config (BoxesUnattendedInstaller* self,
                                                           GVirConfigDomain* domain,
                                                           const gchar* disk_path)
{
	GList* devices = NULL;
	GList* _tmp0_;
	GList* _tmp1_;
	GList* _tmp9_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (domain != NULL);
	g_return_if_fail (disk_path != NULL);
	_tmp0_ = gvir_config_domain_get_devices (domain);
	devices = _tmp0_;
	_tmp1_ = devices;
	{
		GList* device_collection = NULL;
		GList* device_it = NULL;
		device_collection = _tmp1_;
		for (device_it = device_collection; device_it != NULL; device_it = device_it->next) {
			GVirConfigDomainDevice* _tmp2_;
			GVirConfigDomainDevice* device = NULL;
			_tmp2_ = _g_object_ref0 ((GVirConfigDomainDevice*) device_it->data);
			device = _tmp2_;
			{
				GVirConfigDomainDevice* _tmp3_;
				GVirConfigDomainDisk* disk = NULL;
				GVirConfigDomainDevice* _tmp4_;
				GVirConfigDomainDisk* _tmp5_;
				GVirConfigDomainDisk* _tmp6_;
				const gchar* _tmp7_;
				_tmp3_ = device;
				if (!G_TYPE_CHECK_INSTANCE_TYPE (_tmp3_, gvir_config_domain_disk_get_type ())) {
					_g_object_unref0 (device);
					continue;
				}
				_tmp4_ = device;
				_tmp5_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp4_, gvir_config_domain_disk_get_type ()) ? ((GVirConfigDomainDisk*) _tmp4_) : NULL);
				disk = _tmp5_;
				_tmp6_ = disk;
				_tmp7_ = gvir_config_domain_disk_get_source (_tmp6_);
				if (g_strcmp0 (_tmp7_, disk_path) == 0) {
					GVirConfigDomainDevice* _tmp8_;
					_tmp8_ = device;
					devices = vala_g_list_remove_full (devices, _tmp8_, _g_object_unref0_);
					_g_object_unref0 (disk);
					_g_object_unref0 (device);
					break;
				}
				_g_object_unref0 (disk);
				_g_object_unref0 (device);
			}
		}
	}
	_tmp9_ = devices;
	gvir_config_domain_set_devices (domain, _tmp9_);
	(devices == NULL) ? NULL : (devices = (_g_list_free__g_object_unref0_ (devices), NULL));
}

BoxesUnattendedInstaller*
boxes_unattended_installer_construct (GType object_type)
{
	BoxesUnattendedInstaller * self = NULL;
	self = (BoxesUnattendedInstaller*) boxes_installer_media_construct (object_type);
	return self;
}

BoxesUnattendedInstaller*
boxes_unattended_installer_new (void)
{
	return boxes_unattended_installer_construct (BOXES_TYPE_UNATTENDED_INSTALLER);
}

static gboolean
boxes_unattended_installer_real_get_need_user_input_for_vm_creation (BoxesInstallerMedia* base)
{
	gboolean result;
	BoxesUnattendedInstaller* self;
	OsinfoMedia* _tmp0_;
	OsinfoFilter* filter = NULL;
	OsinfoFilter* _tmp1_;
	OsinfoFilter* _tmp2_;
	OsinfoInstallScriptList* install_scripts = NULL;
	OsinfoMedia* _tmp3_;
	OsinfoInstallScriptList* _tmp4_;
	OsinfoInstallScriptList* _tmp5_;
	OsinfoOs* _tmp13_;
	OsinfoInstallScriptList* _tmp14_;
	OsinfoList* osinfo_list = NULL;
	OsinfoInstallScriptList* _tmp15_;
	OsinfoList* _tmp16_;
	OsinfoList* _tmp17_;
	OsinfoFilter* _tmp18_;
	OsinfoList* _tmp19_;
	OsinfoInstallScriptList* _tmp20_;
	OsinfoInstallScriptList* _tmp21_;
	self = (BoxesUnattendedInstaller*) base;
	_tmp0_ = ((BoxesInstallerMedia*) self)->os_media;
	if (!osinfo_media_supports_installer_script (_tmp0_)) {
		result = FALSE;
		return result;
	}
	_tmp1_ = osinfo_filter_new ();
	filter = _tmp1_;
	_tmp2_ = filter;
	osinfo_filter_add_constraint (_tmp2_, OSINFO_INSTALL_SCRIPT_PROP_PROFILE, OSINFO_INSTALL_SCRIPT_PROFILE_DESKTOP);
	_tmp3_ = ((BoxesInstallerMedia*) self)->os_media;
	_tmp4_ = osinfo_media_get_install_script_list (_tmp3_);
	install_scripts = _tmp4_;
	_tmp5_ = install_scripts;
	if (osinfo_list_get_length ((OsinfoList*) _tmp5_) > 0) {
		OsinfoList* osinfo_list = NULL;
		OsinfoInstallScriptList* _tmp6_;
		OsinfoList* _tmp7_;
		OsinfoList* _tmp8_;
		OsinfoFilter* _tmp9_;
		OsinfoList* _tmp10_;
		OsinfoInstallScriptList* _tmp11_;
		OsinfoInstallScriptList* _tmp12_;
		_tmp6_ = install_scripts;
		_tmp7_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp6_, osinfo_list_get_type ()) ? ((OsinfoList*) _tmp6_) : NULL);
		osinfo_list = _tmp7_;
		_tmp8_ = osinfo_list;
		_tmp9_ = filter;
		_tmp10_ = osinfo_list_new_filtered (_tmp8_, _tmp9_);
		_tmp11_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp10_, osinfo_install_scriptlist_get_type ()) ? ((OsinfoInstallScriptList*) _tmp10_) : NULL;
		if (_tmp11_ == NULL) {
			_g_object_unref0 (_tmp10_);
		}
		_g_object_unref0 (install_scripts);
		install_scripts = _tmp11_;
		_tmp12_ = install_scripts;
		if (osinfo_list_get_length ((OsinfoList*) _tmp12_) > 0) {
			result = TRUE;
			_g_object_unref0 (osinfo_list);
			_g_object_unref0 (install_scripts);
			_g_object_unref0 (filter);
			return result;
		}
		result = FALSE;
		_g_object_unref0 (osinfo_list);
		_g_object_unref0 (install_scripts);
		_g_object_unref0 (filter);
		return result;
	}
	_tmp13_ = ((BoxesInstallerMedia*) self)->os;
	_tmp14_ = osinfo_os_get_install_script_list (_tmp13_);
	_g_object_unref0 (install_scripts);
	install_scripts = _tmp14_;
	_tmp15_ = install_scripts;
	_tmp16_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp15_, osinfo_list_get_type ()) ? ((OsinfoList*) _tmp15_) : NULL);
	osinfo_list = _tmp16_;
	_tmp17_ = osinfo_list;
	_tmp18_ = filter;
	_tmp19_ = osinfo_list_new_filtered (_tmp17_, _tmp18_);
	_tmp20_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp19_, osinfo_install_scriptlist_get_type ()) ? ((OsinfoInstallScriptList*) _tmp19_) : NULL;
	if (_tmp20_ == NULL) {
		_g_object_unref0 (_tmp19_);
	}
	_g_object_unref0 (install_scripts);
	install_scripts = _tmp20_;
	_tmp21_ = install_scripts;
	if (osinfo_list_get_length ((OsinfoList*) _tmp21_) > 0) {
		result = TRUE;
		_g_object_unref0 (osinfo_list);
		_g_object_unref0 (install_scripts);
		_g_object_unref0 (filter);
		return result;
	}
	result = FALSE;
	_g_object_unref0 (osinfo_list);
	_g_object_unref0 (install_scripts);
	_g_object_unref0 (filter);
	return result;
}

static OsinfoDeviceList*
boxes_unattended_installer_real_get_supported_devices (BoxesInstallerMedia* base)
{
	OsinfoDeviceList* result;
	BoxesUnattendedInstaller* self;
	OsinfoDeviceList* devices = NULL;
	OsinfoDeviceList* _tmp0_;
	OsinfoList* osinfo_list = NULL;
	OsinfoList* _tmp1_;
	OsinfoDeviceList* _tmp2_;
	OsinfoList* _tmp3_;
	OsinfoDeviceList* _tmp4_;
	self = (BoxesUnattendedInstaller*) base;
	_tmp0_ = BOXES_INSTALLER_MEDIA_CLASS (boxes_unattended_installer_parent_class)->get_supported_devices (G_TYPE_CHECK_INSTANCE_CAST (self, BOXES_TYPE_INSTALLER_MEDIA, BoxesInstallerMedia));
	devices = _tmp0_;
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (devices, osinfo_list_get_type ()) ? ((OsinfoList*) devices) : NULL);
	osinfo_list = _tmp1_;
	_tmp2_ = self->priv->additional_devices;
	_tmp3_ = osinfo_list_new_union (osinfo_list, (OsinfoList*) _tmp2_);
	_tmp4_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp3_, osinfo_devicelist_get_type ()) ? ((OsinfoDeviceList*) _tmp3_) : NULL;
	if (_tmp4_ == NULL) {
		_g_object_unref0 (_tmp3_);
	}
	result = _tmp4_;
	_g_object_unref0 (osinfo_list);
	_g_object_unref0 (devices);
	return result;
}

gboolean
boxes_unattended_installer_get_needs_password (BoxesUnattendedInstaller* self)
{
	gboolean result;
	OsinfoInstallScriptList* _tmp0_;
	GList* _tmp1_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->scripts;
	_tmp1_ = osinfo_list_get_elements ((OsinfoList*) _tmp0_);
	{
		GList* s_collection = NULL;
		GList* s_it = NULL;
		s_collection = _tmp1_;
		for (s_it = s_collection; s_it != NULL; s_it = s_it->next) {
			OsinfoEntity* s = NULL;
			s = (OsinfoEntity*) s_it->data;
			{
				OsinfoInstallScript* script = NULL;
				OsinfoEntity* _tmp2_;
				OsinfoInstallScript* _tmp3_;
				OsinfoInstallConfigParam* param = NULL;
				OsinfoInstallScript* _tmp4_;
				OsinfoInstallConfigParam* _tmp5_;
				gboolean _tmp6_ = FALSE;
				OsinfoInstallConfigParam* _tmp7_;
				_tmp2_ = s;
				_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, osinfo_install_script_get_type ()) ? ((OsinfoInstallScript*) _tmp2_) : NULL);
				script = _tmp3_;
				_tmp4_ = script;
				_tmp5_ = osinfo_install_script_get_config_param (_tmp4_, OSINFO_INSTALL_CONFIG_PROP_USER_PASSWORD);
				param = _tmp5_;
				_tmp7_ = param;
				if (_tmp7_ == NULL) {
					_tmp6_ = TRUE;
				} else {
					OsinfoInstallConfigParam* _tmp8_;
					_tmp8_ = param;
					_tmp6_ = osinfo_install_config_param_is_optional (_tmp8_);
				}
				if (_tmp6_) {
					result = FALSE;
					_g_object_unref0 (param);
					_g_object_unref0 (script);
					(s_collection == NULL) ? NULL : (s_collection = (g_list_free (s_collection), NULL));
					return result;
				}
				_g_object_unref0 (param);
				_g_object_unref0 (script);
			}
		}
		(s_collection == NULL) ? NULL : (s_collection = (g_list_free (s_collection), NULL));
	}
	result = TRUE;
	return result;
}

static OsinfoInstallScriptInjectionMethod
boxes_unattended_installer_get_injection_method (BoxesUnattendedInstaller* self)
{
	OsinfoInstallScriptInjectionMethod result;
	GList* _tmp0_;
	g_return_val_if_fail (self != NULL, 0U);
	_tmp0_ = self->priv->unattended_files;
	{
		GList* unattended_file_collection = NULL;
		GList* unattended_file_it = NULL;
		unattended_file_collection = _tmp0_;
		for (unattended_file_it = unattended_file_collection; unattended_file_it != NULL; unattended_file_it = unattended_file_it->next) {
			BoxesUnattendedFile* _tmp1_;
			BoxesUnattendedFile* unattended_file = NULL;
			_tmp1_ = _g_object_ref0 ((BoxesUnattendedFile*) unattended_file_it->data);
			unattended_file = _tmp1_;
			{
				BoxesUnattendedFile* _tmp2_;
				_tmp2_ = unattended_file;
				if (BOXES_IS_UNATTENDED_SCRIPT_FILE (_tmp2_)) {
					BoxesUnattendedScriptFile* unattended_script_file = NULL;
					BoxesUnattendedFile* _tmp3_;
					BoxesUnattendedScriptFile* _tmp4_;
					BoxesUnattendedScriptFile* _tmp5_;
					OsinfoInstallScriptInjectionMethod _tmp6_;
					OsinfoInstallScriptInjectionMethod _tmp7_;
					_tmp3_ = unattended_file;
					_tmp4_ = _g_object_ref0 (BOXES_IS_UNATTENDED_SCRIPT_FILE (_tmp3_) ? ((BoxesUnattendedScriptFile*) _tmp3_) : NULL);
					unattended_script_file = _tmp4_;
					_tmp5_ = unattended_script_file;
					_tmp6_ = boxes_unattended_script_file_get_injection_method (_tmp5_);
					_tmp7_ = _tmp6_;
					result = _tmp7_;
					_g_object_unref0 (unattended_script_file);
					_g_object_unref0 (unattended_file);
					return result;
				}
				_g_object_unref0 (unattended_file);
			}
		}
	}
	result = OSINFO_INSTALL_SCRIPT_INJECTION_METHOD_DISK;
	return result;
}

static void
boxes_unattended_installer_class_init (BoxesUnattendedInstallerClass * klass,
                                       gpointer klass_data)
{
	boxes_unattended_installer_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &BoxesUnattendedInstaller_private_offset);
	((BoxesInstallerMediaClass *) klass)->prepare_to_continue_installation = (void (*) (BoxesInstallerMedia*, const gchar*)) boxes_unattended_installer_real_prepare_to_continue_installation;
	((BoxesInstallerMediaClass *) klass)->prepare_for_installation = (void (*) (BoxesInstallerMedia*, const gchar*, GCancellable*, GAsyncReadyCallback, gpointer)) boxes_unattended_installer_real_prepare_for_installation;
	((BoxesInstallerMediaClass *) klass)->prepare_for_installation_finish = (void (*) (BoxesInstallerMedia*, GAsyncResult*)) boxes_unattended_installer_prepare_for_installation_finish;
	((BoxesInstallerMediaClass *) klass)->setup_domain_config = (void (*) (BoxesInstallerMedia*, GVirConfigDomain*)) boxes_unattended_installer_real_setup_domain_config;
	((BoxesInstallerMediaClass *) klass)->setup_post_install_domain_config = (void (*) (BoxesInstallerMedia*, GVirConfigDomain*)) boxes_unattended_installer_real_setup_post_install_domain_config;
	((BoxesInstallerMediaClass *) klass)->set_direct_boot_params = (void (*) (BoxesInstallerMedia*, GVirConfigDomainOs*)) boxes_unattended_installer_real_set_direct_boot_params;
	((BoxesInstallerMediaClass *) klass)->clean_up = (void (*) (BoxesInstallerMedia*)) boxes_unattended_installer_real_clean_up;
	((BoxesInstallerMediaClass *) klass)->clean_up_preparation_cache = (void (*) (BoxesInstallerMedia*)) boxes_unattended_installer_real_clean_up_preparation_cache;
	((BoxesInstallerMediaClass *) klass)->prepare = (void (*) (BoxesInstallerMedia*, BoxesActivityProgress*, GCancellable*, GAsyncReadyCallback, gpointer)) boxes_unattended_installer_real_prepare;
	((BoxesInstallerMediaClass *) klass)->prepare_finish = (gboolean (*) (BoxesInstallerMedia*, GAsyncResult*)) boxes_unattended_installer_prepare_finish;
	BOXES_INSTALLER_MEDIA_CLASS (klass)->get_need_user_input_for_vm_creation = (gboolean (*) (BoxesInstallerMedia*)) boxes_unattended_installer_real_get_need_user_input_for_vm_creation;
	BOXES_INSTALLER_MEDIA_CLASS (klass)->get_supported_devices = (OsinfoDeviceList* (*) (BoxesInstallerMedia*)) boxes_unattended_installer_real_get_supported_devices;
	G_OBJECT_CLASS (klass)->get_property = _vala_boxes_unattended_installer_get_property;
	G_OBJECT_CLASS (klass)->finalize = boxes_unattended_installer_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_UNATTENDED_INSTALLER_NEED_USER_INPUT_FOR_VM_CREATION_PROPERTY, boxes_unattended_installer_properties[BOXES_UNATTENDED_INSTALLER_NEED_USER_INPUT_FOR_VM_CREATION_PROPERTY] = g_param_spec_boolean ("need-user-input-for-vm-creation", "need-user-input-for-vm-creation", "need-user-input-for-vm-creation", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_UNATTENDED_INSTALLER_SUPPORTED_DEVICES_PROPERTY, boxes_unattended_installer_properties[BOXES_UNATTENDED_INSTALLER_SUPPORTED_DEVICES_PROPERTY] = g_param_spec_object ("supported-devices", "supported-devices", "supported-devices", osinfo_devicelist_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), BOXES_UNATTENDED_INSTALLER_NEEDS_PASSWORD_PROPERTY, boxes_unattended_installer_properties[BOXES_UNATTENDED_INSTALLER_NEEDS_PASSWORD_PROPERTY] = g_param_spec_boolean ("needs-password", "needs-password", "needs-password", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
boxes_unattended_installer_instance_init (BoxesUnattendedInstaller * self,
                                          gpointer klass)
{
	self->priv = boxes_unattended_installer_get_instance_private (self);
	self->priv->driver_signing = TRUE;
}

static void
boxes_unattended_installer_finalize (GObject * obj)
{
	BoxesUnattendedInstaller * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BOXES_TYPE_UNATTENDED_INSTALLER, BoxesUnattendedInstaller);
	_g_object_unref0 (self->disk_file);
	_g_object_unref0 (self->kernel_file);
	_g_object_unref0 (self->initrd_file);
	_g_object_unref0 (self->config);
	_g_object_unref0 (self->scripts);
	(self->priv->unattended_files == NULL) ? NULL : (self->priv->unattended_files = (_g_list_free__g_object_unref0_ (self->priv->unattended_files), NULL));
	(self->priv->secondary_unattended_files == NULL) ? NULL : (self->priv->secondary_unattended_files = (_g_list_free__g_object_unref0_ (self->priv->secondary_unattended_files), NULL));
	_g_free0 (self->priv->timezone);
	_g_free0 (self->priv->lang);
	_g_free0 (self->priv->hostname);
	_g_free0 (self->priv->kbd);
	_g_object_unref0 (self->priv->additional_devices);
	_g_free0 (self->username);
	_g_free0 (self->password);
	_g_free0 (self->product_key);
	G_OBJECT_CLASS (boxes_unattended_installer_parent_class)->finalize (obj);
}

static GType
boxes_unattended_installer_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BoxesUnattendedInstallerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) boxes_unattended_installer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BoxesUnattendedInstaller), 0, (GInstanceInitFunc) boxes_unattended_installer_instance_init, NULL };
	GType boxes_unattended_installer_type_id;
	boxes_unattended_installer_type_id = g_type_register_static (BOXES_TYPE_INSTALLER_MEDIA, "BoxesUnattendedInstaller", &g_define_type_info, 0);
	BoxesUnattendedInstaller_private_offset = g_type_add_instance_private (boxes_unattended_installer_type_id, sizeof (BoxesUnattendedInstallerPrivate));
	return boxes_unattended_installer_type_id;
}

GType
boxes_unattended_installer_get_type (void)
{
	static volatile gsize boxes_unattended_installer_type_id__once = 0;
	if (g_once_init_enter (&boxes_unattended_installer_type_id__once)) {
		GType boxes_unattended_installer_type_id;
		boxes_unattended_installer_type_id = boxes_unattended_installer_get_type_once ();
		g_once_init_leave (&boxes_unattended_installer_type_id__once, boxes_unattended_installer_type_id);
	}
	return boxes_unattended_installer_type_id__once;
}

static void
_vala_boxes_unattended_installer_get_property (GObject * object,
                                               guint property_id,
                                               GValue * value,
                                               GParamSpec * pspec)
{
	BoxesUnattendedInstaller * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, BOXES_TYPE_UNATTENDED_INSTALLER, BoxesUnattendedInstaller);
	switch (property_id) {
		case BOXES_UNATTENDED_INSTALLER_NEED_USER_INPUT_FOR_VM_CREATION_PROPERTY:
		g_value_set_boolean (value, boxes_installer_media_get_need_user_input_for_vm_creation ((BoxesInstallerMedia*) self));
		break;
		case BOXES_UNATTENDED_INSTALLER_SUPPORTED_DEVICES_PROPERTY:
		g_value_take_object (value, boxes_installer_media_get_supported_devices ((BoxesInstallerMedia*) self));
		break;
		case BOXES_UNATTENDED_INSTALLER_NEEDS_PASSWORD_PROPERTY:
		g_value_set_boolean (value, boxes_unattended_installer_get_needs_password (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

