VirtualBox

source: vbox/trunk/src/VBox/Main/include/UnattendedInstaller.h@ 94249

Last change on this file since 94249 was 93405, checked in by vboxsync, 3 years ago

Main/Unattended: Use the detected guest OS type instead of the configured VM guest OS type for picking the installer. bugref:10186 bugref:9515

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 33.5 KB
Line 
1/* $Id: UnattendedInstaller.h 93405 2022-01-24 09:56:23Z vboxsync $ */
2/** @file
3 * UnattendedInstaller class header
4 */
5
6/*
7 * Copyright (C) 2006-2022 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 */
27class Unattended;
28class UnattendedInstaller;
29class 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 */
38class UnattendedInstaller : public RTCNonCopyable
39{
40/*data*/
41protected:
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 /** The directory of the post install script in the unattended install
68 * environment, i.e. when it gets started by the unattended installer
69 * of the respective guest OS. */
70 Utf8Str mStrAuxiliaryInstallDir;
71
72private:
73 UnattendedInstaller(); /* no default constructors */
74
75public:
76 DECLARE_TRANSLATE_METHODS(UnattendedInstaller)
77
78 /**
79 * Regular constructor.
80 *
81 * @param pParent The parent object. Used for setting
82 * errors and querying attributes.
83 * @param pszMainScriptTemplateName The name of the template file (no path)
84 * for the main unattended installer
85 * script.
86 * @param pszPostScriptTemplateName The name of the template file (no path)
87 * for the post installation script.
88 * @param pszMainScriptFilename The main unattended installer script
89 * filename (on aux media).
90 * @param pszPostScriptFilename The post installation script filename
91 * (on aux media).
92 * @param enmBootDevice The boot device type.
93 */
94 UnattendedInstaller(Unattended *pParent,
95 const char *pszMainScriptTemplateName, const char *pszPostScriptTemplateName,
96 const char *pszMainScriptFilename, const char *pszPostScriptFilename,
97 DeviceType_T enmBootDevice = DeviceType_DVD);
98 virtual ~UnattendedInstaller();
99
100 /**
101 * Instantiates the appropriate child class.
102 *
103 * @returns Pointer to the new instance, NULL if no appropriate installer.
104 * @param enmDetectedOSType The detected guest OS type value.
105 * @param strDetectedOSType The detected guest OS type string
106 * @param strDetectedOSVersion The detected guest OS version.
107 * @param strDetectedOSFlavor The detected guest OS flavor.
108 * @param strDetectedOSHints Hints about the detected guest OS.
109 * @param pParent The parent object. Used for setting errors
110 * and querying attributes.
111 * @throws std::bad_alloc
112 */
113 static UnattendedInstaller *createInstance(VBOXOSTYPE enmDetectedOSType, const Utf8Str &strDetectedOSType,
114 const Utf8Str &strDetectedOSVersion, const Utf8Str &strDetectedOSFlavor,
115 const Utf8Str &strDetectedOSHints, Unattended *pParent);
116
117 /**
118 * Initialize the installer.
119 *
120 * @note This is called immediately after instantiation and the caller will
121 * always destroy the unattended installer instance on failure, so it
122 * is not necessary to keep track of whether this succeeded or not.
123 */
124 virtual HRESULT initInstaller();
125
126#if 0 /* These are now in the AUX VISO. */
127 /**
128 * Whether the VBox Guest Additions ISO is needed or not.
129 *
130 * The default implementation always returns false when a VISO is used, see
131 * UnattendedInstaller::addFilesToAuxVisoVectors.
132 */
133 virtual bool isAdditionsIsoNeeded() const;
134
135 /**
136 * Whether the VBox validation kit ISO is needed or not.
137 *
138 * The default implementation always returns false when a VISO is used, see
139 * UnattendedInstaller::addFilesToAuxVisoVectors.
140 */
141 virtual bool isValidationKitIsoNeeded() const;
142#endif
143
144 /**
145 * Indicates whether an original installation ISO is needed or not.
146 */
147 virtual bool isOriginalIsoNeeded() const { return true; }
148
149 /**
150 * Indicates whether a floppy image is needed or not.
151 */
152 virtual bool isAuxiliaryFloppyNeeded() const { return false; }
153
154 /**
155 * Indicates whether an additional or replacement ISO image is needed or not.
156 */
157 virtual bool isAuxiliaryIsoNeeded() const;
158
159 /**
160 * Indicates whether we should boot from the auxiliary ISO image.
161 *
162 * Will boot from installation ISO if false.
163 */
164 virtual bool bootFromAuxiliaryIso() const { return isAuxiliaryIsoNeeded(); }
165
166 /**
167 * Indicates whether a the auxiliary ISO is a .viso-file rather than an
168 * .iso-file.
169 *
170 * Different worker methods are used depending on the return value. A
171 * .viso-file is generally only used when the installation media needs to
172 * be remastered with small changes and additions.
173 */
174 virtual bool isAuxiliaryIsoIsVISO() const { return true; }
175
176 /*
177 * Getters
178 */
179 DeviceType_T getBootableDeviceType() const { return meBootDevice; }
180 const Utf8Str &getTemplateFilePath() const { return mStrMainScriptTemplate; }
181 const Utf8Str &getPostTemplateFilePath() const { return mStrPostScriptTemplate; }
182 const Utf8Str &getAuxiliaryIsoFilePath() const { return mStrAuxiliaryIsoFilePath; }
183 const Utf8Str &getAuxiliaryFloppyFilePath() const { return mStrAuxiliaryFloppyFilePath; }
184 const Utf8Str &getDefaultExtraInstallKernelParameters() const { return mStrDefaultExtraInstallKernelParameters; }
185 const Utf8Str &getAuxiliaryInstallDir() const { return mStrAuxiliaryInstallDir; }
186
187 /*
188 * Setters
189 */
190 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. */
191
192 /**
193 * Prepares the unattended scripts, does all but write them to the installation
194 * media.
195 */
196 HRESULT prepareUnattendedScripts();
197
198 /**
199 * Prepares the media - floppy image, ISO image.
200 *
201 * This method calls prepareAuxFloppyImage() and prepareAuxIsoImage(), child
202 * classes may override these methods or methods they call.
203 *
204 * @returns COM status code.
205 * @param fOverwrite Whether to overwrite media files or fail if they
206 * already exist.
207 */
208 HRESULT prepareMedia(bool fOverwrite = true);
209
210protected:
211 /**
212 * Prepares (creates) the auxiliary floppy image.
213 *
214 * This is called by the base class prepareMedia() when
215 * isAuxiliaryFloppyNeeded() is true. The base class implementation puts the
216 * edited unattended script onto it.
217 */
218 HRESULT prepareAuxFloppyImage(bool fOverwrite);
219
220 /**
221 * Creates and formats (FAT12) a floppy image.
222 *
223 * This can be overridden to do more preparation work or/and create a different
224 * sized floppy.
225 *
226 * @returns COM status code.
227 * @param pszFilename The path to the image file.
228 * @param fOverwrite Whether to overwrite the file.
229 * @param phVfsFile Where to return a read-writable handle to the newly
230 * created image.
231 */
232 virtual HRESULT newAuxFloppyImage(const char *pszFilename, bool fOverwrite, PRTVFSFILE phVfsFile);
233
234 /**
235 * Copies files to the auxiliary floppy image.
236 *
237 * The base class implementation copies the main and post scripts to the root of
238 * the floppy using the default script names. Child classes may override this
239 * to add additional or different files.
240 *
241 * @returns COM status code.
242 * @param hVfs The floppy image VFS handle.
243 */
244 virtual HRESULT copyFilesToAuxFloppyImage(RTVFS hVfs);
245
246 /**
247 * Adds the given script to the root of the floppy image under the default
248 * script filename.
249 *
250 * @returns COM status code.
251 * @param pEditor The script to add.
252 * @param hVfs The VFS to add it to.
253 */
254 HRESULT addScriptToFloppyImage(BaseTextScript *pEditor, RTVFS hVfs);
255
256 /**
257 * Copy an arbritrary file onto the floopy image.
258 *
259 * @returns COM status code.
260 * @param hVfs The VFS to add it to.
261 * @param pszSrc The source filename.
262 * @param pszDst The destination filename (on @a hVfs).
263 */
264 HRESULT addFileToFloppyImage(RTVFS hVfs, const char *pszSrc, const char *pszDst);
265
266 /**
267 * Prepares (creates) the auxiliary ISO image.
268 *
269 * This is called by the base class prepareMedia() when isAuxiliaryIsoNeeded()
270 * is true. The base class implementation puts the edited unattended script
271 * onto it.
272 */
273 virtual HRESULT prepareAuxIsoImage(bool fOverwrite);
274
275 /**
276 * Opens the installation ISO image.
277 *
278 * @returns COM status code.
279 * @param phVfsIso Where to return the VFS handle for the ISO.
280 * @param fFlags RTFSISO9660_F_XXX flags to pass to the
281 * RTFsIso9660VolOpen API.
282 */
283 virtual HRESULT openInstallIsoImage(PRTVFS phVfsIso, uint32_t fFlags = 0);
284
285 /**
286 * Creates and configures the ISO maker instance.
287 *
288 * This can be overridden to set configure options.
289 *
290 * @returns COM status code.
291 * @param phIsoMaker Where to return the ISO maker.
292 */
293 virtual HRESULT newAuxIsoImageMaker(PRTFSISOMAKER phIsoMaker);
294
295 /**
296 * Adds files to the auxiliary ISO image maker.
297 *
298 * The base class implementation copies just the mMainScript and mPostScript
299 * files to root directory using the default filenames.
300 *
301 * @returns COM status code.
302 * @param hIsoMaker The ISO maker handle.
303 * @param hVfsOrgIso The VFS handle to the original ISO in case files
304 * needs to be added from it.
305 */
306 virtual HRESULT addFilesToAuxIsoImageMaker(RTFSISOMAKER hIsoMaker, RTVFS hVfsOrgIso);
307
308 /**
309 * Adds the given script to the ISO maker.
310 *
311 * @returns COM status code.
312 * @param pEditor The script to add.
313 * @param hIsoMaker The ISO maker to add it to.
314 * @param pszDstFilename The file name (w/ path) to add it under. If NULL,
315 * the default script filename is used to add it to the
316 * root.
317 */
318 HRESULT addScriptToIsoMaker(BaseTextScript *pEditor, RTFSISOMAKER hIsoMaker, const char *pszDstFilename = NULL);
319
320 /**
321 * Writes the ISO image to disk.
322 *
323 * @returns COM status code.
324 * @param hIsoMaker The ISO maker handle.
325 * @param pszFilename The filename.
326 * @param fOverwrite Whether to overwrite the destination file or not.
327 */
328 HRESULT finalizeAuxIsoImage(RTFSISOMAKER hIsoMaker, const char *pszFilename, bool fOverwrite);
329
330 /**
331 * Adds files to the .viso-file vectors.
332 *
333 * The base class implementation adds the script from mAlg, additions ISO
334 * content to '/vboxadditions', and validation kit ISO to '/vboxvalidationkit'.
335 *
336 * @returns COM status code.
337 * @param rVecArgs The ISO maker argument list that will be turned into
338 * a .viso-file.
339 * @param rVecFiles The list of files we've created. This is for
340 * cleaning up at the end.
341 * @param hVfsOrgIso The VFS handle to the original ISO in case files
342 * needs to be added from it.
343 * @param fOverwrite Whether to overwrite files or not.
344 */
345 virtual HRESULT addFilesToAuxVisoVectors(RTCList<RTCString> &rVecArgs, RTCList<RTCString> &rVecFiles,
346 RTVFS hVfsOrgIso, bool fOverwrite);
347
348 /**
349 * Saves the given script to disk and adds it to the .viso-file vectors.
350 *
351 * @returns COM status code.
352 * @param pEditor The script to add.
353 * @param rVecArgs The ISO maker argument list that will be turned into
354 * a .viso-file.
355 * @param rVecFiles The list of files we've created. This is for
356 * cleaning up at the end.
357 * @param fOverwrite Whether to overwrite files or not.
358 */
359 HRESULT addScriptToVisoVectors(BaseTextScript *pEditor, RTCList<RTCString> &rVecArgs,
360 RTCList<RTCString> &rVecFiles, bool fOverwrite);
361
362 /**
363 * Writes out the .viso-file to disk.
364 *
365 * @returns COM status code.
366 * @param rVecArgs The ISO maker argument list to write out.
367 * @param pszFilename The filename.
368 * @param fOverwrite Whether to overwrite the destination file or not.
369 */
370 HRESULT finalizeAuxVisoFile(RTCList<RTCString> const &rVecArgs, const char *pszFilename, bool fOverwrite);
371
372 /**
373 * Loads @a pszFilename from @a hVfsOrgIso into @a pEditor and parses it.
374 *
375 * @returns COM status code.
376 * @param hVfsOrgIso The handle to the original installation ISO.
377 * @param pszFilename The filename to open and load from the ISO.
378 * @param pEditor The editor instance to load the file into and
379 * do the parseing with.
380 */
381 HRESULT loadAndParseFileFromIso(RTVFS hVfsOrgIso, const char *pszFilename, AbstractScript *pEditor);
382};
383
384
385/**
386 * Windows installer, for versions up to xp 64 / w2k3.
387 */
388class UnattendedWindowsSifInstaller : public UnattendedInstaller
389{
390public:
391 DECLARE_TRANSLATE_METHODS(UnattendedWindowsSifInstaller)
392
393 UnattendedWindowsSifInstaller(Unattended *pParent)
394 : UnattendedInstaller(pParent,
395 "win_nt5_unattended.sif", "win_postinstall.cmd",
396 "WINNT.SIF", "VBOXPOST.CMD")
397 {
398 Assert(isOriginalIsoNeeded()); Assert(isAuxiliaryFloppyNeeded()); Assert(isAuxiliaryIsoIsVISO()); Assert(!bootFromAuxiliaryIso());
399 mStrAuxiliaryInstallDir = "A:\\";
400 }
401 ~UnattendedWindowsSifInstaller() {}
402
403 bool isAuxiliaryFloppyNeeded() const { return true; }
404 bool bootFromAuxiliaryIso() const { return false; }
405
406};
407
408/**
409 * Windows installer, for versions starting with Vista.
410 */
411class UnattendedWindowsXmlInstaller : public UnattendedInstaller
412{
413public:
414 DECLARE_TRANSLATE_METHODS(UnattendedWindowsXmlInstaller)
415
416 UnattendedWindowsXmlInstaller(Unattended *pParent)
417 : UnattendedInstaller(pParent,
418 "win_nt6_unattended.xml", "win_postinstall.cmd",
419 "autounattend.xml", "VBOXPOST.CMD")
420 {
421 Assert(isOriginalIsoNeeded()); Assert(isAuxiliaryFloppyNeeded() || isAuxiliaryIsoNeeded()); Assert(isAuxiliaryIsoIsVISO()); Assert(!bootFromAuxiliaryIso());
422 if (isAuxiliaryFloppyNeeded())
423 mStrAuxiliaryInstallDir = "A:\\";
424 else if (bootFromAuxiliaryIso())
425 mStrAuxiliaryInstallDir = "D:\\";
426 else
427 mStrAuxiliaryInstallDir = "E:\\";
428 }
429 ~UnattendedWindowsXmlInstaller() {}
430
431 bool isAuxiliaryFloppyNeeded() const { return !mpParent->i_isFirmwareEFI(); }
432 bool isAuxiliaryIsoNeeded() const { return UnattendedInstaller::isAuxiliaryIsoNeeded() || mpParent->i_isFirmwareEFI(); }
433 bool isAuxiliaryIsoIsVISO() const { return true; }
434 bool bootFromAuxiliaryIso() const { return false; }
435};
436
437
438/**
439 * OS/2 installer.
440 */
441class UnattendedOs2Installer : public UnattendedInstaller
442{
443public:
444 DECLARE_TRANSLATE_METHODS(UnattendedOs2Installer)
445
446 UnattendedOs2Installer(Unattended *pParent, Utf8Str const &rStrHints);
447 ~UnattendedOs2Installer() {}
448
449 /* Remaster original ISO with auxiliary floppy used for el torito floppy emulation: */
450 bool isOriginalIsoNeeded() const RT_OVERRIDE { return false; }
451 bool isAuxiliaryFloppyNeeded() const RT_OVERRIDE { return true; }
452 bool isAuxiliaryIsoNeeded() const RT_OVERRIDE { return true; }
453
454protected:
455 HRESULT replaceAuxFloppyImageBootSector(RTVFSFILE hVfsFile) RT_NOEXCEPT;
456 HRESULT newAuxFloppyImage(const char *pszFilename, bool fOverwrite, PRTVFSFILE phVfsFile) RT_OVERRIDE;
457 HRESULT copyFilesToAuxFloppyImage(RTVFS hVfs) RT_OVERRIDE;
458 HRESULT addFilesToAuxVisoVectors(RTCList<RTCString> &rVecArgs, RTCList<RTCString> &rVecFiles,
459 RTVFS hVfsOrgIso, bool fOverwrite) RT_OVERRIDE;
460
461 HRESULT splitResponseFile() RT_NOEXCEPT;
462
463 /**
464 * Splits up the given file into sub-files and writes them out with the auxilary
465 * path base as prefix.
466 *
467 * The source file contains @@VBOX_SPLITTER_START[filename]@@ and
468 * @@VBOX_SPLITTER_END[filename]@@ markup that is used to split it up. Any
469 * text between END and START tags are ignored and can be used for comments.
470 *
471 * @returns COM status code (error info set).
472 * @param pszFileToSplit The name of the file to split.
473 * @param rVecSplitFiles Vector where names of the sub-files are appended
474 * (without any path or prefix).
475 */
476 HRESULT splitFile(const char *pszFileToSplit, RTCList<RTCString> &rVecSplitFiles) RT_NOEXCEPT;
477
478 /**
479 * Splits up the given editor output into sub-files and writes them out with the
480 * auxilary path base as prefix.
481 *
482 * The source file contains @@VBOX_SPLITTER_START[filename]@@ and
483 * @@VBOX_SPLITTER_END[filename]@@ markup that is used to split it up. Any
484 * text between END and START tags are ignored and can be used for comments.
485 *
486 * @returns COM status code (error info set).
487 * @param pEditor The editor which output should be split.
488 * @param rVecSplitFiles Vector where names of the sub-files are appended
489 * (without any path or prefix).
490 */
491 HRESULT splitFile(BaseTextScript *pEditor, RTCList<RTCString> &rVecSplitFiles) RT_NOEXCEPT;
492
493 HRESULT splitFileInner(const char *pszFileToSplit, RTCList<RTCString> &rVecSplitFiles,
494 const char *pszSrc, size_t cbLeft) RT_NOEXCEPT;
495
496 static int patchTestCfg(uint8_t *pbFile, size_t cbFile, const char *pszFilename, UnattendedOs2Installer *pThis);
497 static int patchOs2Ldr(uint8_t *pbFile, size_t cbFile, const char *pszFilename, UnattendedOs2Installer *pThis);
498
499 /** The OS2SE20.SRC path ("\\OS2IMAGES"). */
500 Utf8Str mStrOs2Images;
501 /** Files split out from os2_response_files.rsp (bare filenames, no paths). */
502 RTCList<RTCString> mVecSplitFiles;
503};
504
505
506
507/**
508 * Base class for the unattended linux installers.
509 */
510class UnattendedLinuxInstaller : public UnattendedInstaller
511{
512protected:
513 /** Array of linux parameter patterns that should be removed by editIsoLinuxCfg.
514 * The patterns are proceed by RTStrSimplePatternNMatch. */
515 RTCList<RTCString, RTCString *> mArrStrRemoveInstallKernelParameters;
516
517public:
518 DECLARE_TRANSLATE_METHODS(UnattendedLinuxInstaller)
519
520 UnattendedLinuxInstaller(Unattended *pParent,
521 const char *pszMainScriptTemplateName, const char *pszPostScriptTemplateName,
522 const char *pszMainScriptFilename, const char *pszPostScriptFilename = "vboxpostinstall.sh")
523 : UnattendedInstaller(pParent,
524 pszMainScriptTemplateName, pszPostScriptTemplateName,
525 pszMainScriptFilename, pszPostScriptFilename) {}
526 ~UnattendedLinuxInstaller() {}
527
528 bool isAuxiliaryIsoNeeded() const { return true; }
529
530protected:
531 /**
532 * Performs basic edits on a isolinux.cfg file.
533 *
534 * @returns COM status code
535 * @param pEditor Editor with the isolinux.cfg file loaded and parsed.
536 */
537 virtual HRESULT editIsoLinuxCfg(GeneralTextScript *pEditor);
538};
539
540
541/**
542 * Debian installer.
543 *
544 * This will remaster the orignal ISO and therefore be producing a .viso-file.
545 */
546class UnattendedDebianInstaller : public UnattendedLinuxInstaller
547{
548public:
549 DECLARE_TRANSLATE_METHODS(UnattendedDebianInstaller)
550
551 UnattendedDebianInstaller(Unattended *pParent,
552 const char *pszMainScriptTemplateName = "debian_preseed.cfg",
553 const char *pszPostScriptTemplateName = "debian_postinstall.sh",
554 const char *pszMainScriptFilename = "preseed.cfg")
555 : UnattendedLinuxInstaller(pParent, pszMainScriptTemplateName, pszPostScriptTemplateName, pszMainScriptFilename)
556 {
557 Assert(!isOriginalIsoNeeded()); Assert(isAuxiliaryIsoNeeded());
558 Assert(!isAuxiliaryFloppyNeeded()); Assert(isAuxiliaryIsoIsVISO());
559 mStrDefaultExtraInstallKernelParameters.setNull();
560 mStrDefaultExtraInstallKernelParameters += " auto=true";
561 mStrDefaultExtraInstallKernelParameters.append(" preseed/file=/cdrom/").append(pszMainScriptFilename);
562 mStrDefaultExtraInstallKernelParameters += " priority=critical";
563 mStrDefaultExtraInstallKernelParameters += " quiet";
564 mStrDefaultExtraInstallKernelParameters += " splash";
565 mStrDefaultExtraInstallKernelParameters += " noprompt"; /* no questions about things like CD/DVD ejections */
566 mStrDefaultExtraInstallKernelParameters += " noshell"; /* No shells on VT1-3 (debian, not ubuntu). */
567 mStrDefaultExtraInstallKernelParameters += " automatic-ubiquity"; // ubiquity
568 // the following can probably go into the preseed.cfg:
569 mStrDefaultExtraInstallKernelParameters.append(" debian-installer/locale=").append(pParent->i_getLocale());
570 mStrDefaultExtraInstallKernelParameters += " keyboard-configuration/layoutcode=us";
571 mStrDefaultExtraInstallKernelParameters += " languagechooser/language-name=English"; /** @todo fixme */
572 mStrDefaultExtraInstallKernelParameters.append(" localechooser/supported-locales=").append(pParent->i_getLocale()).append(".UTF-8");
573 mStrDefaultExtraInstallKernelParameters.append(" countrychooser/shortlist=").append(pParent->i_getCountry()); // ubiquity?
574 mStrDefaultExtraInstallKernelParameters += " --";
575 }
576 ~UnattendedDebianInstaller() {}
577
578 bool isOriginalIsoNeeded() const { return false; }
579
580protected:
581 HRESULT addFilesToAuxVisoVectors(RTCList<RTCString> &rVecArgs, RTCList<RTCString> &rVecFiles,
582 RTVFS hVfsOrgIso, bool fOverwrite);
583 HRESULT editDebianTxtCfg(GeneralTextScript *pEditor);
584
585};
586
587
588/**
589 * Ubuntu installer (same as debian, except for the template).
590 */
591class UnattendedUbuntuInstaller : public UnattendedDebianInstaller
592{
593public:
594 DECLARE_TRANSLATE_METHODS(UnattendedUbuntuInstaller)
595
596 UnattendedUbuntuInstaller(Unattended *pParent)
597 : UnattendedDebianInstaller(pParent, "ubuntu_preseed.cfg")
598 { Assert(!isOriginalIsoNeeded()); Assert(isAuxiliaryIsoNeeded()); Assert(!isAuxiliaryFloppyNeeded()); Assert(isAuxiliaryIsoIsVISO()); }
599 ~UnattendedUbuntuInstaller() {}
600};
601
602
603/**
604 * RHEL 6 installer.
605 *
606 * This serves as a base for the kickstart based installers.
607 */
608class UnattendedRhel6Installer : public UnattendedLinuxInstaller
609{
610public:
611 DECLARE_TRANSLATE_METHODS(UnattendedRhel6Installer)
612
613 UnattendedRhel6Installer(Unattended *pParent,
614 const char *pszMainScriptTemplateName = "redhat67_ks.cfg",
615 const char *pszPostScriptTemplateName = "redhat_postinstall.sh",
616 const char *pszMainScriptFilename = "ks.cfg")
617 : UnattendedLinuxInstaller(pParent, pszMainScriptTemplateName, pszPostScriptTemplateName, pszMainScriptFilename)
618 {
619 Assert(!isOriginalIsoNeeded()); Assert(isAuxiliaryIsoNeeded());
620 Assert(!isAuxiliaryFloppyNeeded()); Assert(isAuxiliaryIsoIsVISO());
621 mStrDefaultExtraInstallKernelParameters.assign(" ks=cdrom:/").append(pszMainScriptFilename).append(' ');
622 mArrStrRemoveInstallKernelParameters.append("rd.live.check"); /* Disables the checkisomd5 step. Required for VISO. */
623 }
624 ~UnattendedRhel6Installer() {}
625
626 bool isAuxiliaryIsoIsVISO() { return true; }
627 bool isOriginalIsoNeeded() const { return false; }
628
629protected:
630 HRESULT addFilesToAuxVisoVectors(RTCList<RTCString> &rVecArgs, RTCList<RTCString> &rVecFiles,
631 RTVFS hVfsOrgIso, bool fOverwrite);
632};
633
634/**
635 * RHEL 7 installer (same as RHEL 6).
636 * The class was added for better handling any possible subtle difference between RHEL6 and RHEL7.
637 */
638class UnattendedRhel7Installer : public UnattendedRhel6Installer
639{
640public:
641 DECLARE_TRANSLATE_METHODS(UnattendedRhel7Installer)
642
643 UnattendedRhel7Installer(Unattended *pParent)
644 : UnattendedRhel6Installer(pParent)
645 { Assert(!isOriginalIsoNeeded()); Assert(isAuxiliaryIsoNeeded()); Assert(!isAuxiliaryFloppyNeeded()); Assert(isAuxiliaryIsoIsVISO()); }
646
647 UnattendedRhel7Installer(Unattended *pParent,
648 const char *pszMainScriptTemplateName,
649 const char *pszPostScriptTemplateName,
650 const char *pszMainScriptFilename)
651 : UnattendedRhel6Installer(pParent, pszMainScriptTemplateName, pszPostScriptTemplateName, pszMainScriptFilename)
652 { Assert(!isOriginalIsoNeeded()); Assert(isAuxiliaryIsoNeeded()); Assert(!isAuxiliaryFloppyNeeded()); Assert(isAuxiliaryIsoIsVISO()); }
653 ~UnattendedRhel7Installer() {}
654};
655
656
657/**
658 * RHEL 8 installer (same as RHEL 7).
659 * The class was added for better handling any possible subtle difference between RHEL7 and RHEL8.
660 */
661class UnattendedRhel8Installer : public UnattendedRhel7Installer
662{
663public:
664 DECLARE_TRANSLATE_METHODS(UnattendedRhel8Installer)
665
666 UnattendedRhel8Installer(Unattended *pParent)
667 : UnattendedRhel7Installer(pParent)
668 { Assert(!isOriginalIsoNeeded()); Assert(isAuxiliaryIsoNeeded()); Assert(!isAuxiliaryFloppyNeeded()); Assert(isAuxiliaryIsoIsVISO()); }
669
670 UnattendedRhel8Installer(Unattended *pParent,
671 const char *pszMainScriptTemplateName,
672 const char *pszPostScriptTemplateName,
673 const char *pszMainScriptFilename)
674 : UnattendedRhel7Installer(pParent, pszMainScriptTemplateName, pszPostScriptTemplateName, pszMainScriptFilename)
675 { Assert(!isOriginalIsoNeeded()); Assert(isAuxiliaryIsoNeeded()); Assert(!isAuxiliaryFloppyNeeded()); Assert(isAuxiliaryIsoIsVISO()); }
676 ~UnattendedRhel8Installer() {}
677};
678
679
680/**
681 * RHEL 5 installer (same as RHEL 6, except for the kickstart template).
682 */
683class UnattendedRhel5Installer : public UnattendedRhel6Installer
684{
685public:
686 DECLARE_TRANSLATE_METHODS(UnattendedRhel5Installer)
687
688 UnattendedRhel5Installer(Unattended *pParent) : UnattendedRhel6Installer(pParent, "rhel5_ks.cfg") {}
689 ~UnattendedRhel5Installer() {}
690};
691
692
693/**
694 * RHEL 4 installer (same as RHEL 6, except for the kickstart template).
695 */
696class UnattendedRhel4Installer : public UnattendedRhel6Installer
697{
698public:
699 DECLARE_TRANSLATE_METHODS(UnattendedRhel4Installer)
700
701 UnattendedRhel4Installer(Unattended *pParent) : UnattendedRhel6Installer(pParent, "rhel4_ks.cfg") {}
702 ~UnattendedRhel4Installer() {}
703};
704
705
706/**
707 * RHEL 3 installer (same as RHEL 6, except for the kickstart template).
708 */
709class UnattendedRhel3Installer : public UnattendedRhel6Installer
710{
711public:
712 DECLARE_TRANSLATE_METHODS(UnattendedRhel3Installer)
713
714 UnattendedRhel3Installer(Unattended *pParent) : UnattendedRhel6Installer(pParent, "rhel3_ks.cfg") {}
715 ~UnattendedRhel3Installer() {}
716};
717
718
719/**
720 * Fedora installer (same as RHEL 6, except for the template).
721 */
722class UnattendedFedoraInstaller : public UnattendedRhel6Installer
723{
724public:
725 DECLARE_TRANSLATE_METHODS(UnattendedFedoraInstaller)
726
727 UnattendedFedoraInstaller(Unattended *pParent)
728 : UnattendedRhel6Installer(pParent, "fedora_ks.cfg")
729 { Assert(!isOriginalIsoNeeded()); Assert(isAuxiliaryIsoNeeded()); Assert(!isAuxiliaryFloppyNeeded()); Assert(isAuxiliaryIsoIsVISO()); }
730 ~UnattendedFedoraInstaller() {}
731};
732
733
734/**
735 * Oracle Linux 6 installer. Same as RHEL 6, except for the templates.
736 * The reason of adding new class is to sepatate the RHEL from OL.
737 */
738class UnattendedOracleLinux6Installer : public UnattendedRhel6Installer
739{
740public:
741 DECLARE_TRANSLATE_METHODS(UnattendedOracleLinux6Installer)
742
743 UnattendedOracleLinux6Installer(Unattended *pParent,
744 const char *pszMainScriptTemplateName = "ol_ks.cfg",
745 const char *pszPostScriptTemplateName = "ol_postinstall.sh",
746 const char *pszMainScriptFilename = "ks.cfg")
747 : UnattendedRhel6Installer(pParent, pszMainScriptTemplateName, pszPostScriptTemplateName, pszMainScriptFilename)
748 { Assert(!isOriginalIsoNeeded()); Assert(isAuxiliaryIsoNeeded()); Assert(!isAuxiliaryFloppyNeeded()); Assert(isAuxiliaryIsoIsVISO()); }
749 ~UnattendedOracleLinux6Installer() {}
750};
751
752
753/**
754 * Oracle Linux 7 installer. Same as OL 6.
755 * The class was added for better handling any possible subtle difference between OL6 and OL7.
756 */
757class UnattendedOracleLinux7Installer : public UnattendedOracleLinux6Installer
758{
759public:
760 DECLARE_TRANSLATE_METHODS(UnattendedOracleLinux7Installer)
761
762 UnattendedOracleLinux7Installer(Unattended *pParent)
763 : UnattendedOracleLinux6Installer(pParent)
764 { Assert(!isOriginalIsoNeeded()); Assert(isAuxiliaryIsoNeeded()); Assert(!isAuxiliaryFloppyNeeded()); Assert(isAuxiliaryIsoIsVISO()); }
765
766 UnattendedOracleLinux7Installer(Unattended *pParent,
767 const char *pszMainScriptTemplateName,
768 const char *pszPostScriptTemplateName,
769 const char *pszMainScriptFilename)
770 : UnattendedOracleLinux6Installer(pParent, pszMainScriptTemplateName, pszPostScriptTemplateName, pszMainScriptFilename)
771 { Assert(!isOriginalIsoNeeded()); Assert(isAuxiliaryIsoNeeded()); Assert(!isAuxiliaryFloppyNeeded()); Assert(isAuxiliaryIsoIsVISO()); }
772 ~UnattendedOracleLinux7Installer() {}
773};
774
775
776/**
777 * Oracle Linux 8 installer. Same as OL 7.
778 * The class was added for better handling any possible subtle difference between OL7 and OL8.
779 */
780class UnattendedOracleLinux8Installer : public UnattendedOracleLinux7Installer
781{
782public:
783 DECLARE_TRANSLATE_METHODS(UnattendedOracleLinux8Installer)
784
785 UnattendedOracleLinux8Installer(Unattended *pParent)
786 : UnattendedOracleLinux7Installer(pParent)
787 { Assert(!isOriginalIsoNeeded()); Assert(isAuxiliaryIsoNeeded()); Assert(!isAuxiliaryFloppyNeeded()); Assert(isAuxiliaryIsoIsVISO()); }
788
789 UnattendedOracleLinux8Installer(Unattended *pParent,
790 const char *pszMainScriptTemplateName,
791 const char *pszPostScriptTemplateName,
792 const char *pszMainScriptFilename)
793 : UnattendedOracleLinux7Installer(pParent, pszMainScriptTemplateName, pszPostScriptTemplateName, pszMainScriptFilename)
794 { Assert(!isOriginalIsoNeeded()); Assert(isAuxiliaryIsoNeeded()); Assert(!isAuxiliaryFloppyNeeded()); Assert(isAuxiliaryIsoIsVISO()); }
795 ~UnattendedOracleLinux8Installer() {}
796};
797
798#if 0 /* fixme */
799/**
800 * SUSE linux installer.
801 *
802 * @todo needs fixing.
803 */
804class UnattendedSuseInstaller : public UnattendedLinuxInstaller
805{
806public:
807 DECLARE_TRANSLATE_METHODS(UnattendedSuseInstaller)
808
809 UnattendedSuseInstaller(BaseTextScript *pAlg, Unattended *pParent)
810 : UnattendedLinuxInstaller(pAlg, pParent, "suse_autoinstall.xml")
811 { Assert(isOriginalIsoNeeded()); Assert(isAuxiliaryIsoNeeded()); Assert(!isAuxiliaryFloppyNeeded()); Assert(!isAuxiliaryIsoIsVISO()); }
812 ~UnattendedSuseInstaller() {}
813
814 HRESULT setupScriptOnAuxiliaryCD(const Utf8Str &path);
815};
816#endif
817
818#endif /* !MAIN_INCLUDED_UnattendedInstaller_h */
819
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