VirtualBox

source: vbox/trunk/src/VBox/Main/include/UnattendedImpl.h@ 68222

Last change on this file since 68222 was 68164, checked in by vboxsync, 7 years ago

Unattended: Changed boot order to work around DVD eject issues with fedora 26, HD is now first DVD/flpppy next (assuming HD isn't bootable till after first installation reboot). Expose IMachine::RTCUseUTC setting to the script templates. Post install fixes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.7 KB
Line 
1/* $Id: UnattendedImpl.h 68164 2017-07-28 20:59:17Z vboxsync $ */
2/** @file
3 * Unattended class header
4 */
5
6/*
7 * Copyright (C) 2006-2017 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ____H_UNATTENDED
19#define ____H_UNATTENDED
20
21#include <VBox/ostypes.h>
22#include <iprt/time.h>
23#include "UnattendedWrap.h"
24
25/* Forward declarations. */
26class UnattendedInstaller;
27struct UnattendedInstallationDisk;
28struct ControllerSlot;
29
30
31/**
32 * Class implementing the IUnattended interface.
33 *
34 * This class is instantiated on the request by IMachine::getUnattended.
35 */
36class ATL_NO_VTABLE Unattended
37 : public UnattendedWrap
38{
39public:
40 DECLARE_EMPTY_CTOR_DTOR(Unattended)
41
42 HRESULT FinalConstruct();
43 void FinalRelease();
44
45 // public initializer/uninitializer for internal purposes only
46 HRESULT initUnattended(VirtualBox *aParent);
47 void uninit();
48
49 // public methods for internal purposes
50 Utf8Str const &i_getIsoPath() const;
51 Utf8Str const &i_getUser() const;
52 Utf8Str const &i_getPassword() const;
53 Utf8Str const &i_getFullUserName() const;
54 Utf8Str const &i_getProductKey() const;
55 Utf8Str const &i_getAdditionsIsoPath() const;
56 bool i_getInstallGuestAdditions() const;
57 Utf8Str const &i_getValidationKitIsoPath() const;
58 bool i_getInstallTestExecService() const;
59 Utf8Str const &i_getTimeZone() const;
60 PCRTTIMEZONEINFO i_getTimeZoneInfo() const;
61 Utf8Str const &i_getLocale() const;
62 Utf8Str const &i_getCountry() const;
63 bool i_isMinimalInstallation() const;
64 Utf8Str const &i_getHostname() const;
65 Utf8Str const &i_getAuxiliaryBasePath() const;
66 ULONG i_getImageIndex() const;
67 Utf8Str const &i_getScriptTemplatePath() const;
68 Utf8Str const &i_getPostInstallScriptTemplatePath() const;
69 Utf8Str const &i_getPostInstallCommand() const;
70 Utf8Str const &i_getExtraInstallKernelParameters() const;
71
72 bool i_isRtcUsingUtc() const;
73 bool i_isGuestOs64Bit() const;
74 VBOXOSTYPE i_getGuestOsType() const;
75
76
77private:
78 ComPtr<VirtualBox> const mParent; /**< Strong reference to the parent object (VirtualBox/IMachine). */
79 ComPtr<Machine> mMachine; /**< Strong reference to the machine object (Machine/IMachine). */
80 Guid mMachineUuid; /**< The machine UUID. */
81 RTNATIVETHREAD mhThreadReconfigureVM; /**< Set when reconfigureVM is running. */
82 Utf8Str mStrGuestOsTypeId; /**< Guest OS type ID (set by prepare). */
83 bool mfRtcUseUtc; /**< Copy of IMachine::RTCUseUTC (locking reasons). */
84 bool mfGuestOs64Bit; /**< 64-bit (true) or 32-bit guest OS (set by prepare). */
85 VBOXOSTYPE meGuestOsType; /**< The guest OS type (set by prepare). */
86 UnattendedInstaller *mpInstaller; /**< The installer instance (set by prepare, deleted by done). */
87
88 /** @name Values of the IUnattended attributes.
89 * @{ */
90 Utf8Str mStrUser;
91 Utf8Str mStrPassword;
92 Utf8Str mStrFullUserName;
93 Utf8Str mStrProductKey;
94 Utf8Str mStrIsoPath;
95 Utf8Str mStrAdditionsIsoPath;
96 bool mfInstallGuestAdditions;
97 bool mfInstallTestExecService;
98 Utf8Str mStrValidationKitIsoPath;
99 Utf8Str mStrTimeZone;
100 PCRTTIMEZONEINFO mpTimeZoneInfo;
101 Utf8Str mStrLocale;
102 Utf8Str mStrCountry;
103 RTCList<RTCString, RTCString *> mPackageSelectionAdjustments;
104 Utf8Str mStrHostname;
105 Utf8Str mStrAuxiliaryBasePath;
106 bool mfIsDefaultAuxiliaryBasePath;
107 ULONG midxImage;
108 Utf8Str mStrScriptTemplatePath;
109 Utf8Str mStrPostInstallScriptTemplatePath;
110 Utf8Str mStrPostInstallCommand;
111 Utf8Str mStrExtraInstallKernelParameters;
112 Utf8Str mStrDetectedOSTypeId;
113 Utf8Str mStrDetectedOSVersion;
114 Utf8Str mStrDetectedOSFlavor;
115 Utf8Str mStrDetectedOSHints;
116 /** @} */
117
118 // wrapped IUnattended functions:
119
120 /**
121 * Checks what mStrIsoPath points to and sets the detectedOS* properties.
122 */
123 HRESULT detectIsoOS();
124
125 /**
126 * Prepare any data, environment, etc.
127 */
128 HRESULT prepare();
129
130 /**
131 * Prepare installation ISO/floppy.
132 */
133 HRESULT constructMedia();
134
135 /**
136 * Prepare a VM to run an unattended installation
137 */
138 HRESULT reconfigureVM();
139
140 /**
141 * Done with all media construction and VM configuration and stuff.
142 */
143 HRESULT done();
144
145 // wrapped IUnattended attributes:
146 HRESULT getIsoPath(com::Utf8Str &isoPath);
147 HRESULT setIsoPath(const com::Utf8Str &isoPath);
148 HRESULT getUser(com::Utf8Str &user);
149 HRESULT setUser(const com::Utf8Str &user);
150 HRESULT getPassword(com::Utf8Str &password);
151 HRESULT setPassword(const com::Utf8Str &password);
152 HRESULT getFullUserName(com::Utf8Str &user);
153 HRESULT setFullUserName(const com::Utf8Str &user);
154 HRESULT getProductKey(com::Utf8Str &productKey);
155 HRESULT setProductKey(const com::Utf8Str &productKey);
156 HRESULT getAdditionsIsoPath(com::Utf8Str &additionsIsoPath);
157 HRESULT setAdditionsIsoPath(const com::Utf8Str &additionsIsoPath);
158 HRESULT getInstallGuestAdditions(BOOL *installGuestAdditions);
159 HRESULT setInstallGuestAdditions(BOOL installGuestAdditions);
160 HRESULT getValidationKitIsoPath(com::Utf8Str &aValidationKitIsoPath);
161 HRESULT setValidationKitIsoPath(const com::Utf8Str &aValidationKitIsoPath);
162 HRESULT getInstallTestExecService(BOOL *aInstallTestExecService);
163 HRESULT setInstallTestExecService(BOOL aInstallTestExecService);
164 HRESULT getTimeZone(com::Utf8Str &aTimezone);
165 HRESULT setTimeZone(const com::Utf8Str &aTimezone);
166 HRESULT getLocale(com::Utf8Str &aLocale);
167 HRESULT setLocale(const com::Utf8Str &aLocale);
168 HRESULT getCountry(com::Utf8Str &aCountry);
169 HRESULT setCountry(const com::Utf8Str &aCountry);
170 HRESULT getProxy(com::Utf8Str &aProxy);
171 HRESULT setProxy(const com::Utf8Str &aProxy);
172 HRESULT getPackageSelectionAdjustments(com::Utf8Str &aPackageSelectionAdjustments);
173 HRESULT setPackageSelectionAdjustments(const com::Utf8Str &aPackageSelectionAdjustments);
174 HRESULT getHostname(com::Utf8Str &aHostname);
175 HRESULT setHostname(const com::Utf8Str &aHostname);
176 HRESULT getAuxiliaryBasePath(com::Utf8Str &aAuxiliaryBasePath);
177 HRESULT setAuxiliaryBasePath(const com::Utf8Str &aAuxiliaryBasePath);
178 HRESULT getImageIndex(ULONG *index);
179 HRESULT setImageIndex(ULONG index);
180 HRESULT getMachine(ComPtr<IMachine> &aMachine);
181 HRESULT setMachine(const ComPtr<IMachine> &aMachine);
182 HRESULT getScriptTemplatePath(com::Utf8Str &aScriptTemplatePath);
183 HRESULT setScriptTemplatePath(const com::Utf8Str &aScriptTemplatePath);
184 HRESULT getPostInstallScriptTemplatePath(com::Utf8Str &aPostInstallScriptTemplatePath);
185 HRESULT setPostInstallScriptTemplatePath(const com::Utf8Str &aPostInstallScriptTemplatePath);
186 HRESULT getPostInstallCommand(com::Utf8Str &aPostInstallCommand);
187 HRESULT setPostInstallCommand(const com::Utf8Str &aPostInstallCommand);
188 HRESULT getExtraInstallKernelParameters(com::Utf8Str &aExtraInstallKernelParameters);
189 HRESULT setExtraInstallKernelParameters(const com::Utf8Str &aExtraInstallKernelParameters);
190 HRESULT getDetectedOSTypeId(com::Utf8Str &aDetectedOSTypeId);
191 HRESULT getDetectedOSVersion(com::Utf8Str &aDetectedOSVersion);
192 HRESULT getDetectedOSFlavor(com::Utf8Str &aDetectedOSFlavor);
193 HRESULT getDetectedOSHints(com::Utf8Str &aDetectedOSHints);
194 //internal functions
195
196 /**
197 * Worker for reconfigureVM.
198 * The caller makes sure to close the session whatever happens.
199 */
200 HRESULT i_innerReconfigureVM(AutoMultiWriteLock2 &rAutoLock, StorageBus_T enmRecommendedStorageBus,
201 ComPtr<IMachine> const &rPtrSessionMachine);
202 HRESULT i_reconfigureFloppy(com::SafeIfaceArray<IStorageController> &rControllers,
203 std::vector<UnattendedInstallationDisk> &rVecInstallatationDisks,
204 ComPtr<IMachine> const &rPtrSessionMachine,
205 AutoMultiWriteLock2 &rAutoLock);
206 HRESULT i_reconfigureIsos(com::SafeIfaceArray<IStorageController> &rControllers,
207 std::vector<UnattendedInstallationDisk> &rVecInstallatationDisks,
208 ComPtr<IMachine> const &rPtrSessionMachine,
209 AutoMultiWriteLock2 &rAutoLock, StorageBus_T enmRecommendedStorageBus);
210
211 /**
212 * Adds all free slots on the controller to @a rOutput.
213 */
214 HRESULT i_findOrCreateNeededFreeSlots(const Utf8Str &rStrControllerName, StorageBus_T enmStorageBus,
215 ComPtr<IMachine> const &rPtrSessionMachine, uint32_t cSlotsNeeded,
216 std::list<ControllerSlot> &rDvdSlots);
217
218 /**
219 * Attach to VM a disk
220 */
221 HRESULT i_attachImage(UnattendedInstallationDisk const *pImage, ComPtr<IMachine> const &rPtrSessionMachine,
222 AutoMultiWriteLock2 &rLock);
223
224 /*
225 * Wrapper functions
226 */
227
228 /**
229 * Check whether guest is 64bit platform or not
230 */
231 bool i_isGuestOSArchX64(Utf8Str const &rStrGuestOsTypeId);
232};
233
234#endif // !____H_UNATTENDED
235
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette