VirtualBox

Changeset 68140 in vbox for trunk


Ignore:
Timestamp:
Jul 27, 2017 3:16:23 PM (7 years ago)
Author:
vboxsync
Message:

VBoxManage/unattended: Do the sub-command thing, moving the current operation to 'install' and adding a 'detect' sub-command for probing an ISO. Moved documentation to man_VBoxManage-unattended.xml (lots to do here).

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/manual/Makefile.kmk

    r67323 r68140  
    192192VBOX_MANUAL_XML_REFENTRY_FILES = \
    193193        man_VBoxManage-debugvm.xml \
    194         man_VBoxManage-extpack.xml
     194        man_VBoxManage-extpack.xml \
     195        man_VBoxManage-unattended.xml
    195196
    196197
  • trunk/doc/manual/en_US/man_VBoxManage-unattended.xml

    r68030 r68140  
    3737
    3838  <refsynopsisdiv>
    39     <cmdsynopsis id="synopsis-vboxmanage-unattended"> <!-- The 'id' is mandatory and must start with 'synopsis-'. -->
    40       <command>VBoxManage unattended</command>
     39    <cmdsynopsis id="synopsis-vboxmanage-unattended-detect"> <!-- The 'id' is mandatory and must start with 'synopsis-'. -->
     40      <command>VBoxManage unattended detect</command>
     41      <arg choice="req">--iso=<replaceable>install-iso</replaceable></arg>
     42      <arg>--machine-readable</arg>
     43    </cmdsynopsis>
     44    <cmdsynopsis id="synopsis-vboxmanage-unattended-install"> <!-- The 'id' is mandatory and must start with 'synopsis-'. -->
     45      <command>VBoxManage unattended install</command>
    4146      <arg choice="req"><replaceable>uuid|vmname</replaceable></arg>
    42       <arg choice="req">--iso-path=<replaceable>install-iso</replaceable></arg>
     47      <arg choice="req">--iso=<replaceable>install-iso</replaceable></arg>
     48      <arg choice="req">incomplete</arg>
    4349    </cmdsynopsis>
    4450  </refsynopsisdiv>
     
    4753    <title>Description</title>
    4854
    49     <refsect2 id="vboxmanage-unattended">
    50       <title>unattended installation</title>
     55    <refsect2 id="vboxmanage-unattended-detect">
     56      <title>unattended detect</title>
    5157      <remark role="help-copy-synopsis"/>
    5258      <para>
    53         docs.
     59        Detects the guest operating system (OS) on the specified installation ISO
     60        and displays the result.  This can be used as input when creating a VM for
     61        the ISO to be installed in.
     62      </para>
     63      <variablelist>
     64        <varlistentry>
     65          <term><option>--iso=<replaceable>install-iso</replaceable></option></term>
     66          <listitem><para>The installation ISO to run the detection on.</para></listitem>
     67        </varlistentry>
     68        <varlistentry>
     69          <term><option>--machine-readable</option></term>
     70          <listitem><para>Produce output that is simpler to parse from a script.</para></listitem>
     71        </varlistentry>
     72      </variablelist>
     73    </refsect2>
     74
     75    <refsect2 id="vboxmanage-unattended-install">
     76      <title>unattended install</title>
     77      <remark role="help-copy-synopsis"/>
     78      <para>
     79        Reconfigures the specified VM for installation and optionally starts it up.
    5480      </para>
    5581      <variablelist>
     
    5884          <listitem><para>Either the UUID or the name (case sensitive) of a VM.</para></listitem>
    5985        </varlistentry>
     86        <varlistentry>
     87          <term><option>--iso=<replaceable>install-iso</replaceable></option></term>
     88          <listitem><para>The installation ISO to run the detection on.</para></listitem>
     89        </varlistentry>
     90        <!-- a lot more stuff here to document. -->
    6091      </variablelist>
    6192    </refsect2>
  • trunk/doc/manual/en_US/user_VBoxManage.xml

    r67240 r68140  
    26872687  </sect1>
    26882688
    2689 <sect1 id="vboxmanage-unattended">
    2690     <title>VBoxManage unattended</title>
    2691  
    2692     <para>The <computeroutput>unattended</computeroutput> subcommand allows you to run unattended
    2693     guest installation from the command line.
    2694     User is able to choose passing the settings for unattended installation via:
    2695       <itemizedlist>
    2696         <listitem>
    2697           <para>passing the data via a file with prepared settings using
    2698           <computeroutput>VBoxManage unattended usefile</computeroutput>
    2699           </para>
    2700           <itemizedlist>
    2701             <listitem>
    2702               <para><computeroutput>--settingfile
    2703               &lt;file&gt;</computeroutput>:
    2704               specifies a file with all settings needed for unattended installation. </para>
    2705             </listitem>
    2706           </itemizedlist>
    2707  
    2708           <para>In this case correctness of all settings and data lays upon on the user.</para>
    2709  
    2710         </listitem>
    2711  
    2712         <listitem>
    2713           <para>the command line using
    2714           <computeroutput>VBoxManage unattended usedata</computeroutput></para>
    2715           <para>Command line settings are:</para>
    2716           <itemizedlist>
    2717             <listitem>
    2718               <para><computeroutput>--user
    2719               &lt;user name&gt;</computeroutput>:
    2720               specifies a login name for the guest OS. </para>
    2721             </listitem>
    2722  
    2723             <listitem>
    2724               <para><computeroutput>--password
    2725               &lt;password&gt;</computeroutput>:
    2726               user's password for the logging to the guest OS. </para>
    2727             </listitem>
    2728  
    2729             <listitem>
    2730               <para><computeroutput>--key
    2731               &lt;key&gt;</computeroutput>:
    2732               product key for validating the installed OS. </para>
    2733             </listitem>
    2734  
    2735             <listitem>
    2736               <para><computeroutput>--isopath
    2737               &lt;OS ISO path&gt;</computeroutput>:
    2738               CD\DVD disk or ISO image with OS installation data. </para>
    2739             </listitem>
    2740  
    2741             <listitem>
    2742                <para><computeroutput>--addisopath
    2743               &lt;additions ISO path&gt;</computeroutput>:
    2744               ISO image with Virtualbox additions. Optional. </para>
    2745             </listitem>
    2746  
    2747             <listitem>
    2748               <para><computeroutput>--imageindex
    2749               &lt;number&gt;</computeroutput>:
    2750               The installation disk can contains the several images of OS (for example 32bits and 64bits systems).
    2751               At moment used only for Windows OS installation. Optional.
    2752               </para>
    2753             </listitem>
    2754  
    2755           </itemizedlist>
    2756         </listitem>
    2757       </itemizedlist>
    2758     </para>
    2759  
    2760     <para>The setting file has a simple structure as "key equal sign value".
    2761     One key is one line, at moment there are eight settings which supported by the command:
    2762       <itemizedlist>
    2763         <listitem>
    2764           <para><computeroutput>
    2765           username</computeroutput>:
    2766            See above description for "--username"</para>
    2767         </listitem>
    2768  
    2769         <listitem>
    2770           <para><computeroutput>
    2771           password</computeroutput>:
    2772           See above description for "--password"</para>
    2773         </listitem>
    2774  
    2775         <listitem>
    2776           <para><computeroutput>
    2777           key</computeroutput>:
    2778           See above description for "--key"</para>
    2779         </listitem>
    2780  
    2781         <listitem>
    2782           <para><computeroutput>
    2783           installation_iso</computeroutput>:
    2784           See above description for "--isopath"</para>
    2785         </listitem>
    2786  
    2787         <listitem>
    2788           <para><computeroutput>
    2789           addition_iso</computeroutput>:
    2790           See above description for "--addisopath"</para>
    2791         </listitem>
    2792  
    2793         <listitem>
    2794           <para><computeroutput>
    2795           aux_iso</computeroutput>:
    2796           Auxiliary CD disk which can be used during installation as simple bootable CD with unattended script on it.
    2797           Generally used for Linux installation.</para>
    2798         </listitem>
    2799  
    2800         <listitem>
    2801           <para><computeroutput>
    2802           aux_floppy</computeroutput>:
    2803           Auxiliary floppy disk which can be used during installation as source of unattended script used by the installer.
    2804           Generally used for Windows installation.
    2805           </para>
    2806         </listitem>
    2807  
    2808         <listitem>
    2809           <para><computeroutput>
    2810           image_index</computeroutput>:
    2811           See above description for "--imageindex".</para>
    2812         </listitem>
    2813       </itemizedlist>
    2814         <note>
    2815           <para>The most of parameters are the same parameters as passed via the command line
    2816           and two of them are related to two items which can be created on the fly during installation (it's auxiliary floppy and CD).
    2817           </para>
    2818         </note>
    2819     </para>
    2820  
    2821     <para>
    2822     Example "VBoxManage unattended usedata":
    2823     </para>
    2824     <para>
    2825     <computeroutput>
    2826     VBoxManage unattended 2a524618-dd30-4168-bd53-645d9d72bb25 usedata
    2827     --user smith
    2828     --password smile
    2829     --isopath /path/to/the/distributive/ubuntu-16.04.1-server-amd64.iso
    2830     --addisopath /path/to/Virtualbox/additions/VBoxGuestAdditions.iso
    2831     </computeroutput>
    2832     </para>
    2833 
    2834     <para>
    2835     Example "VBoxManage unattended usefile":
    2836     </para>
    2837     <para><computeroutput>
    2838     VBoxManage unattended 2a524618-dd30-4168-bd53-645d9d72bb25 usefile
    2839     --settingfile /path/to/the/file/unattended_settings.txt
    2840     </computeroutput></para>
    2841 
    2842   </sect1>
    2843 
    28442689  <sect1>
    28452690    <title>VBoxManage discardstate</title>
     
    59435788
    59445789
    5945   <xi:include href="user_man_VBoxManage-debugvm.xml" xpointer="element(/1)"
    5946     xmlns:xi="http://www.w3.org/2001/XInclude" />
    5947 
    5948   <xi:include href="user_man_VBoxManage-extpack.xml" xpointer="element(/1)"
    5949     xmlns:xi="http://www.w3.org/2001/XInclude" />
     5790  <xi:include href="user_man_VBoxManage-debugvm.xml"    xpointer="element(/1)" xmlns:xi="http://www.w3.org/2001/XInclude" />
     5791  <xi:include href="user_man_VBoxManage-extpack.xml"    xpointer="element(/1)" xmlns:xi="http://www.w3.org/2001/XInclude" />
     5792  <xi:include href="user_man_VBoxManage-unattended.xml" xpointer="element(/1)" xmlns:xi="http://www.w3.org/2001/XInclude" />
    59505793</chapter>
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp

    r64997 r68140  
    120120    { "startvm",            USAGE_STARTVM,          VBMG_CMD_TODO, handleStartVM,              0 },
    121121    { "controlvm",          USAGE_CONTROLVM,        VBMG_CMD_TODO, handleControlVM,            0 },
    122     { "unattended",         USAGE_UNATTENDEDINSTALL,VBMG_CMD_TODO, handleUnattendedInstall,    0 },
     122    { "unattended",         USAGE_UNATTENDEDINSTALL, HELP_CMD_UNATTENDED, handleUnattended,    0 },
    123123    { "discardstate",       USAGE_DISCARDSTATE,     VBMG_CMD_TODO, handleDiscardState,         0 },
    124124    { "adoptstate",         USAGE_ADOPTSTATE,       VBMG_CMD_TODO, handleAdoptState,           0 },
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h

    r65049 r68140  
    216216/* VBoxManageControlVM.cpp */
    217217RTEXITCODE handleControlVM(HandlerArg *a);
    218 RTEXITCODE handleUnattendedInstall(HandlerArg *a);
    219218#ifndef VBOX_ONLY_DOCS
    220219unsigned int getMaxNics(IVirtualBox* vbox, IMachine* mach);
     
    277276RTEXITCODE handleSharedFolder(HandlerArg *a);
    278277RTEXITCODE handleExtPack(HandlerArg *a);
     278RTEXITCODE handleUnattended(HandlerArg *a);
    279279
    280280/* VBoxManageDisk.cpp */
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp

    r68055 r68140  
    10211021    }
    10221022
    1023     if (fCategory & USAGE_UNATTENDEDINSTALL)
    1024         RTStrmPrintf(pStrm, /* This will be replaced by a docbook man page. */
    1025                            "%s unattended %s      <uuid|vmname>\n"
    1026                      "         <OUTDATED-TODO>    --settings-file <file>\n"
    1027                      "         <OUTDATED-TODO>    [--session-type <type>]\n"
    1028                            "%s unattended %s      <uuid|vmname>\n"
    1029                      "         <OUTDATED-TODO>    --user <user>\n"
    1030                      "         <OUTDATED-TODO>    --password <password>\n"
    1031                      "         <OUTDATED-TODO>    --iso-path <path>\n"
    1032                      "         <OUTDATED-TODO>    [--key <CD-key>]\n"
    1033                      "         <OUTDATED-TODO>    [--additions-iso-path <path>]\n"
    1034                      "         <OUTDATED-TODO>    [--install-additions]\n"
    1035                      "         <OUTDATED-TODO>    [--image-index <index>]\n"
    1036                      "         <OUTDATED-TODO>    [--session-type <type>]\n"
    1037                      "\n", SEP, SEP);
    1038 
    10391023    if (fCategory & USAGE_DISCARDSTATE)
    10401024        RTStrmPrintf(pStrm,
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp

    r68135 r68140  
    55
    66/*
    7  * Copyright (C) 2006-2016 Oracle Corporation
     7 * Copyright (C) 2006-2017 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    12681268}
    12691269
     1270RTEXITCODE handleUnattendedDetect(HandlerArg *a)
     1271{
     1272    HRESULT hrc;
     1273
     1274    /*
     1275     * Options.  We work directly on an IUnattended instace while parsing
     1276     * the options.  This saves a lot of extra clutter.
     1277     */
     1278    bool    fMachineReadable = false;
     1279    char    szIsoPath[RTPATH_MAX];
     1280    szIsoPath[0] = '\0';
     1281
     1282    /*
     1283     * Parse options.
     1284     */
     1285    static const RTGETOPTDEF s_aOptions[] =
     1286    {
     1287        { "--iso",                              'i', RTGETOPT_REQ_STRING },
     1288        { "--machine-readable",                 'M', RTGETOPT_REQ_NOTHING },
     1289    };
     1290
     1291    RTGETOPTSTATE GetState;
     1292    int vrc = RTGetOptInit(&GetState, a->argc, a->argv, s_aOptions, RT_ELEMENTS(s_aOptions), 0, RTGETOPTINIT_FLAGS_OPTS_FIRST);
     1293    AssertRCReturn(vrc, RTEXITCODE_FAILURE);
     1294
     1295    int c;
     1296    RTGETOPTUNION ValueUnion;
     1297    while ((c = RTGetOpt(&GetState, &ValueUnion)) != 0)
     1298    {
     1299        switch (c)
     1300        {
     1301            case 'i': // --iso
     1302                vrc = RTPathAbs(ValueUnion.psz, szIsoPath, sizeof(szIsoPath));
     1303                if (RT_FAILURE(vrc))
     1304                    return errorSyntax("RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
     1305                break;
     1306
     1307            case 'M': // --machine-readable.
     1308                fMachineReadable = true;
     1309                break;
     1310
     1311            default:
     1312                return errorGetOpt(c, &ValueUnion);
     1313        }
     1314    }
     1315
     1316    /*
     1317     * Check for required stuff.
     1318     */
     1319    if (szIsoPath[0] == '\0')
     1320        return errorSyntax("No ISO specified");
     1321
     1322    /*
     1323     * Do the job.
     1324     */
     1325    ComPtr<IUnattended> ptrUnattended;
     1326    CHECK_ERROR2_RET(hrc, a->virtualBox, CreateUnattendedInstaller(ptrUnattended.asOutParam()), RTEXITCODE_FAILURE);
     1327    CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(IsoPath)(Bstr(szIsoPath).raw()), RTEXITCODE_FAILURE);
     1328    CHECK_ERROR2_RET(hrc, ptrUnattended, DetectIsoOS(), RTEXITCODE_FAILURE);
     1329
     1330    /*
     1331     * Retrieve the results.
     1332     */
     1333    Bstr bstrDetectedOSTypeId;
     1334    CHECK_ERROR2_RET(hrc, ptrUnattended, COMGETTER(DetectedOSTypeId)(bstrDetectedOSTypeId.asOutParam()), RTEXITCODE_FAILURE);
     1335    Bstr bstrDetectedVersion;
     1336    CHECK_ERROR2_RET(hrc, ptrUnattended, COMGETTER(DetectedOSVersion)(bstrDetectedVersion.asOutParam()), RTEXITCODE_FAILURE);
     1337    Bstr bstrDetectedFlavor;
     1338    CHECK_ERROR2_RET(hrc, ptrUnattended, COMGETTER(DetectedOSFlavor)(bstrDetectedFlavor.asOutParam()), RTEXITCODE_FAILURE);
     1339    Bstr bstrDetectedHints;
     1340    CHECK_ERROR2_RET(hrc, ptrUnattended, COMGETTER(DetectedOSHints)(bstrDetectedHints.asOutParam()), RTEXITCODE_FAILURE);
     1341    if (fMachineReadable)
     1342        RTPrintf("OSTypeId=\"%ls\"\n"
     1343                 "OSVersion=\"%ls\"\n"
     1344                 "OSFlavor=\"%ls\"\n"
     1345                 "OSHints=\"%ls\"\n",
     1346                 bstrDetectedOSTypeId.raw(),
     1347                 bstrDetectedVersion.raw(),
     1348                 bstrDetectedFlavor.raw(),
     1349                 bstrDetectedHints.raw());
     1350    else
     1351    {
     1352        RTMsgInfo("Detected '%s' to be:\n", szIsoPath);
     1353        RTPrintf("    OS TypeId  = %ls\n"
     1354                 "    OS Version = %ls\n"
     1355                 "    OS Flavor  = %ls\n"
     1356                 "    OS Hints   = %ls\n",
     1357                 bstrDetectedOSTypeId.raw(),
     1358                 bstrDetectedVersion.raw(),
     1359                 bstrDetectedFlavor.raw(),
     1360                 bstrDetectedHints.raw());
     1361    }
     1362
     1363    return RTEXITCODE_SUCCESS;
     1364}
     1365
    12701366RTEXITCODE handleUnattendedInstall(HandlerArg *a)
    12711367{
     
    12811377    RTCList<RTCString>  arrPackageSelectionAdjustments;
    12821378    ComPtr<IMachine>    ptrMachine;
     1379    bool                fDryRun = false;
    12831380    const char         *pszSessionType = "headless";
    12841381
     
    12861383     * Parse options.
    12871384     */
    1288     if (a->argc <= 1)
    1289         return errorSyntax(USAGE_UNATTENDEDINSTALL, "Missing VM name/UUID.");
    1290 
    12911385    static const RTGETOPTDEF s_aOptions[] =
    12921386    {
     
    13081402        { "--hostname",                         'H', RTGETOPT_REQ_STRING },
    13091403        { "--package-selection-adjustment",     's', RTGETOPT_REQ_STRING },
     1404        { "--dry-run",                          'D', RTGETOPT_REQ_NOTHING },
    13101405        // advance options:
    13111406        { "--auxiliary-base-path",              'x', RTGETOPT_REQ_STRING },
     
    13311426            case VINF_GETOPT_NOT_OPTION:
    13321427                if (ptrMachine.isNotNull())
    1333                     return errorSyntax(USAGE_UNATTENDEDINSTALL, "VM name/UUID given more than once!");
     1428                    return errorSyntax("VM name/UUID given more than once!");
    13341429                CHECK_ERROR2_RET(hrc, a->virtualBox, FindMachine(Bstr(ValueUnion.psz).raw(), ptrMachine.asOutParam()), RTEXITCODE_FAILURE);
    13351430                CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(Machine)(ptrMachine), RTEXITCODE_FAILURE);
     
    13391434                vrc = RTPathAbs(ValueUnion.psz, szAbsPath, sizeof(szAbsPath));
    13401435                if (RT_FAILURE(vrc))
    1341                     return errorSyntax(USAGE_UNATTENDEDINSTALL, "RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
     1436                    return errorSyntax("RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
    13421437                CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(IsoPath)(Bstr(szAbsPath).raw()), RTEXITCODE_FAILURE);
    13431438                break;
     
    13681463                vrc = RTPathAbs(ValueUnion.psz, szAbsPath, sizeof(szAbsPath));
    13691464                if (RT_FAILURE(vrc))
    1370                     return errorSyntax(USAGE_UNATTENDEDINSTALL, "RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
     1465                    return errorSyntax("RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
    13711466                CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(AdditionsIsoPath)(Bstr(szAbsPath).raw()), RTEXITCODE_FAILURE);
    13721467                break;
     
    13811476                vrc = RTPathAbs(ValueUnion.psz, szAbsPath, sizeof(szAbsPath));
    13821477                if (RT_FAILURE(vrc))
    1383                     return errorSyntax(USAGE_UNATTENDEDINSTALL, "RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
     1478                    return errorSyntax("RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
    13841479                CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(ValidationKitIsoPath)(Bstr(szAbsPath).raw()), RTEXITCODE_FAILURE);
    13851480                break;
     
    14071502            case 's':   // --package-selection-adjustment
    14081503                arrPackageSelectionAdjustments.append(ValueUnion.psz);
     1504                break;
     1505
     1506            case 'D':
     1507                fDryRun = true;
    14091508                break;
    14101509
     
    14121511                vrc = RTPathAbs(ValueUnion.psz, szAbsPath, sizeof(szAbsPath));
    14131512                if (RT_FAILURE(vrc))
    1414                     return errorSyntax(USAGE_UNATTENDEDINSTALL, "RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
     1513                    return errorSyntax("RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
    14151514                CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(AuxiliaryBasePath)(Bstr(szAbsPath).raw()), RTEXITCODE_FAILURE);
    14161515                break;
     
    14231522                vrc = RTPathAbs(ValueUnion.psz, szAbsPath, sizeof(szAbsPath));
    14241523                if (RT_FAILURE(vrc))
    1425                     return errorSyntax(USAGE_UNATTENDEDINSTALL, "RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
     1524                    return errorSyntax("RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
    14261525                CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(ScriptTemplatePath)(Bstr(szAbsPath).raw()), RTEXITCODE_FAILURE);
    14271526                break;
     
    14301529                vrc = RTPathAbs(ValueUnion.psz, szAbsPath, sizeof(szAbsPath));
    14311530                if (RT_FAILURE(vrc))
    1432                     return errorSyntax(USAGE_UNATTENDEDINSTALL, "RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
     1531                    return errorSyntax("RTPathAbs failed on '%s': %Rrc", ValueUnion.psz, vrc);
    14331532                CHECK_ERROR2_RET(hrc, ptrUnattended, COMSETTER(PostInstallScriptTemplatePath)(Bstr(szAbsPath).raw()), RTEXITCODE_FAILURE);
    14341533                break;
     
    14471546
    14481547            default:
    1449                 return errorGetOpt(USAGE_UNATTENDEDINSTALL, c, &ValueUnion);
     1548                return errorGetOpt(c, &ValueUnion);
    14501549        }
    14511550    }
     
    14551554     */
    14561555    if (ptrMachine.isNull())
    1457         return errorSyntax(USAGE_UNATTENDEDINSTALL, "Missing VM name/UUID");
     1556        return errorSyntax("Missing VM name/UUID");
    14581557
    14591558    /*
     
    15041603
    15051604    CHECK_ERROR2_RET(hrc, ptrUnattended,Prepare(), RTEXITCODE_FAILURE);
    1506     CHECK_ERROR2_RET(hrc, ptrUnattended,ConstructMedia(), RTEXITCODE_FAILURE);
    1507     CHECK_ERROR2_RET(hrc, ptrUnattended,ReconfigureVM(), RTEXITCODE_FAILURE);
     1605    if (!fDryRun)
     1606    {
     1607        CHECK_ERROR2_RET(hrc, ptrUnattended, ConstructMedia(), RTEXITCODE_FAILURE);
     1608        CHECK_ERROR2_RET(hrc, ptrUnattended,ReconfigureVM(), RTEXITCODE_FAILURE);
     1609    }
    15081610
    15091611    /*
     
    15631665     * Start the VM if requested.
    15641666     */
    1565     if (RTStrICmp(pszSessionType, "none") == 0)
     1667    if (   fDryRun
     1668        || RTStrICmp(pszSessionType, "none") == 0)
    15661669        hrc = S_OK;
    15671670    else
     
    16171720    return SUCCEEDED(hrc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
    16181721}
     1722
     1723
     1724RTEXITCODE handleUnattended(HandlerArg *a)
     1725{
     1726    /*
     1727     * Sub-command switch.
     1728     */
     1729    if (a->argc < 1)
     1730        return errorNoSubcommand();
     1731
     1732    if (!strcmp(a->argv[0], "detect"))
     1733    {
     1734        setCurrentSubcommand(HELP_SCOPE_UNATTENDED_DETECT);
     1735        return handleUnattendedDetect(a);
     1736    }
     1737
     1738    if (!strcmp(a->argv[0], "install"))
     1739    {
     1740        setCurrentSubcommand(HELP_SCOPE_UNATTENDED_INSTALL);
     1741        return handleUnattendedInstall(a);
     1742    }
     1743
     1744    /* Consider some kind of create-vm-and-install-guest-os command. */
     1745    return errorUnknownSubcommand(a->argv[0]);
     1746}
Note: See TracChangeset for help on using the changeset viewer.

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