1 | /* $Id: UnattendedInstaller.h 84564 2020-05-27 14:10:26Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * UnattendedInstaller class header
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2020 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 MAIN_INCLUDED_UnattendedInstaller_h
|
---|
19 | #define MAIN_INCLUDED_UnattendedInstaller_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #include "UnattendedScript.h"
|
---|
25 |
|
---|
26 | /* Forward declarations */
|
---|
27 | class Unattended;
|
---|
28 | class UnattendedInstaller;
|
---|
29 | class BaseTextScript;
|
---|
30 |
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * The abstract UnattendedInstaller class declaration
|
---|
34 | *
|
---|
35 | * The class is intended to service a new VM that this VM will be able to
|
---|
36 | * execute an unattended installation
|
---|
37 | */
|
---|
38 | class UnattendedInstaller : public RTCNonCopyable
|
---|
39 | {
|
---|
40 | /*data*/
|
---|
41 | protected:
|
---|
42 | /** Main unattended installation script. */
|
---|
43 | UnattendedScriptTemplate mMainScript;
|
---|
44 | /** Full path to the main template file (set by initInstaller). */
|
---|
45 | Utf8Str mStrMainScriptTemplate;
|
---|
46 |
|
---|
47 | /** Post installation (shell) script. */
|
---|
48 | UnattendedScriptTemplate mPostScript;
|
---|
49 | /** Full path to the post template file (set by initInstaller). */
|
---|
50 | Utf8Str mStrPostScriptTemplate;
|
---|
51 |
|
---|
52 | /** Pointer to the parent object.
|
---|
53 | * We use this for setting errors and querying attributes. */
|
---|
54 | Unattended *mpParent;
|
---|
55 | /** The path of the extra ISO image we create (set by initInstaller).
|
---|
56 | * This is only valid when isAdditionsIsoNeeded() returns true. */
|
---|
57 | Utf8Str mStrAuxiliaryIsoFilePath;
|
---|
58 | /** The path of the extra floppy image we create (set by initInstaller)
|
---|
59 | * This is only valid when isAdditionsFloppyNeeded() returns true. */
|
---|
60 | Utf8Str mStrAuxiliaryFloppyFilePath;
|
---|
61 | /** The boot device. */
|
---|
62 | DeviceType_T const meBootDevice;
|
---|
63 | /** Default extra install kernel parameters (set by constructor).
|
---|
64 | * This can be overridden by the extraInstallKernelParameters attribute of
|
---|
65 | * IUnattended. */
|
---|
66 | Utf8Str mStrDefaultExtraInstallKernelParameters;
|
---|
67 |
|
---|
68 | private:
|
---|
69 | UnattendedInstaller(); /* no default constructors */
|
---|
70 |
|
---|
71 | public:
|
---|
72 | /**
|
---|
73 | * Regular constructor.
|
---|
74 | *
|
---|
75 | * @param pParent The parent object. Used for setting
|
---|
76 | * errors and querying attributes.
|
---|
77 | * @param pszMainScriptTemplateName The name of the template file (no path)
|
---|
78 | * for the main unattended installer
|
---|
79 | * script.
|
---|
80 | * @param pszPostScriptTemplateName The name of the template file (no path)
|
---|
81 | * for the post installation script.
|
---|
82 | * @param pszMainScriptFilename The main unattended installer script
|
---|
83 | * filename (on aux media).
|
---|
84 | * @param pszPostScriptFilename The post installation script filename
|
---|
85 | * (on aux media).
|
---|
86 | * @param enmBootDevice The boot device type.
|
---|
87 | */
|
---|
88 | UnattendedInstaller(Unattended *pParent,
|
---|
89 | const char *pszMainScriptTemplateName, const char *pszPostScriptTemplateName,
|
---|
90 | const char *pszMainScriptFilename, const char *pszPostScriptFilename,
|
---|
91 | DeviceType_T enmBootDevice = DeviceType_DVD);
|
---|
92 | virtual ~UnattendedInstaller();
|
---|
93 |
|
---|
94 | /**
|
---|
95 | * Instantiates the appropriate child class.
|
---|
96 | *
|
---|
97 | * @returns Pointer to the new instance, NULL if no appropriate installer.
|
---|
98 | * @param enmOsType The guest OS type value.
|
---|
99 | * @param strGuestOsType The guest OS type string
|
---|
100 | * @param strDetectedOSVersion The detected guest OS version.
|
---|
101 | * @param strDetectedOSFlavor The detected guest OS flavor.
|
---|
102 | * @param strDetectedOSHints Hints about the detected guest OS.
|
---|
103 | * @param pParent The parent object. Used for setting errors
|
---|
104 | * and querying attributes.
|
---|
105 | * @throws std::bad_alloc
|
---|
106 | */
|
---|
107 | static UnattendedInstaller *createInstance(VBOXOSTYPE enmOsType, const Utf8Str &strGuestOsType,
|
---|
108 | const Utf8Str &strDetectedOSVersion, const Utf8Str &strDetectedOSFlavor,
|
---|
109 | const Utf8Str &strDetectedOSHints, Unattended *pParent);
|
---|
110 |
|
---|
111 | /**
|
---|
112 | * Initialize the installer.
|
---|
113 | *
|
---|
114 | * @note This is called immediately after instantiation and the caller will
|
---|
115 | * always destroy the unattended installer instance on failure, so it
|
---|
116 | * is not necessary to keep track of whether this succeeded or not.
|
---|
117 | */
|
---|
118 | virtual HRESULT initInstaller();
|
---|
119 |
|
---|
120 | #if 0 /* These are now in the AUX VISO. */
|
---|
121 | /**
|
---|
122 | * Whether the VBox Guest Additions ISO is needed or not.
|
---|
123 | *
|
---|
124 | * The default implementation always returns false when a VISO is used, see
|
---|
125 | * UnattendedInstaller::addFilesToAuxVisoVectors.
|
---|
126 | */
|
---|
127 | virtual bool isAdditionsIsoNeeded() const;
|
---|
128 |
|
---|
129 | /**
|
---|
130 | * Whether the VBox validation kit ISO is needed or not.
|
---|
131 | *
|
---|
132 | * The default implementation always returns false when a VISO is used, see
|
---|
133 | * UnattendedInstaller::addFilesToAuxVisoVectors.
|
---|
134 | */
|
---|
135 | virtual bool isValidationKitIsoNeeded() const;
|
---|
136 | #endif
|
---|
137 |
|
---|
138 | /**
|
---|
139 | * Indicates whether an original installation ISO is needed or not.
|
---|
140 | */
|
---|
141 | virtual bool isOriginalIsoNeeded() const { return true; }
|
---|
142 |
|
---|
143 | /**
|
---|
144 | * Indicates whether a floppy image is needed or not.
|
---|
145 | */
|
---|
146 | virtual bool isAuxiliaryFloppyNeeded() const { return false; }
|
---|
147 |
|
---|
148 | /**
|
---|
149 | * Indicates whether an additional or replacement ISO image is needed or not.
|
---|
150 | */
|
---|
151 | virtual bool isAuxiliaryIsoNeeded() const;
|
---|
152 |
|
---|
153 | /**
|
---|
154 | * Indicates whether we should boot from the auxiliary ISO image.
|
---|
155 | *
|
---|
156 | * Will boot from installation ISO if false.
|
---|
157 | */
|
---|
158 | virtual bool bootFromAuxiliaryIso() const { return isAuxiliaryIsoNeeded(); }
|
---|
159 |
|
---|
160 | /**
|
---|
161 | * Indicates whether a the auxiliary ISO is a .viso-file rather than an
|
---|
162 | * .iso-file.
|
---|
163 | *
|
---|
164 | * Different worker methods are used depending on the return value. A
|
---|
165 | * .viso-file is generally only used when the installation media needs to
|
---|
166 | * be remastered with small changes and additions.
|
---|
167 | */
|
---|
168 | virtual bool isAuxiliaryIsoIsVISO() const { return true; }
|
---|
169 |
|
---|
170 | /*
|
---|
171 | * Getters
|
---|
172 | */
|
---|
173 | DeviceType_T getBootableDeviceType() const { return meBootDevice; }
|
---|
174 | const Utf8Str &getTemplateFilePath() const { return mStrMainScriptTemplate; }
|
---|
175 | const Utf8Str &getPostTemplateFilePath() const { return mStrPostScriptTemplate; }
|
---|
176 | const Utf8Str &getAuxiliaryIsoFilePath() const { return mStrAuxiliaryIsoFilePath; }
|
---|
177 | const Utf8Str &getAuxiliaryFloppyFilePath() const { return mStrAuxiliaryFloppyFilePath; }
|
---|
178 | const Utf8Str &getDefaultExtraInstallKernelParameters() const { return mStrDefaultExtraInstallKernelParameters; }
|
---|
179 |
|
---|
180 | /*
|
---|
181 | * Setters
|
---|
182 | */
|
---|
183 | void setTemplatePath(const Utf8Str& data); /**< @todo r=bird: This is confusing as heck. Dir for a while, then it's a file. Not a comment about it. Brilliant. */
|
---|
184 |
|
---|
185 | /**
|
---|
186 | * Prepares the unattended scripts, does all but write them to the installation
|
---|
187 | * media.
|
---|
188 | */
|
---|
189 | HRESULT prepareUnattendedScripts();
|
---|
190 |
|
---|
191 | /**
|
---|
192 | * Prepares the media - floppy image, ISO image.
|
---|
193 | *
|
---|
194 | * This method calls prepareAuxFloppyImage() and prepareAuxIsoImage(), child
|
---|
195 | * classes may override these methods or methods they call.
|
---|
196 | *
|
---|
197 | * @returns COM status code.
|
---|
198 | * @param fOverwrite Whether to overwrite media files or fail if they
|
---|
199 | * already exist.
|
---|
200 | */
|
---|
201 | HRESULT prepareMedia(bool fOverwrite = true);
|
---|
202 |
|
---|
203 | protected:
|
---|
204 | /**
|
---|
205 | * Prepares (creates) the auxiliary floppy image.
|
---|
206 | *
|
---|
207 | * This is called by the base class prepareMedia() when
|
---|
208 | * isAuxiliaryFloppyNeeded() is true. The base class implementation puts the
|
---|
209 | * edited unattended script onto it.
|
---|
210 | */
|
---|
211 | HRESULT prepareAuxFloppyImage(bool fOverwrite);
|
---|
212 |
|
---|
213 | /**
|
---|
214 | * Creates and formats (FAT12) a floppy image, then opens a VFS for it.
|
---|
215 | *
|
---|
216 | * @returns COM status code.
|
---|
217 | * @param pszFilename The path to the image file.
|
---|
218 | * @param fOverwrite Whether to overwrite the file.
|
---|
219 | * @param phVfs Where to return a writable VFS handle to the newly
|
---|
220 | * created image.
|
---|
221 | */
|
---|
222 | HRESULT newAuxFloppyImage(const char *pszFilename, bool fOverwrite, PRTVFS phVfs);
|
---|
223 |
|
---|
224 | /**
|
---|
225 | * Copies files to the auxiliary floppy image.
|
---|
226 | *
|
---|
227 | * The base class implementation copies the main and post scripts to the root of
|
---|
228 | * the floppy using the default script names. Child classes may override this
|
---|
229 | * to add additional or different files.
|
---|
230 | *
|
---|
231 | * @returns COM status code.
|
---|
232 | * @param hVfs The floppy image VFS handle.
|
---|
233 | */
|
---|
234 | virtual HRESULT copyFilesToAuxFloppyImage(RTVFS hVfs);
|
---|
235 |
|
---|
236 | /**
|
---|
237 | * Adds the given script to the root of the floppy image under the default
|
---|
238 | * script filename.
|
---|
239 | *
|
---|
240 | * @returns COM status code.
|
---|
241 | * @param pEditor The script to add.
|
---|
242 | * @param hVfs The VFS to add it to.
|
---|
243 | */
|
---|
244 | HRESULT addScriptToFloppyImage(BaseTextScript *pEditor, RTVFS hVfs);
|
---|
245 |
|
---|
246 | /**
|
---|
247 | * Prepares (creates) the auxiliary ISO image.
|
---|
248 | *
|
---|
249 | * This is called by the base class prepareMedia() when isAuxiliaryIsoNeeded()
|
---|
250 | * is true. The base class implementation puts the edited unattended script
|
---|
251 | * onto it.
|
---|
252 | */
|
---|
253 | virtual HRESULT prepareAuxIsoImage(bool fOverwrite);
|
---|
254 |
|
---|
255 | /**
|
---|
256 | * Opens the installation ISO image.
|
---|
257 | *
|
---|
258 | * @returns COM status code.
|
---|
259 | * @param phVfsIso Where to return the VFS handle for the ISO.
|
---|
260 | * @param fFlags RTFSISO9660_F_XXX flags to pass to the
|
---|
261 | * RTFsIso9660VolOpen API.
|
---|
262 | */
|
---|
263 | virtual HRESULT openInstallIsoImage(PRTVFS phVfsIso, uint32_t fFlags = 0);
|
---|
264 |
|
---|
265 | /**
|
---|
266 | * Creates and configures the ISO maker instance.
|
---|
267 | *
|
---|
268 | * This can be overridden to set configure options.
|
---|
269 | *
|
---|
270 | * @returns COM status code.
|
---|
271 | * @param phIsoMaker Where to return the ISO maker.
|
---|
272 | */
|
---|
273 | virtual HRESULT newAuxIsoImageMaker(PRTFSISOMAKER phIsoMaker);
|
---|
274 |
|
---|
275 | /**
|
---|
276 | * Adds files to the auxiliary ISO image maker.
|
---|
277 | *
|
---|
278 | * The base class implementation copies just the mMainScript and mPostScript
|
---|
279 | * files to root directory using the default filenames.
|
---|
280 | *
|
---|
281 | * @returns COM status code.
|
---|
282 | * @param hIsoMaker The ISO maker handle.
|
---|
283 | * @param hVfsOrgIso The VFS handle to the original ISO in case files
|
---|
284 | * needs to be added from it.
|
---|
285 | */
|
---|
286 | virtual HRESULT addFilesToAuxIsoImageMaker(RTFSISOMAKER hIsoMaker, RTVFS hVfsOrgIso);
|
---|
287 |
|
---|
288 | /**
|
---|
289 | * Adds the given script to the ISO maker.
|
---|
290 | *
|
---|
291 | * @returns COM status code.
|
---|
292 | * @param pEditor The script to add.
|
---|
293 | * @param hIsoMaker The ISO maker to add it to.
|
---|
294 | * @param pszDstFilename The file name (w/ path) to add it under. If NULL,
|
---|
295 | * the default script filename is used to add it to the
|
---|
296 | * root.
|
---|
297 | */
|
---|
298 | HRESULT addScriptToIsoMaker(BaseTextScript *pEditor, RTFSISOMAKER hIsoMaker, const char *pszDstFilename = NULL);
|
---|
299 |
|
---|
300 | /**
|
---|
301 | * Writes the ISO image to disk.
|
---|
302 | *
|
---|
303 | * @returns COM status code.
|
---|
304 | * @param hIsoMaker The ISO maker handle.
|
---|
305 | * @param pszFilename The filename.
|
---|
306 | * @param fOverwrite Whether to overwrite the destination file or not.
|
---|
307 | */
|
---|
308 | HRESULT finalizeAuxIsoImage(RTFSISOMAKER hIsoMaker, const char *pszFilename, bool fOverwrite);
|
---|
309 |
|
---|
310 | /**
|
---|
311 | * Adds files to the .viso-file vectors.
|
---|
312 | *
|
---|
313 | * The base class implementation adds the script from mAlg, additions ISO
|
---|
314 | * content to '/vboxadditions', and validation kit ISO to '/vboxvalidationkit'.
|
---|
315 | *
|
---|
316 | * @returns COM status code.
|
---|
317 | * @param rVecArgs The ISO maker argument list that will be turned into
|
---|
318 | * a .viso-file.
|
---|
319 | * @param rVecFiles The list of files we've created. This is for
|
---|
320 | * cleaning up at the end.
|
---|
321 | * @param hVfsOrgIso The VFS handle to the original ISO in case files
|
---|
322 | * needs to be added from it.
|
---|
323 | * @param fOverwrite Whether to overwrite files or not.
|
---|
324 | */
|
---|
325 | virtual HRESULT addFilesToAuxVisoVectors(RTCList<RTCString> &rVecArgs, RTCList<RTCString> &rVecFiles,
|
---|
326 | RTVFS hVfsOrgIso, bool fOverwrite);
|
---|
327 |
|
---|
328 | /**
|
---|
329 | * Saves the given script to disk and adds it to the .viso-file vectors.
|
---|
330 | *
|
---|
331 | * @returns COM status code.
|
---|
332 | * @param pEditor The script to add.
|
---|
333 | * @param rVecArgs The ISO maker argument list that will be turned into
|
---|
334 | * a .viso-file.
|
---|
335 | * @param rVecFiles The list of files we've created. This is for
|
---|
336 | * cleaning up at the end.
|
---|
337 | * @param fOverwrite Whether to overwrite files or not.
|
---|
338 | */
|
---|
339 | HRESULT addScriptToVisoVectors(BaseTextScript *pEditor, RTCList<RTCString> &rVecArgs,
|
---|
340 | RTCList<RTCString> &rVecFiles, bool fOverwrite);
|
---|
341 |
|
---|
342 | /**
|
---|
343 | * Writes out the .viso-file to disk.
|
---|
344 | *
|
---|
345 | * @returns COM status code.
|
---|
346 | * @param rVecArgs The ISO maker argument list to write out.
|
---|
347 | * @param pszFilename The filename.
|
---|
348 | * @param fOverwrite Whether to overwrite the destination file or not.
|
---|
349 | */
|
---|
350 | HRESULT finalizeAuxVisoFile(RTCList<RTCString> const &rVecArgs, const char *pszFilename, bool fOverwrite);
|
---|
351 |
|
---|
352 | /**
|
---|
353 | * Loads @a pszFilename from @a hVfsOrgIso into @a pEditor and parses it.
|
---|
354 | *
|
---|
355 | * @returns COM status code.
|
---|
356 | * @param hVfsOrgIso The handle to the original installation ISO.
|
---|
357 | * @param pszFilename The filename to open and load from the ISO.
|
---|
358 | * @param pEditor The editor instance to load the file into and
|
---|
359 | * do the parseing with.
|
---|
360 | */
|
---|
361 | HRESULT loadAndParseFileFromIso(RTVFS hVfsOrgIso, const char *pszFilename, AbstractScript *pEditor);
|
---|
362 | };
|
---|
363 |
|
---|
364 |
|
---|
365 | /**
|
---|
366 | * Windows installer, for versions up to xp 64 / w2k3.
|
---|
367 | */
|
---|
368 | class UnattendedWindowsSifInstaller : public UnattendedInstaller
|
---|
369 | {
|
---|
370 | public:
|
---|
371 | UnattendedWindowsSifInstaller(Unattended *pParent)
|
---|
372 | : UnattendedInstaller(pParent,
|
---|
373 | "win_nt5_unattended.sif", "win_postinstall.cmd",
|
---|
374 | "WINNT.SIF", "VBOXPOST.CMD")
|
---|
375 | { Assert(isOriginalIsoNeeded()); Assert(isAuxiliaryFloppyNeeded()); Assert(isAuxiliaryIsoIsVISO()); Assert(!bootFromAuxiliaryIso()); }
|
---|
376 | ~UnattendedWindowsSifInstaller() {}
|
---|
377 |
|
---|
378 | bool isAuxiliaryFloppyNeeded() const { return true; }
|
---|
379 | bool bootFromAuxiliaryIso() const { return false; }
|
---|
380 |
|
---|
381 | };
|
---|
382 |
|
---|
383 | /**
|
---|
384 | * Windows installer, for versions starting with Vista.
|
---|
385 | */
|
---|
386 | class UnattendedWindowsXmlInstaller : public UnattendedInstaller
|
---|
387 | {
|
---|
388 | public:
|
---|
389 | UnattendedWindowsXmlInstaller(Unattended *pParent)
|
---|
390 | : UnattendedInstaller(pParent,
|
---|
391 | "win_nt6_unattended.xml", "win_postinstall.cmd",
|
---|
392 | "autounattend.xml", "VBOXPOST.CMD")
|
---|
393 | { Assert(isOriginalIsoNeeded()); Assert(isAuxiliaryFloppyNeeded()); Assert(isAuxiliaryIsoIsVISO()); Assert(!bootFromAuxiliaryIso()); }
|
---|
394 | ~UnattendedWindowsXmlInstaller() {}
|
---|
395 |
|
---|
396 | bool isAuxiliaryFloppyNeeded() const { return true; }
|
---|
397 | bool bootFromAuxiliaryIso() const { return false; }
|
---|
398 | };
|
---|
399 |
|
---|
400 |
|
---|
401 | /**
|
---|
402 | * Base class for the unattended linux installers.
|
---|
403 | */
|
---|
404 | class UnattendedLinuxInstaller : public UnattendedInstaller
|
---|
405 | {
|
---|
406 | protected:
|
---|
407 | /** Array of linux parameter patterns that should be removed by editIsoLinuxCfg.
|
---|
408 | * The patterns are proceed by RTStrSimplePatternNMatch. */
|
---|
409 | RTCList<RTCString, RTCString *> mArrStrRemoveInstallKernelParameters;
|
---|
410 |
|
---|
411 | public:
|
---|
412 | UnattendedLinuxInstaller(Unattended *pParent,
|
---|
413 | const char *pszMainScriptTemplateName, const char *pszPostScriptTemplateName,
|
---|
414 | const char *pszMainScriptFilename, const char *pszPostScriptFilename = "vboxpostinstall.sh")
|
---|
415 | : UnattendedInstaller(pParent,
|
---|
416 | pszMainScriptTemplateName, pszPostScriptTemplateName,
|
---|
417 | pszMainScriptFilename, pszPostScriptFilename) {}
|
---|
418 | ~UnattendedLinuxInstaller() {}
|
---|
419 |
|
---|
420 | bool isAuxiliaryIsoNeeded() const { return true; }
|
---|
421 |
|
---|
422 | protected:
|
---|
423 | /**
|
---|
424 | * Performs basic edits on a isolinux.cfg file.
|
---|
425 | *
|
---|
426 | * @returns COM status code
|
---|
427 | * @param pEditor Editor with the isolinux.cfg file loaded and parsed.
|
---|
428 | */
|
---|
429 | virtual HRESULT editIsoLinuxCfg(GeneralTextScript *pEditor);
|
---|
430 | };
|
---|
431 |
|
---|
432 |
|
---|
433 | /**
|
---|
434 | * Debian installer.
|
---|
435 | *
|
---|
436 | * This will remaster the orignal ISO and therefore be producing a .viso-file.
|
---|
437 | */
|
---|
438 | class UnattendedDebianInstaller : public UnattendedLinuxInstaller
|
---|
439 | {
|
---|
440 | public:
|
---|
441 | UnattendedDebianInstaller(Unattended *pParent,
|
---|
442 | const char *pszMainScriptTemplateName = "debian_preseed.cfg",
|
---|
443 | const char *pszPostScriptTemplateName = "debian_postinstall.sh",
|
---|
444 | const char *pszMainScriptFilename = "preseed.cfg")
|
---|
445 | : UnattendedLinuxInstaller(pParent, pszMainScriptTemplateName, pszPostScriptTemplateName, pszMainScriptFilename)
|
---|
446 | {
|
---|
447 | Assert(!isOriginalIsoNeeded()); Assert(isAuxiliaryIsoNeeded());
|
---|
448 | Assert(!isAuxiliaryFloppyNeeded()); Assert(isAuxiliaryIsoIsVISO());
|
---|
449 | mStrDefaultExtraInstallKernelParameters.setNull();
|
---|
450 | mStrDefaultExtraInstallKernelParameters += " auto=true";
|
---|
451 | mStrDefaultExtraInstallKernelParameters.append(" preseed/file=/cdrom/").append(pszMainScriptFilename);
|
---|
452 | mStrDefaultExtraInstallKernelParameters += " priority=critical";
|
---|
453 | mStrDefaultExtraInstallKernelParameters += " quiet";
|
---|
454 | mStrDefaultExtraInstallKernelParameters += " splash";
|
---|
455 | mStrDefaultExtraInstallKernelParameters += " noprompt"; /* no questions about things like CD/DVD ejections */
|
---|
456 | mStrDefaultExtraInstallKernelParameters += " noshell"; /* No shells on VT1-3 (debian, not ubuntu). */
|
---|
457 | mStrDefaultExtraInstallKernelParameters += " automatic-ubiquity"; // ubiquity
|
---|
458 | // the following can probably go into the preseed.cfg:
|
---|
459 | mStrDefaultExtraInstallKernelParameters.append(" debian-installer/locale=").append(pParent->i_getLocale());
|
---|
460 | mStrDefaultExtraInstallKernelParameters += " keyboard-configuration/layoutcode=us";
|
---|
461 | mStrDefaultExtraInstallKernelParameters += " languagechooser/language-name=English"; /** @todo fixme */
|
---|
462 | mStrDefaultExtraInstallKernelParameters.append(" localechooser/supported-locales=").append(pParent->i_getLocale()).append(".UTF-8");
|
---|
463 | mStrDefaultExtraInstallKernelParameters.append(" countrychooser/shortlist=").append(pParent->i_getCountry()); // ubiquity?
|
---|
464 | mStrDefaultExtraInstallKernelParameters += " --";
|
---|
465 | }
|
---|
466 | ~UnattendedDebianInstaller() {}
|
---|
467 |
|
---|
468 | bool isOriginalIsoNeeded() const { return false; }
|
---|
469 |
|
---|
470 | protected:
|
---|
471 | HRESULT addFilesToAuxVisoVectors(RTCList<RTCString> &rVecArgs, RTCList<RTCString> &rVecFiles,
|
---|
472 | RTVFS hVfsOrgIso, bool fOverwrite);
|
---|
473 | HRESULT editDebianTxtCfg(GeneralTextScript *pEditor);
|
---|
474 |
|
---|
475 | };
|
---|
476 |
|
---|
477 |
|
---|
478 | /**
|
---|
479 | * Ubuntu installer (same as debian, except for the template).
|
---|
480 | */
|
---|
481 | class UnattendedUbuntuInstaller : public UnattendedDebianInstaller
|
---|
482 | {
|
---|
483 | public:
|
---|
484 | UnattendedUbuntuInstaller(Unattended *pParent)
|
---|
485 | : UnattendedDebianInstaller(pParent, "ubuntu_preseed.cfg")
|
---|
486 | { Assert(!isOriginalIsoNeeded()); Assert(isAuxiliaryIsoNeeded()); Assert(!isAuxiliaryFloppyNeeded()); Assert(isAuxiliaryIsoIsVISO()); }
|
---|
487 | ~UnattendedUbuntuInstaller() {}
|
---|
488 | };
|
---|
489 |
|
---|
490 |
|
---|
491 | /**
|
---|
492 | * RHEL 6 and 7 installer.
|
---|
493 | *
|
---|
494 | * This serves as a base for the kickstart based installers.
|
---|
495 | */
|
---|
496 | class UnattendedRhel6And7Installer : public UnattendedLinuxInstaller
|
---|
497 | {
|
---|
498 | public:
|
---|
499 | UnattendedRhel6And7Installer(Unattended *pParent,
|
---|
500 | const char *pszMainScriptTemplateName = "redhat67_ks.cfg",
|
---|
501 | const char *pszPostScriptTemplateName = "redhat_postinstall.sh",
|
---|
502 | const char *pszMainScriptFilename = "ks.cfg")
|
---|
503 | : UnattendedLinuxInstaller(pParent, pszMainScriptTemplateName, pszPostScriptTemplateName, pszMainScriptFilename)
|
---|
504 | {
|
---|
505 | Assert(!isOriginalIsoNeeded()); Assert(isAuxiliaryIsoNeeded());
|
---|
506 | Assert(!isAuxiliaryFloppyNeeded()); Assert(isAuxiliaryIsoIsVISO());
|
---|
507 | mStrDefaultExtraInstallKernelParameters.assign(" ks=cdrom:/").append(pszMainScriptFilename).append(' ');
|
---|
508 | mArrStrRemoveInstallKernelParameters.append("rd.live.check"); /* Disables the checkisomd5 step. Required for VISO. */
|
---|
509 | }
|
---|
510 | ~UnattendedRhel6And7Installer() {}
|
---|
511 |
|
---|
512 | bool isAuxiliaryIsoIsVISO() { return true; }
|
---|
513 | bool isOriginalIsoNeeded() const { return false; }
|
---|
514 |
|
---|
515 | protected:
|
---|
516 | HRESULT addFilesToAuxVisoVectors(RTCList<RTCString> &rVecArgs, RTCList<RTCString> &rVecFiles,
|
---|
517 | RTVFS hVfsOrgIso, bool fOverwrite);
|
---|
518 | };
|
---|
519 |
|
---|
520 |
|
---|
521 | /**
|
---|
522 | * RHEL 5 installer (same as RHEL 6 & 7, except for the kickstart template).
|
---|
523 | */
|
---|
524 | class UnattendedRhel5Installer : public UnattendedRhel6And7Installer
|
---|
525 | {
|
---|
526 | public:
|
---|
527 | UnattendedRhel5Installer(Unattended *pParent) : UnattendedRhel6And7Installer(pParent, "rhel5_ks.cfg") {}
|
---|
528 | ~UnattendedRhel5Installer() {}
|
---|
529 | };
|
---|
530 |
|
---|
531 |
|
---|
532 | /**
|
---|
533 | * RHEL 4 installer (same as RHEL 6 & 7, except for the kickstart template).
|
---|
534 | */
|
---|
535 | class UnattendedRhel4Installer : public UnattendedRhel6And7Installer
|
---|
536 | {
|
---|
537 | public:
|
---|
538 | UnattendedRhel4Installer(Unattended *pParent) : UnattendedRhel6And7Installer(pParent, "rhel4_ks.cfg") {}
|
---|
539 | ~UnattendedRhel4Installer() {}
|
---|
540 | };
|
---|
541 |
|
---|
542 |
|
---|
543 | /**
|
---|
544 | * RHEL 3 installer (same as RHEL 6 & 7, except for the kickstart template).
|
---|
545 | */
|
---|
546 | class UnattendedRhel3Installer : public UnattendedRhel6And7Installer
|
---|
547 | {
|
---|
548 | public:
|
---|
549 | UnattendedRhel3Installer(Unattended *pParent) : UnattendedRhel6And7Installer(pParent, "rhel3_ks.cfg") {}
|
---|
550 | ~UnattendedRhel3Installer() {}
|
---|
551 | };
|
---|
552 |
|
---|
553 |
|
---|
554 | /**
|
---|
555 | * Fedora installer (same as RHEL 6 & 7, except for the template).
|
---|
556 | */
|
---|
557 | class UnattendedFedoraInstaller : public UnattendedRhel6And7Installer
|
---|
558 | {
|
---|
559 | public:
|
---|
560 | UnattendedFedoraInstaller(Unattended *pParent)
|
---|
561 | : UnattendedRhel6And7Installer(pParent, "fedora_ks.cfg")
|
---|
562 | { Assert(!isOriginalIsoNeeded()); Assert(isAuxiliaryIsoNeeded()); Assert(!isAuxiliaryFloppyNeeded()); Assert(isAuxiliaryIsoIsVISO()); }
|
---|
563 | ~UnattendedFedoraInstaller() {}
|
---|
564 | };
|
---|
565 |
|
---|
566 |
|
---|
567 | /**
|
---|
568 | * Oracle Linux installer (same as RHEL 6 & 7, except for the template).
|
---|
569 | */
|
---|
570 | class UnattendedOracleLinuxInstaller : public UnattendedRhel6And7Installer
|
---|
571 | {
|
---|
572 | public:
|
---|
573 | UnattendedOracleLinuxInstaller(Unattended *pParent)
|
---|
574 | : UnattendedRhel6And7Installer(pParent, "ol_ks.cfg")
|
---|
575 | { Assert(!isOriginalIsoNeeded()); Assert(isAuxiliaryIsoNeeded()); Assert(!isAuxiliaryFloppyNeeded()); Assert(isAuxiliaryIsoIsVISO()); }
|
---|
576 | ~UnattendedOracleLinuxInstaller() {}
|
---|
577 | };
|
---|
578 |
|
---|
579 |
|
---|
580 | #if 0 /* fixme */
|
---|
581 | /**
|
---|
582 | * SUSE linux installer.
|
---|
583 | *
|
---|
584 | * @todo needs fixing.
|
---|
585 | */
|
---|
586 | class UnattendedSuseInstaller : public UnattendedLinuxInstaller
|
---|
587 | {
|
---|
588 | public:
|
---|
589 | UnattendedSuseInstaller(BaseTextScript *pAlg, Unattended *pParent)
|
---|
590 | : UnattendedLinuxInstaller(pAlg, pParent, "suse_autoinstall.xml")
|
---|
591 | { Assert(isOriginalIsoNeeded()); Assert(isAuxiliaryIsoNeeded()); Assert(!isAuxiliaryFloppyNeeded()); Assert(!isAuxiliaryIsoIsVISO()); }
|
---|
592 | ~UnattendedSuseInstaller() {}
|
---|
593 |
|
---|
594 | HRESULT setupScriptOnAuxiliaryCD(const Utf8Str &path);
|
---|
595 | };
|
---|
596 | #endif
|
---|
597 |
|
---|
598 | #endif /* !MAIN_INCLUDED_UnattendedInstaller_h */
|
---|
599 |
|
---|