VirtualBox

Changeset 94532 in vbox


Ignore:
Timestamp:
Apr 8, 2022 4:28:32 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
150883
Message:

Main/Unattended: ​​bugref:9781. Adding a new attribute to IUNattended to indicate if network is accessible.

Location:
trunk/src/VBox/Main
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/UnattendedTemplates/debian_preseed.cfg

    r94175 r94532  
    4040d-i base-installer/kernel/override-image string linux-image-amd64
    4141d-i pkgsel/install-language-support boolean false
     42
     43@@VBOX_COND_IS_NETWORK_INACCESSIBLE@@
     44d-i apt-setup/use_mirror boolean false
     45d-i netcfg/no_default_route true
     46d-i netcfg/get_nameservers ""
     47@@VBOX_COND_END@@
     48
    4249@@VBOX_COND_IS_NOT_MINIMAL_INSTALLATION@@
    4350d-i apt-setup/restricted boolean true
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r94373 r94532  
    46764676  <interface
    46774677    name="IUnattended" extends="$unknown"
    4678     uuid="6f89464f-7193-426c-a4df-592e4e537fa0"
     4678    uuid="6f89464f-7773-426c-a4df-592e4e537fa0"
    46794679    wsmap="managed"
    46804680    reservedMethods="4" reservedAttributes="16"
     
    50145014      </desc>
    50155015    </attribute>
     5016
    50165017    <attribute name="detectedImageNames" type="wstring" readonly="yes" safearray="yes">
    50175018      <desc>
     
    50355036        whether unattended install is supported or not. Note that failing detecting
    50365037        OS type from the ISO causes this attribute to be false by default.
     5038      </desc>
     5039    </attribute>
     5040
     5041    <attribute name="isNetworkAccessible" type="boolean">
     5042      <desc>
     5043        Indicates whether internet is accessible. Currently setting this to
     5044        false configures debian preseed files so that package mirrors are not
     5045        used.
    50375046      </desc>
    50385047    </attribute>
  • trunk/src/VBox/Main/include/UnattendedImpl.h

    r94079 r94532  
    100100    bool           i_isFirmwareEFI() const;
    101101    Utf8Str const &i_getDetectedOSVersion();
    102 
     102    bool           i_getIsNetworkAccessible() const;
    103103
    104104private:
     
    148148    Utf8Str         mStrDetectedOSHints;
    149149    RTCList<WIMImage> mDetectedImages;
     150    bool            mfIsNetworkAccessible;
    150151    /** @} */
    151152
     
    232233    HRESULT getDetectedImageIndices(std::vector<ULONG> &aDetectedImageIndices);
    233234    HRESULT getIsUnattendedInstallSupported(BOOL *aIsUnattendedInstallSupported);
     235    HRESULT getIsNetworkAccessible(BOOL *aIsNetworkAccessible);
     236    HRESULT setIsNetworkAccessible(BOOL aIsNetworkAccessible);
    234237    //internal functions
    235238
  • trunk/src/VBox/Main/src-server/UnattendedImpl.cpp

    r94297 r94532  
    242242    : mhThreadReconfigureVM(NIL_RTNATIVETHREAD), mfRtcUseUtc(false), mfGuestOs64Bit(false)
    243243    , mpInstaller(NULL), mpTimeZoneInfo(NULL), mfIsDefaultAuxiliaryBasePath(true), mfDoneDetectIsoOS(false)
     244    , mfIsNetworkAccessible(true)
    244245{ }
    245246
     
    36423643}
    36433644
     3645HRESULT Unattended::getIsNetworkAccessible(BOOL *aIsNetworkAccessible)
     3646{
     3647    *aIsNetworkAccessible = mfIsNetworkAccessible;
     3648    return S_OK;
     3649}
     3650
     3651HRESULT Unattended::setIsNetworkAccessible(BOOL aIsNetworkAccessible)
     3652{
     3653    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     3654    AssertReturn(mpInstaller == NULL, setErrorBoth(E_FAIL, VERR_WRONG_ORDER, tr("Cannot change after prepare() has been called")));
     3655    mfIsNetworkAccessible = RT_BOOL(aIsNetworkAccessible);
     3656    return S_OK;
     3657}
     3658
    36443659/*
    36453660 * Getters that the installer and script classes can use.
     
    38163831    Assert(isReadLockedOnCurrentThread());
    38173832    return mStrDetectedOSVersion;
     3833}
     3834
     3835bool Unattended::i_getIsNetworkAccessible() const
     3836{
     3837    Assert(isReadLockedOnCurrentThread());
     3838    return mfIsNetworkAccessible;
    38183839}
    38193840
  • trunk/src/VBox/Main/src-server/UnattendedScript.cpp

    r93954 r94532  
    793793    else if (IS_PLACEHOLDER_MATCH("HAS_PROXY"))
    794794        *pfOutputting = mpUnattended->i_getProxy().isNotEmpty();
     795    else if (IS_PLACEHOLDER_MATCH("IS_NETWORK_ACCESSIBLE"))
     796        *pfOutputting = !mpUnattended->i_getIsNetworkAccessible();
    795797    else
    796798        return mpSetError->setErrorBoth(E_FAIL, VERR_NOT_FOUND, tr("Unknown conditional placeholder '%.*s'"),
  • trunk/src/VBox/Main/testcase/tstUnattendedScript.cpp

    r94075 r94532  
    457457}
    458458
     459HRESULT Unattended::getIsNetworkAccessible(BOOL *aIsNetworkAccessible)
     460{
     461    RT_NOREF(aIsNetworkAccessible);
     462    return E_NOTIMPL;
     463}
     464
     465HRESULT Unattended::setIsNetworkAccessible(BOOL aIsNetworkAccessible)
     466{
     467    RT_NOREF(aIsNetworkAccessible);
     468    return E_NOTIMPL;
     469}
     470
     471
    459472/*
    460473 * Getters that the installer and script classes can use.
     
    603616{
    604617    return mStrDetectedOSVersion;
     618}
     619
     620bool Unattended::i_getIsNetworkAccessible() const
     621{
     622    return mfIsNetworkAccessible;
    605623}
    606624
Note: See TracChangeset for help on using the changeset viewer.

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