summaryrefslogtreecommitdiff
path: root/src/mongo/installer
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2017-12-11 14:41:32 -0500
committerMark Benvenuto <mark.benvenuto@mongodb.com>2017-12-11 14:41:32 -0500
commit2ea580cd77382a841c7cd6c8097cfd3d195698f0 (patch)
tree19f937384b2bb0ae0157ae42b41b1db8760237c9 /src/mongo/installer
parent06b3488461d820c9081e5d7fca0fc028470922ea (diff)
downloadmongo-2ea580cd77382a841c7cd6c8097cfd3d195698f0.tar.gz
SERVER-14263 Install MongoDB as service on Windows
Diffstat (limited to 'src/mongo/installer')
-rw-r--r--src/mongo/installer/msi/SConscript29
-rw-r--r--src/mongo/installer/msi/ca/CustomAction.cpp426
-rw-r--r--src/mongo/installer/msi/ca/CustomAction.def6
-rw-r--r--src/mongo/installer/msi/ca/SConscript33
-rw-r--r--src/mongo/installer/msi/ca/targetver.h54
-rw-r--r--src/mongo/installer/msi/wxs/BinaryFragment.wxs46
-rw-r--r--src/mongo/installer/msi/wxs/FeatureFragment.wxs20
-rw-r--r--src/mongo/installer/msi/wxs/Installer_64.wxs151
-rw-r--r--src/mongo/installer/msi/wxs/UIFragment.wxs123
9 files changed, 843 insertions, 45 deletions
diff --git a/src/mongo/installer/msi/SConscript b/src/mongo/installer/msi/SConscript
index 56f8fb09359..4e897873293 100644
--- a/src/mongo/installer/msi/SConscript
+++ b/src/mongo/installer/msi/SConscript
@@ -7,6 +7,15 @@ Import("has_option")
env = env.Clone()
+env.SConscript(
+ dirs=[
+ 'ca',
+ ],
+ exports=[
+ 'env',
+ ],
+)
+
env['WIX'] = os.environ.get('WIX')
env['WIXPATH'] = r'$WIX\bin'
env['WIXHEAT'] = r'$WIXPATH\heat.exe'
@@ -111,8 +120,7 @@ env.Command(objects,
' -dEdition=' + msi_edition +
' -d"ProductId=*\"'
' -dUpgradeCode=' + upgrade_code +
- ' -dClientSource=' + buildDir + r'\client_build'
- r' -dClientHeaderSource=${INSTALL_DIR}\include\mongo'
+ ' -dCustomActionDll=' + buildDir + r'\mongo\installer\msi\ca\mongoca.dll'
' -dConfiguration=Release'
' -dOutDir=' + buildDir + r'\msi'
' -dPlatform=' + msi_platform +
@@ -129,6 +137,7 @@ env.Command(objects,
' -out ' + buildDir + r'\msi\\'
' -arch ' + msi_platform +
' -ext "$WIXUIEXT"'
+ ' -ext "$WIXUTILEXT"'
' $SOURCES')
#light: link .objs into an msi
@@ -139,18 +148,28 @@ pre_msi = "$BUILD_DIR/msi/${SERVER_DIST_BASENAME}.pre.msi"
# -- https://msdn.microsoft.com/en-us/library/windows/desktop/aa369037(v=vs.85).aspx
# ICE82 - Suppress "duplicate sequence number"
# -- https://msdn.microsoft.com/en-us/library/windows/desktop/aa368798(v=vs.85).aspx
-#
+# ICE30 - Suppress "different components install same file"
+# -- mongod.exe is installed in two different components but only one is ever used during an install
+# so this consistency check can be ignored.
+# -- https://msdn.microsoft.com/en-us/library/windows/desktop/aa368954(v=vs.85).aspx
pre_msi_cmd = env.Command(pre_msi,
objects,
- '"$WIXLIGHT" -out ${TARGET} -wx -cultures:null -sice:ICE82 -sice:ICE03'
- ' -ext "$WIXUIEXT" -ext "$WIXUTILEXT"'
+ '"$WIXLIGHT" -out ${TARGET} -wx -cultures:null -sice:ICE82 -sice:ICE03 -sice:ICE30'
+ ' -ext "$WIXUIEXT"'
+ ' -ext "$WIXUTILEXT"'
' ${SOURCES}')
+# Generated Dependencies
env.Depends(pre_msi_cmd, '$BUILD_DIR/mongo/mongo.exe')
env.Depends(pre_msi_cmd, '$BUILD_DIR/mongo/mongod.exe')
env.Depends(pre_msi_cmd, '$BUILD_DIR/mongo/mongos.exe')
env.Depends(pre_msi_cmd, '$BUILD_DIR/mongo/mongoperf.exe')
+env.Depends(pre_msi_cmd, '$BUILD_DIR/mongo/installer/msi/ca/mongoca.dll')
+env.Depends(pre_msi_cmd, '#src/mongo/installer/compass/Install-Compass.ps1')
+
+# Source Dependencies
+env.Depends(pre_msi_cmd, '#buildscripts/packaging/msi/mongod.yaml')
if 'enterprise' in env['MONGO_MODULES']:
env.Depends(pre_msi_cmd, "#" + enterpriseToolBuildDir + "/mongodecrypt.exe")
diff --git a/src/mongo/installer/msi/ca/CustomAction.cpp b/src/mongo/installer/msi/ca/CustomAction.cpp
new file mode 100644
index 00000000000..3bdb2fd9fe4
--- /dev/null
+++ b/src/mongo/installer/msi/ca/CustomAction.cpp
@@ -0,0 +1,426 @@
+/**
+ * Copyright (C) 2017 MongoDB Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the GNU Affero General Public License in all respects
+ * for all of the code used other than as permitted herein. If you modify
+ * file(s) with this exception, you may extend this exception to your
+ * version of the file(s), but you are not obligated to do so. If you do not
+ * wish to do so, delete this exception statement from your version. If you
+ * delete this exception statement from all source files in the program,
+ * then also delete it in the license file.
+ */
+
+/**
+ * Note: This file is included in the install package and used during installation.
+ *
+ * It supposed to be linked to a static C-runtime, and should not depend on other MongoDB
+ * components.
+ */
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+
+#include "targetver.h"
+
+// clang-format off
+#include <windows.h>
+#include <msiquery.h>
+// clang-format on
+
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "mongo/util/scopeguard.h"
+
+// UpdateMongoYAML CustomAction Constants
+constexpr wchar_t kBIN[] = L"BIN";
+constexpr wchar_t kMongoDataPath[] = L"MONGO_DATA_PATH";
+constexpr wchar_t kMongoLogPath[] = L"MONGO_LOG_PATH";
+
+// YAML Subsitution Constants
+constexpr char kMongoDataPathYaml[] = "%MONGO_DATA_PATH%";
+constexpr char kMongoLogPathYaml[] = "%MONGO_LOG_PATH%";
+
+// Service Account Constants - from Installer_64.wxs
+constexpr wchar_t kMongoServiceAccountName[] = L"MONGO_SERVICE_ACCOUNT_NAME";
+constexpr wchar_t kMongoServiceAccountPassword[] = L"MONGO_SERVICE_ACCOUNT_PASSWORD";
+constexpr wchar_t kMongoServiceAccountDomain[] = L"MONGO_SERVICE_ACCOUNT_DOMAIN";
+
+/**
+ * Log a messge to MSIExec's log file.
+ *
+ * Does not work for immediately executed custom actions.
+ */
+HRESULT LogMessage(MSIHANDLE hInstall, INSTALLMESSAGE eMessageType, char const* format, ...) {
+ va_list args;
+ const size_t bufSize = 4096;
+ char buf[bufSize];
+
+ va_start(args, format);
+ vsnprintf_s(buf, bufSize, format, args);
+ va_end(args);
+
+ PMSIHANDLE hRecord = ::MsiCreateRecord(1);
+
+ if (NULL != hRecord) {
+ HRESULT hr = ::MsiRecordSetStringA(hRecord, 0, buf);
+ if (SUCCEEDED(hr)) {
+ return ::MsiProcessMessage(hInstall, eMessageType, hRecord);
+ }
+
+ return hr;
+ }
+
+ return E_FAIL;
+}
+
+/**
+ * Replace original with replacement with a string. Logs a warning if original is not found.
+ */
+std::string do_replace(MSIHANDLE hInstall,
+ std::string source,
+ std::string original,
+ std::string replacement) {
+ int pos = source.find(original, 0);
+
+ if (pos == std::string::npos) {
+ LogMessage(hInstall,
+ INSTALLMESSAGE_WARNING,
+ "Failed to find '%s' in '%s'",
+ original.c_str(),
+ source.c_str());
+ }
+
+ return source.replace(pos, original.length(), replacement);
+}
+
+/**
+ * Get a property from MSI
+ */
+HRESULT GetProperty(MSIHANDLE hInstall, const wchar_t* pwszName, std::wstring* outString) {
+ DWORD size = 0;
+ WCHAR emptyString[1] = L"";
+ *outString = std::wstring();
+
+ UINT ret = MsiGetPropertyW(hInstall, pwszName, emptyString, &size);
+
+ if (ret != ERROR_MORE_DATA) {
+ LogMessage(hInstall,
+ INSTALLMESSAGE_WARNING,
+ "Received UINT %x during GetProperty size check",
+ ret);
+ return E_FAIL;
+ }
+
+ ++size; // bump for null terminator
+
+ std::unique_ptr<wchar_t[]> buf(new wchar_t[size]);
+
+ ret = MsiGetPropertyW(hInstall, pwszName, buf.get(), &size);
+ if (ret != ERROR_SUCCESS) {
+ LogMessage(hInstall, INSTALLMESSAGE_WARNING, "Received UINT %x during GetProperty", ret);
+ return E_FAIL;
+ }
+
+ *outString = std::wstring(buf.get());
+
+ return S_OK;
+}
+
+std::string toUtf8String(MSIHANDLE hInstall, const std::wstring& wide) {
+ if (wide.size() == 0)
+ return "";
+
+ // Calculate necessary buffer size
+ int len = ::WideCharToMultiByte(
+ CP_UTF8, 0, wide.c_str(), static_cast<int>(wide.size()), NULL, 0, NULL, NULL);
+
+ // Perform actual conversion
+ if (len > 0) {
+ std::vector<char> buffer(len);
+ len = ::WideCharToMultiByte(CP_UTF8,
+ 0,
+ wide.c_str(),
+ static_cast<int>(wide.size()),
+ &buffer[0],
+ static_cast<int>(buffer.size()),
+ NULL,
+ NULL);
+ if (len > 0) {
+ return std::string(&buffer[0], buffer.size());
+ }
+ }
+
+ LogMessage(hInstall, INSTALLMESSAGE_WARNING, " Failed to convert string to UTF-8");
+ return "";
+}
+
+// Support macros
+//
+#define CHECKHR_AND_LOG(hr, ...) \
+ \
+ if (!SUCCEEDED(hr)) { \
+ LogMessage(hInstall, INSTALLMESSAGE_WARNING, "Received HRESULT %x", hr); \
+ LogMessage(hInstall, INSTALLMESSAGE_WARNING, __VA_ARGS__); \
+ goto Exit; \
+ }
+
+#define CHECKGLE_AND_LOG(...) \
+ \
+ { \
+ LONG _gle = GetLastError(); \
+ LogMessage(hInstall, INSTALLMESSAGE_WARNING, "Received GetLastError %x", _gle); \
+ LogMessage(hInstall, INSTALLMESSAGE_WARNING, __VA_ARGS__); \
+ hr = E_FAIL; \
+ goto Exit; \
+ }
+
+#define CHECKUINT_AND_LOG(x) \
+ \
+ { \
+ UINT _retUINT = (x); \
+ if (_retUINT != ERROR_SUCCESS) { \
+ LogMessage( \
+ hInstall, INSTALLMESSAGE_WARNING, "Received Return %x from %s", _retUINT, #x); \
+ hr = E_FAIL; \
+ goto Exit; \
+ } \
+ }
+
+#define LOG_INFO(...) \
+ \
+ { LogMessage(hInstall, INSTALLMESSAGE_INFO, __VA_ARGS__); }
+
+/**
+ * UpdateMongoYAML - MSI custom action entry point
+ *
+ * Transforms a template yaml file into a file contain data and log directory of user's choosing.
+ *
+ * TODO: ACL directories
+ */
+extern "C" UINT __stdcall UpdateMongoYAML(MSIHANDLE hInstall) {
+ HRESULT hr = S_OK;
+
+ try {
+ std::wstring customData;
+ hr = GetProperty(hInstall, L"CustomActionData", &customData);
+ CHECKHR_AND_LOG(hr, "Failed to get CustomActionData property");
+
+ LOG_INFO("CA - Custom Data = %ls", customData.c_str());
+
+ std::wstring binPath;
+ std::wstring dataDir;
+ std::wstring logDir;
+
+ int start = 0;
+ while (true) {
+ int pos = customData.find(';', start);
+ if (pos == std::wstring::npos) {
+ pos = customData.size();
+ }
+
+ std::wstring term = customData.substr(start, pos - start - 1);
+ int equals = term.find('=');
+ if (equals == std::wstring::npos) {
+ LOG_INFO("CA - Error searching = %ls", term.c_str());
+ }
+
+ std::wstring keyword = term.substr(0, equals);
+ std::wstring value = term.substr(equals + 1);
+
+ if (keyword == kBIN) {
+ binPath = value;
+ } else if (keyword == kMongoDataPath) {
+ dataDir = value;
+ } else if (keyword == kMongoLogPath) {
+ logDir = value;
+ }
+
+ if (pos == customData.size()) {
+ break;
+ }
+
+ start = pos + 1;
+ }
+
+ std::wstring YamlFile(binPath);
+ YamlFile += L"\\mongod.cfg";
+
+ LOG_INFO("CA - BIN = %ls", binPath.c_str());
+ LOG_INFO("CA - MONGO_DATA_PATH = %ls", dataDir.c_str());
+ LOG_INFO("CA - MONGO_LOG_PATH = %ls", logDir.c_str());
+ LOG_INFO("CA - YAML_FILE = %ls", YamlFile.c_str());
+
+ long gle = GetFileAttributesW(YamlFile.c_str());
+ if (gle == INVALID_FILE_ATTRIBUTES) {
+ CHECKGLE_AND_LOG("Failed to find yaml file");
+ }
+
+ HANDLE hFile = CreateFileW(YamlFile.c_str(),
+ (GENERIC_READ | GENERIC_WRITE),
+ 0,
+ NULL,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL);
+ if (hFile == INVALID_HANDLE_VALUE) {
+ CHECKGLE_AND_LOG("Failed to open yaml file");
+ }
+
+ const auto handleGuard = mongo::MakeGuard([&] { CloseHandle(hFile); });
+
+ LARGE_INTEGER fileSize;
+ if (GetFileSizeEx(hFile, &fileSize) == 0) {
+ CHECKGLE_AND_LOG("Failed to get size of yaml file");
+ }
+
+ LOG_INFO("CA - Allocating - %lld bytes", fileSize.QuadPart);
+
+ size_t bufSize = static_cast<size_t>(fileSize.QuadPart + 1);
+
+ std::unique_ptr<char> buf(new char[bufSize]);
+
+ LOG_INFO("CA - Reading file - %d bytes", bufSize);
+
+ DWORD read;
+ if (!ReadFile(hFile, (void*)buf.get(), bufSize, &read, NULL)) {
+ CHECKGLE_AND_LOG("Failed to read yaml file");
+ }
+
+ buf.get()[read] = '\0';
+
+ LOG_INFO("CA - Reading file - '%s'", buf.get());
+
+ std::string str(buf.get());
+
+ // Do the string subsitutions
+ str = do_replace(hInstall, str, kMongoDataPathYaml, toUtf8String(hInstall, dataDir));
+ str = do_replace(hInstall, str, kMongoLogPathYaml, toUtf8String(hInstall, logDir));
+
+ LOG_INFO("CA - Writing file - '%s'", buf.get());
+
+ SetFilePointer(hFile, 0, 0, SEEK_SET);
+
+ DWORD written;
+ if (!WriteFile(hFile, str.c_str(), str.length(), &written, NULL)) {
+ CHECKGLE_AND_LOG("Failed to write yaml file");
+ }
+ } catch (const std::exception& e) {
+ CHECKHR_AND_LOG(E_FAIL, "Caught C++ exception %s", e.what());
+ } catch (...) {
+ CHECKHR_AND_LOG(E_FAIL, "Caught exception");
+ }
+
+Exit:
+ return SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
+}
+
+/**
+ * ValidateServiceLogon - MSI custom action entry point.
+ *
+ * Validates a (domain, user, password) tuple is suitable is correct and valid for a service login.
+ */
+extern "C" UINT __stdcall ValidateServiceLogon(MSIHANDLE hInstall) {
+ HRESULT hr = S_OK;
+
+ /**
+ // Debugging Hook:
+ // The only way to find the process to attach is via PID in this Message Box.
+ char buf[256];
+ sprintf(&buf[0], "Validating %d", GetCurrentProcessId());
+
+ MessageBoxA(NULL, &buf[0], "FOOBAR", MB_OK | MB_ICONEXCLAMATION | MB_SETFOREGROUND);
+ */
+
+ try {
+ std::wstring userName;
+ std::wstring password;
+ std::wstring domain;
+
+ hr = GetProperty(hInstall, kMongoServiceAccountName, &userName);
+ CHECKHR_AND_LOG(hr, "Failed to get MONGO_SERVICE_ACCOUNT_NAME property");
+
+ hr = GetProperty(hInstall, kMongoServiceAccountPassword, &password);
+ CHECKHR_AND_LOG(hr, "Failed to get MONGO_SERVICE_ACCOUNT_PASSWORD property");
+
+ hr = GetProperty(hInstall, kMongoServiceAccountDomain, &domain);
+ CHECKHR_AND_LOG(hr, "Failed to get MONGO_SERVICE_ACCOUNT_DOMAIN property");
+
+ // Check if the user name and password is valid, and the user has the "Log on as a service"
+ // privilege.
+ HANDLE hLogonToken;
+ BOOL ret = LogonUserW(userName.c_str(),
+ domain.c_str(),
+ password.c_str(),
+ LOGON32_LOGON_SERVICE,
+ LOGON32_PROVIDER_DEFAULT,
+ &hLogonToken);
+ if (ret) {
+ // User name and password is right
+ CloseHandle(hLogonToken);
+ CHECKUINT_AND_LOG(MsiSetPropertyA(hInstall, "MONGO_SERVICE_ACCOUNT_VALID", "1"));
+ return ERROR_SUCCESS;
+ }
+
+ DWORD gle = GetLastError();
+ if (gle == ERROR_LOGON_TYPE_NOT_GRANTED) {
+ // Check if the user can logon interactive since we have the right user name and
+ // password but the wrong privileges. We will grant the right privilege later in setup.
+
+ ret = LogonUserW(userName.c_str(),
+ domain.c_str(),
+ password.c_str(),
+ LOGON32_LOGON_INTERACTIVE,
+ LOGON32_PROVIDER_DEFAULT,
+ &hLogonToken);
+ if (ret) {
+ // User name and password is right
+ CloseHandle(hLogonToken);
+ CHECKUINT_AND_LOG(MsiSetPropertyA(hInstall, "MONGO_SERVICE_ACCOUNT_VALID", "1"));
+ return ERROR_SUCCESS;
+ }
+ } else if (gle != ERROR_LOGON_FAILURE) {
+ CHECKGLE_AND_LOG("Could not logon user");
+ }
+
+ // User name and/or password is wrong
+ CHECKUINT_AND_LOG(MsiSetPropertyA(hInstall, "MONGO_SERVICE_ACCOUNT_VALID", "0"));
+
+ } catch (const std::exception& e) {
+ CHECKHR_AND_LOG(E_FAIL, "Caught C++ exception %s", e.what());
+ } catch (...) {
+ CHECKHR_AND_LOG(E_FAIL, "Caught exception");
+ }
+
+Exit:
+ return SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
+}
+
+// DllMain - Initialize and cleanup WiX custom action utils.
+extern "C" BOOL WINAPI DllMain(__in HINSTANCE hInst, __in ULONG ulReason, __in LPVOID) {
+ switch (ulReason) {
+ case DLL_PROCESS_ATTACH:
+ break;
+
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+
+ return TRUE;
+}
diff --git a/src/mongo/installer/msi/ca/CustomAction.def b/src/mongo/installer/msi/ca/CustomAction.def
new file mode 100644
index 00000000000..b1661c12a4d
--- /dev/null
+++ b/src/mongo/installer/msi/ca/CustomAction.def
@@ -0,0 +1,6 @@
+LIBRARY "mongoca"
+
+EXPORTS
+
+UpdateMongoYAML
+ValidateServiceLogon
diff --git a/src/mongo/installer/msi/ca/SConscript b/src/mongo/installer/msi/ca/SConscript
new file mode 100644
index 00000000000..e2350401e0e
--- /dev/null
+++ b/src/mongo/installer/msi/ca/SConscript
@@ -0,0 +1,33 @@
+# -*- mode: python -*-
+Import("env")
+Import("debugBuild")
+
+env = env.Clone()
+
+# Do not link with DLL version of the CRT.
+# As part of install, we may need to install the CRT DLL but if it is not installed, we cannot run
+# the installer if we dynamically linked against it.
+#
+bad_flags = [a for a in env['CCFLAGS'] if a.startswith("/M")]
+
+for flag in bad_flags:
+ env['CCFLAGS'].remove(flag)
+
+if debugBuild:
+ env['CCFLAGS'].append("/MTd")
+else:
+ env['CCFLAGS'].append("/MT")
+
+env.Append(LIBS=[
+ 'msi.lib',
+ 'user32.lib'
+ ]
+)
+
+ca = env.SharedLibrary(
+ target='mongoca',
+ source=[
+ 'customaction.cpp',
+ 'customaction.def',
+ ],
+)
diff --git a/src/mongo/installer/msi/ca/targetver.h b/src/mongo/installer/msi/ca/targetver.h
new file mode 100644
index 00000000000..8b9c83f3058
--- /dev/null
+++ b/src/mongo/installer/msi/ca/targetver.h
@@ -0,0 +1,54 @@
+/**
+ * Copyright (C) 2017 MongoDB Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the GNU Affero General Public License in all respects
+ * for all of the code used other than as permitted herein. If you modify
+ * file(s) with this exception, you may extend this exception to your
+ * version of the file(s), but you are not obligated to do so. If you do not
+ * wish to do so, delete this exception statement from your version. If you
+ * delete this exception statement from all source files in the program,
+ * then also delete it in the license file.
+ */
+
+#pragma once
+
+// The following macros define the minimum required platform. The minimum required platform
+// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
+// your application. The macros work by enabling all features available on platform versions up to
+// and
+// including the version specified.
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef WINVER // Specifies that the minimum required platform is Windows Vista.
+#define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows.
+#endif
+
+#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
+#define _WIN32_WINNT \
+ 0x0600 // Change this to the appropriate value to target other versions of Windows.
+#endif
+
+#ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 6.0.
+#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE.
+#endif
+
+#ifndef _WIN32_MSI // Specifies that the minimum required MSI version is MSI 4.5
+#define _WIN32_MSI 405 // Change this to the appropriate value to target other versions of MSI.
+#endif
diff --git a/src/mongo/installer/msi/wxs/BinaryFragment.wxs b/src/mongo/installer/msi/wxs/BinaryFragment.wxs
index bfc4d8fd2d2..da6fd4260e0 100644
--- a/src/mongo/installer/msi/wxs/BinaryFragment.wxs
+++ b/src/mongo/installer/msi/wxs/BinaryFragment.wxs
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Fragment>
<DirectoryRef Id="BIN">
<Component Id="c_bsondump" Guid="DEEA45CA-5175-453B-9D0B-6168B4C0C891">
@@ -17,10 +17,40 @@
<File Id="f_mongod" Name="mongod.exe" Source="$(var.BinarySource)\mongod.exe"
DiskId ="1" KeyPath="yes"/>
</Component>
+ <Component Id="c_mongodWithService" Guid="1E7C89DA-4B96-41E2-8106-DDBA64631249">
+ <File Id="f_mongodWithService" Name="mongod.exe" Source="$(var.BinarySource)\mongod.exe"
+ DiskId ="1" KeyPath="yes"/>
+ <ServiceInstall Id='MyServiceInstall'
+ Description="MongoDB Database Server"
+ Arguments='--config "[BIN]mongod.cfg" --service'
+ DisplayName='MongoDB Server'
+ Name='MongoDB'
+ ErrorControl='normal'
+ Start='auto'
+ Type='ownProcess'
+ Account='[MONGO_SERVICE_FULL_ACCOUNT_NAME]'
+ Password='[MONGO_SERVICE_ACCOUNT_PASSWORD]'
+ Vital='yes' />
+ <ServiceControl Id="StartStopService" Name="MongoDB" Start="install" Stop="both" Remove="uninstall" Wait="no" />
+ </Component>
+ <Component Id="c_mongodWithServiceUser" Guid="961B0579-4074-4437-B168-9B6C5E3C9E6A" KeyPath="yes">
+ <Condition><![CDATA[MONGO_SERVICE_INSTALL AND MONGO_SERVICE_ACCOUNT_TYPE <> "ServiceLocalNetwork"]]></Condition>
+ <util:User Id="GrantLogonAsService"
+ Name="[MONGO_SERVICE_ACCOUNT_NAME]"
+ Domain="[MONGO_SERVICE_ACCOUNT_DOMAIN_GRANT]"
+ CreateUser="no" LogonAsService="yes" UpdateIfExists="yes" FailIfExists="no" >
+ <!-- Grant membership to performance counter group so FTDC is happy -->
+ <util:GroupRef Id="PerfmonGroup" />
+ </util:User>
+ </Component>
<Component Id="c_mongodPdb" Guid="8B41A2E2-911C-4399-8E9F-D3C1AD3B9EDD">
<File Id="f_mongodPdb" Name="mongod.pdb" Source="$(var.BinarySource)\mongod.pdb"
DiskId ="1" KeyPath="yes"/>
</Component>
+ <Component Id="c_mongodCfg" Guid="EA715A4C-7C63-4C5C-8F73-A82E84668AEE">
+ <File Id="f_mongodCfg" Name="mongod.cfg" Source="$(var.ProjectDir)mongod.yaml"
+ DiskId ="1" KeyPath="yes"/>
+ </Component>
<Component Id="c_mongodump" Guid="FFE32884-ACAD-4EC6-AF84-6BC94F55819E">
<File Id="f_mongodump" Name="mongodump.exe" Source="$(var.ToolBinarySource)\mongodump.exe"
DiskId ="1" KeyPath="yes"/>
@@ -122,6 +152,20 @@
</Component>
</DirectoryRef>
<?endif ?>
+ <DirectoryRef Id="MONGO_DATA_PATH" >
+ <Component Id="c_MONGO_DATA_PATH" Guid="F695F048-E262-4871-A31B-0E2361BB4BCB">
+ <CreateFolder Directory="MONGO_DATA_PATH" >
+ <util:PermissionEx User="[MONGO_SERVICE_ACCOUNT_NAME]" GenericAll="yes"/>
+ </CreateFolder>
+ </Component>
+ </DirectoryRef>
+ <DirectoryRef Id="MONGO_LOG_PATH" >
+ <Component Id="c_MONGO_LOG_PATH" Guid="D7DBC821-5BD2-4EB7-AEFB-7AC92945146D">
+ <CreateFolder Directory="MONGO_LOG_PATH" >
+ <util:PermissionEx User="[MONGO_SERVICE_ACCOUNT_NAME]" GenericAll="yes"/>
+ </CreateFolder>
+ </Component>
+ </DirectoryRef>
<?if $(var.Edition) = Enterprise or $(var.Edition) = SSL ?>
diff --git a/src/mongo/installer/msi/wxs/FeatureFragment.wxs b/src/mongo/installer/msi/wxs/FeatureFragment.wxs
index 69e1c8f0db5..64506d015a1 100644
--- a/src/mongo/installer/msi/wxs/FeatureFragment.wxs
+++ b/src/mongo/installer/msi/wxs/FeatureFragment.wxs
@@ -20,8 +20,9 @@
Title ="Server"
Description="The MongoDB server (mongod)"
Level ="1">
- <ComponentRef Id="c_mongod"/>
<ComponentRef Id="c_mongodPdb"/>
+ <ComponentRef Id="c_mongodCfg"/>
+
<?if $(var.Edition) = Enterprise ?>
<ComponentGroupRef Id="cg_EnterpriseServer" />
<?endif ?>
@@ -29,6 +30,23 @@
<ComponentGroupRef Id="cg_SSLBase" />
<?endif ?>
</Feature>
+ <Feature Id="ServerNoService"
+ Title ="ServerNoService"
+ Description="The MongoDB server (mongod)"
+ Display="hidden"
+ Level ="32767">
+ <ComponentRef Id="c_mongod"/>
+ </Feature>
+ <Feature Id="ServerService"
+ Title ="ServerService"
+ Description="The MongoDB server (mongod)"
+ Display="hidden"
+ Level ="32767">
+ <ComponentRef Id="c_mongodWithService"/>
+ <ComponentRef Id="c_mongodWithServiceUser" />
+ <ComponentRef Id="c_MONGO_DATA_PATH"/>
+ <ComponentRef Id="c_MONGO_LOG_PATH"/>
+ </Feature>
<Feature Id="Client"
Title ="Client"
Description="The MongoDB client/shell (mongo)"
diff --git a/src/mongo/installer/msi/wxs/Installer_64.wxs b/src/mongo/installer/msi/wxs/Installer_64.wxs
index f79c9c3aaf1..0a62dff6e43 100644
--- a/src/mongo/installer/msi/wxs/Installer_64.wxs
+++ b/src/mongo/installer/msi/wxs/Installer_64.wxs
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
-<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
- <Product Id="$(var.ProductId)"
- Name="!(wix.ProductName)"
- Language="1033"
- Version="$(var.MongoDBVersion)"
- Manufacturer="MongoDB"
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
+ xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
+ <Product Id="$(var.ProductId)"
+ Name="!(wix.ProductName)"
+ Language="1033"
+ Version="$(var.MongoDBVersion)"
+ Manufacturer="MongoDB"
UpgradeCode="$(var.UpgradeCode)">
<Package InstallerVersion="405" Compressed="yes" Platform="x64"/>
@@ -12,48 +13,77 @@
<WixVariable Id="InstallFolder" Value="$(var.MongoDBMajorVersion)"/>
<?if $(var.Edition) = Enterprise ?>
- <WixVariable Id="ProductName" Value="MongoDB $(var.MongoDBVersion) $(var.Flavor) Enterprise (64 bit)" />
- <WixVariable Id="ProductMajorName" Value="MongoDB $(var.MongoDBMajorVersion) $(var.Flavor) Enterprise (64 bit)" />
+ <WixVariable Id="ProductName" Value="MongoDB $(var.MongoDBVersion) $(var.Flavor) Enterprise (64 bit)" />
+ <WixVariable Id="ProductMajorName" Value="MongoDB $(var.MongoDBMajorVersion) $(var.Flavor) Enterprise (64 bit)" />
<?elseif $(var.Edition) = SSL ?>
- <WixVariable Id="ProductName" Value="MongoDB $(var.MongoDBVersion) $(var.Flavor) SSL (64 bit)" />
- <WixVariable Id="ProductMajorName" Value="MongoDB $(var.MongoDBMajorVersion) $(var.Flavor) SSL (64 bit)" />
+ <WixVariable Id="ProductName" Value="MongoDB $(var.MongoDBVersion) $(var.Flavor) SSL (64 bit)" />
+ <WixVariable Id="ProductMajorName" Value="MongoDB $(var.MongoDBMajorVersion) $(var.Flavor) SSL (64 bit)" />
<?else?>
- <WixVariable Id="ProductName" Value="MongoDB $(var.MongoDBVersion) $(var.Flavor) (64 bit)" />
- <WixVariable Id="ProductMajorName" Value="MongoDB $(var.MongoDBMajorVersion) $(var.Flavor) (64 bit)" />
+ <WixVariable Id="ProductName" Value="MongoDB $(var.MongoDBVersion) $(var.Flavor) (64 bit)" />
+ <WixVariable Id="ProductMajorName" Value="MongoDB $(var.MongoDBMajorVersion) $(var.Flavor) (64 bit)" />
<?endif?>
<MajorUpgrade
- DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit."/>
+ DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit."/>
<Directory Id="TARGETDIR" Name="SourceDir">
- <Directory Id="ProgramFiles64Folder">
- <Directory Id="MongoDB" Name="MongoDB">
- <Directory Id="Server" Name="Server">
- <Directory Id="INSTALLLOCATION" Name="!(wix.InstallFolder)">
- <Directory Id="BIN" Name="bin" />
- <Directory Id="SNMP" Name="snmp" />
+ <Directory Id="ProgramFiles64Folder">
+ <Directory Id="MongoDB" Name="MongoDB">
+ <Directory Id="Server" Name="Server">
+ <Directory Id="INSTALLLOCATION" Name="!(wix.InstallFolder)">
+ <Directory Id="BIN" Name="bin" />
+ <Directory Id="MONGO_DATA_PATH" Name="data" />
+ <Directory Id="MONGO_LOG_PATH" Name="log" />
+ <Directory Id="SNMP" Name="snmp" />
+ </Directory>
+ </Directory>
+ </Directory>
+ </Directory>
+ <Directory Id="CommonAppDataFolder">
+ <Directory Id="MongoDBData" Name="MongoDB">
+ <Directory Id="ServerData" Name="Server">
+ <Directory Id="VersionData" Name="!(wix.InstallFolder)" />
+ </Directory>
</Directory>
- </Directory>
</Directory>
- </Directory>
</Directory>
+ <Binary Id="CAIntro" SourceFile="$(var.CustomActionDll)"/>
+
+ <CustomAction Id="UpdateMongoYAML"
+ BinaryKey="CAIntro"
+ DllEntry="UpdateMongoYAML"
+ Execute="deferred"
+ Return="check"
+ HideTarget="no" />
+
+ <CustomAction Id="UpdateMongoYAML.SetProperty"
+ Return="check"
+ Property="UpdateMongoYAML"
+ Value="BIN=[BIN];MONGO_DATA_PATH=[MONGO_DATA_PATH];MONGO_LOG_PATH=[MONGO_LOG_PATH]"/>
+
+ <CustomAction Id="ValidateServiceLogon"
+ BinaryKey="CAIntro"
+ DllEntry="ValidateServiceLogon"
+ Execute="immediate" />
+
+ <InstallExecuteSequence>
+ <Custom Action="UpdateMongoYAML.SetProperty" Before="InstallFiles" />
+ <Custom Action="UpdateMongoYAML" After="InstallFiles">MONGO_SERVICE_INSTALL AND NOT REMOVE</Custom>
+ </InstallExecuteSequence>
+
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<WixVariable Id="WixUIDialogBmp" Value="$(var.ProjectDir)Dialog.bmp" />
<WixVariable Id="WixUIBannerBmp" Value="$(var.ProjectDir)Banner.bmp" />
<WixVariable Id="WixUIInfoIco" Value="$(var.ProjectDir)Installer_Icon_32x32.ico" />
<WixVariable Id="WixUIExclamationIco" Value="$(var.ProjectDir)Installer_Icon_32x32.ico" />
- <!--
- <WixVariable Id="WixUINewIco" Value="Installer_Icon_16x16.ico" />
- <WixVariable Id="WixUIUpIco" Value="Installer_Icon_16x16.ico" />
- More information can be found at http://wix.tramontana.co.hu/tutorial/user-interface/ui-wizardry
- -->
<Property Id="ARPPRODUCTICON" Value="MongoDBIcon" />
<Property Id="ARPHELPLINK" Value="http://www.mongodb.org/" />
<Property Id="ARPURLINFOABOUT" Value="http://www.mongodb.org/" />
<Icon Id="MongoDBIcon" SourceFile="$(var.ProjectDir)Installer_Icon_32x32.ico" />
+ <Binary Id="MongoDBIconBinary" SourceFile="$(var.ProjectDir)Installer_Icon_32x32.ico" />
<FeatureGroupRef Id="fg_MongoDBAll" />
@@ -61,16 +91,72 @@
<UIRef Id="WixUI_ErrorProgressText" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" />
+ <!-- Settings for Install MongoDB as a service -->
+ <Property Id="MONGO_SERVICE_INSTALL" Value="0" Secure="yes" />
+ <Property Id="MONGO_SERVICE_ACCOUNT_TYPE" Secure="yes" Value="ServiceLocalNetwork" />
+ <Property Id="MONGO_SERVICE_NAME" Secure="yes" Value="MongoDB" />
+ <Property Id="MONGO_SERVICE_ACCOUNT_DOMAIN" Value="." />
+ <Property Id="MONGO_SERVICE_ACCOUNT_NAME" Secure="yes" Value="MongoDB" />
+ <Property Id="MONGO_SERVICE_ACCOUNT_PASSWORD" Secure="yes" Hidden="yes"/>
+
+ <Property Id="MONGO_DATA_PATH" Secure="yes" />
+ <Property Id="MONGO_LOG_PATH" Secure="yes" />
+
+ <util:Group Id="PerfmonGroup" Name="Performance Monitor Users" />
+
+ <!--
+ Setup the domain to use for granting permissions, the gotcha is the local machine.
+ The util:User element wants an empty string for the domain for the local machine.
+ The ServiceInstall element wants '.' for the domain for the local machine.
+ -->
+ <!-- Default the domain to grant to the user request -->
+ <CustomAction Id="MongoDB.SetGrantAccountDefault"
+ Property="MONGO_SERVICE_ACCOUNT_DOMAIN_GRANT" Value="[MONGO_SERVICE_ACCOUNT_DOMAIN]" />
+
+ <!-- Change the domain to blank if the user specified '.' i.e. local machine -->
+ <CustomAction Id="MongoDB.SetGrantAccountToBlank"
+ Property="MONGO_SERVICE_ACCOUNT_DOMAIN_GRANT" Value="" />
+
+ <!-- Change the domain to blank if the user specified '.' i.e. local machine -->
+ <CustomAction Id="MongoDB.SetGrantAccountToNetworkAccount"
+ Property="MONGO_SERVICE_ACCOUNT_DOMAIN_GRANT" Value="NT AUTHORITY" />
+
+ <!-- Default to the fully qualified domain\account for the service account -->
+ <CustomAction Id="MongoDB.SetServiceAccountDefault"
+ Property="MONGO_SERVICE_FULL_ACCOUNT_NAME"
+ Value="[MONGO_SERVICE_ACCOUNT_DOMAIN]\[MONGO_SERVICE_ACCOUNT_NAME]" />
+
+ <!-- Default to .\account if the user left domain blank -->
+ <CustomAction Id="MongoDB.SetServiceAccountToDot"
+ Property="MONGO_SERVICE_FULL_ACCOUNT_NAME" Value=".\[MONGO_SERVICE_ACCOUNT_NAME]" />
+
+ <!-- If the user chose network service, then just set the user account to Network Service -->
+ <CustomAction Id="MongoDB.SetServiceNetworkAccount"
+ Property="MONGO_SERVICE_FULL_ACCOUNT_NAME" Value="NT AUTHORITY\NetworkService" />
+ <CustomAction Id="MongoDB.SetServiceNetworkAccount2"
+ Property="MONGO_SERVICE_ACCOUNT_NAME" Value="NetworkService" />
+
+ <InstallExecuteSequence>
+ <Custom Action="MongoDB.SetGrantAccountDefault" After="CostFinalize" />
+ <Custom Action="MongoDB.SetGrantAccountToBlank" After="CostFinalize">MONGO_SERVICE_ACCOUNT_DOMAIN = "."</Custom>
+ <Custom Action="MongoDB.SetGrantAccountToNetworkAccount" After="CostFinalize">MONGO_SERVICE_ACCOUNT_TYPE = "ServiceLocalNetwork"</Custom>
+
+ <Custom Action="MongoDB.SetServiceAccountDefault" After="CostFinalize" />
+ <Custom Action="MongoDB.SetServiceAccountToDot" After="CostFinalize">MONGO_SERVICE_ACCOUNT_DOMAIN = ""</Custom>
+ <Custom Action="MongoDB.SetServiceNetworkAccount" After="CostFinalize">MONGO_SERVICE_ACCOUNT_TYPE = "ServiceLocalNetwork"</Custom>
+ <Custom Action="MongoDB.SetServiceNetworkAccount2" After="CostFinalize">MONGO_SERVICE_ACCOUNT_TYPE = "ServiceLocalNetwork"</Custom>
+ </InstallExecuteSequence>
+
<Property Id="MONGO_MULTIPLE_SKU" >
- <RegistrySearch Id="Mongo_Multiple_Sku"
- Root="HKLM"
- Key="Software\MongoDB\Server\$(var.MongoDBMajorVersion)"
- Name="Edition"
- Type="raw" />
+ <RegistrySearch Id="Mongo_Multiple_Sku"
+ Root="HKLM"
+ Key="Software\MongoDB\Server\$(var.MongoDBMajorVersion)"
+ Name="Edition"
+ Type="raw" />
</Property>
<Condition Message="You cannot install multiple editions for the same version of MongoDB. Already installed product '[MONGO_MULTIPLE_SKU]' conflicts with this product.">
- Installed OR (NOT MONGO_MULTIPLE_SKU OR MONGO_MULTIPLE_SKU = "!(wix.ProductMajorName)")
+ Installed OR (NOT MONGO_MULTIPLE_SKU OR MONGO_MULTIPLE_SKU = "!(wix.ProductMajorName)")
</Condition>
<Property Id="SHOULD_INSTALL_COMPASS" Secure="yes" Value="1" />
@@ -115,5 +201,6 @@
(NOT Installed) AND (SHOULD_INSTALL_COMPASS = 1)
</Custom>
</InstallExecuteSequence>
+
</Product>
</Wix>
diff --git a/src/mongo/installer/msi/wxs/UIFragment.wxs b/src/mongo/installer/msi/wxs/UIFragment.wxs
index 779109f9a72..15ca9172a80 100644
--- a/src/mongo/installer/msi/wxs/UIFragment.wxs
+++ b/src/mongo/installer/msi/wxs/UIFragment.wxs
@@ -7,14 +7,14 @@
<Publish Event="NewDialog" Value="MongoSetupTypeDlg" Dialog="LicenseAgreementDlg" Control="Next">LicenseAccepted = "1"</Publish>
<Publish Event="NewDialog" Value="MongoSetupTypeDlg" Dialog="CustomizeDlg" Control="Back">WixUI_InstallMode = "InstallCustom"</Publish>
- <Publish Event="NewDialog" Value="CompassDlg" Dialog="CustomizeDlg" Control="Next"></Publish>
- <Publish Event="NewDialog" Value="CompassDlg" Dialog="VerifyReadyDlg" Control="Back"></Publish>
+ <Publish Event="NewDialog" Value="ServiceDlg" Dialog="CustomizeDlg" Control="Next"></Publish>
+ <Publish Event="NewDialog" Value="ServiceDlg" Dialog="VerifyReadyDlg" Control="Back"></Publish>
<!-- A custom setup type dialog box with only Complete and Custom buttons -->
<Dialog Id="MongoSetupTypeDlg" X="50" Y="50" Width="370" Height="270" Title="[ProductName] Setup">
<Control Id="CompleteButton" Type="PushButton" X="40" Y="65" Width="80" Height="17" Text="C&amp;omplete" ToolTip="Complete Installation" TabSkip="no" Default="yes">
<Publish Property="WixUI_InstallMode" Value="InstallComplete">1</Publish>
- <Publish Event="NewDialog" Value="CompassDlg">1</Publish>
+ <Publish Event="NewDialog" Value="ServiceDlg">1</Publish>
<Publish Event="SetInstallLevel" Value="1000">1</Publish>
</Control>
<Control Id="CustomButton" Type="PushButton" X="40" Y="118" Width="80" Height="17" Text="C&amp;ustom" ToolTip="Custom Installation" TabSkip="no">
@@ -37,6 +37,117 @@
<Control Id="CustomText" Type="Text" X="60" Y="138" Width="280" Height="30" Text="Allows users to choose which program features will be installed and where they will be installed. Recommended for advanced users." TabSkip="yes" />
</Dialog>
+ <!-- A custom dialog box to warn the user about an invalid service logon. -->
+ <Dialog Id="InvalidServiceAccount" Width="260" Height="85" Title="[ProductName] Error" NoMinimize="yes">
+ <Control Id="Icon" Type="Icon" X="15" Y="15" Width="24" Height="24" ToolTip="Information icon" FixedSize="yes" IconSize="32" Text="MongoDBIconBinary" />
+ <Control Id="Return" Type="PushButton" X="100" Y="57" Width="56" Height="17" Default="yes" Cancel="yes" Text="&amp;Return">
+ <Publish Event="EndDialog" Value="Return">1</Publish>
+ </Control>
+ <Control Id="Text" Type="Text" X="48" Y="15" Width="194" Height="30" TabSkip="no">
+ <Text>The domain, user name and/or password are incorrect. Remember to use "." for the domain if the account is on the local machine.</Text>
+ </Control>
+ </Dialog>
+
+ <!-- A custom dialog box to configure a Windows service -->
+ <Dialog Id="ServiceDlg" X="50" Y="50" Width="370" Height="270" Title="[ProductName] Service Customization">
+ <Control Id="textTitle" Type="Text" X="8" Y="8" Width="122" Height="15" TabSkip="yes" Transparent="yes">
+ <Text>{\WixUI_Font_Title}Service Configuration</Text>
+ </Control>
+ <Control Id="textDescription" Type="Text" X="23" Y="23" Width="345" Height="10" TabSkip="yes" Transparent="yes">
+ <Text>Specify optional settings to configure MongoDB as a service.</Text>
+ </Control>
+ <Control Id="lineTopDivider" Type="Line" X="0" Y="44" Width="370" Height="2" />
+ <Control Id="lineBottomDivider" Type="Line" X="0" Y="234" Width="370" Height="2" />
+ <Control Id="Back" Type="PushButton" X="189" Y="244" Width="56" Height="17" TabSkip="no">
+ <Text>&lt; &amp;Back</Text>
+ <Publish Event="NewDialog" Value="MongoSetupTypeDlg" Order="1">WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete"</Publish>
+ <Publish Event="NewDialog" Value="CustomizeDlg" Order="2">WixUI_InstallMode = "InstallCustom"</Publish>
+ </Control>
+ <Control Id="Next" Type="PushButton" X="244" Y="244" Width="56" Height="17" TabSkip="no">
+ <Text>&amp;Next &gt;</Text>
+ <Publish Event="AddLocal" Value="ServerNoService">NOT MONGO_SERVICE_INSTALL</Publish>
+ <Publish Event="AddLocal" Value="ServerService">MONGO_SERVICE_INSTALL</Publish>
+ <Publish Event="DoAction" Value="ValidateServiceLogon" Order="1"><![CDATA[MONGO_SERVICE_INSTALL AND MONGO_SERVICE_ACCOUNT_TYPE <> "ServiceLocalNetwork"]]></Publish>
+ <Publish Event="SpawnDialog" Value="InvalidServiceAccount" Order="2">MONGO_SERVICE_ACCOUNT_VALID = "0"</Publish>
+ <Publish Event="NewDialog" Value="CompassDlg" Order="2">NOT MONGO_SERVICE_INSTALL OR (MONGO_SERVICE_ACCOUNT_TYPE = "ServiceLocalNetwork" OR MONGO_SERVICE_ACCOUNT_VALID)</Publish>
+ </Control>
+ <Control Id="Cancel" Type="PushButton" X="309" Y="244" Width="56" Height="17" TabSkip="no">
+ <Text>Cancel</Text>
+ <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
+ </Control>
+ <Control Id="CheckBox1" Type="CheckBox" X="8" Y="48" Width="132" Height="18" Property="MONGO_SERVICE_INSTALL" CheckBoxValue="TRUE" TabSkip="no">
+ <Text>Install MongoD as a Service</Text>
+ </Control>
+ <Control Id="RadioButtonGroup1" Type="RadioButtonGroup" Property="MONGO_SERVICE_ACCOUNT_TYPE" X="20" Y="62" Width="190" Height="44">
+ <RadioButtonGroup Property="MONGO_SERVICE_ACCOUNT_TYPE">
+ <RadioButton X="0" Y="2" Width="184" Height="18" Value="ServiceLocalNetwork" Text="Run service as Network Service user" />
+ <RadioButton X="0" Y="18" Width="184" Height="18" Value="ServiceCustomAccount" Text="Run service as a local or domain user:" />
+ </RadioButtonGroup>
+ <Condition Action="disable">NOT MONGO_SERVICE_INSTALL</Condition>
+ <Condition Action="enable">MONGO_SERVICE_INSTALL</Condition>
+ </Control>
+ <Control Id="textAccountName" Type="Text" X="38" Y="116" Width="76" Height="15" TabSkip="yes">
+ <Text>Account Name:</Text>
+ <Condition Action="disable">NOT MONGO_SERVICE_INSTALL OR MONGO_SERVICE_ACCOUNT_TYPE = "ServiceLocalNetwork"</Condition>
+ <Condition Action="enable"><![CDATA[MONGO_SERVICE_INSTALL AND MONGO_SERVICE_ACCOUNT_TYPE <> "ServiceLocalNetwork"]]></Condition>
+ </Control>
+ <Control Id="textAccountDomain" Type="Text" X="38" Y="98" Width="76" Height="15" TabSkip="yes">
+ <Text>Account Domain:</Text>
+ <Condition Action="disable">NOT MONGO_SERVICE_INSTALL OR MONGO_SERVICE_ACCOUNT_TYPE = "ServiceLocalNetwork"</Condition>
+ <Condition Action="enable"><![CDATA[MONGO_SERVICE_INSTALL AND MONGO_SERVICE_ACCOUNT_TYPE <> "ServiceLocalNetwork"]]></Condition>
+ </Control>
+ <Control Id="textAccountPassword" Type="Text" X="38" Y="134" Width="76" Height="15" TabSkip="yes">
+ <Text>Account Password:</Text>
+ <Condition Action="disable">NOT MONGO_SERVICE_INSTALL OR MONGO_SERVICE_ACCOUNT_TYPE = "ServiceLocalNetwork"</Condition>
+ <Condition Action="enable"><![CDATA[MONGO_SERVICE_INSTALL AND MONGO_SERVICE_ACCOUNT_TYPE <> "ServiceLocalNetwork"]]></Condition>
+ </Control>
+ <Control Id="editAccountDomain" Type="Edit" X="124" Y="98" Width="101" Height="15" TabSkip="no" Property="MONGO_SERVICE_ACCOUNT_DOMAIN">
+ <Text>{32767}</Text>
+ <Condition Action="disable">NOT MONGO_SERVICE_INSTALL OR MONGO_SERVICE_ACCOUNT_TYPE = "ServiceLocalNetwork"</Condition>
+ <Condition Action="enable"><![CDATA[MONGO_SERVICE_INSTALL AND MONGO_SERVICE_ACCOUNT_TYPE <> "ServiceLocalNetwork"]]></Condition>
+ </Control>
+ <Control Id="editAccountName" Type="Edit" X="124" Y="116" Width="101" Height="15" TabSkip="no" Property="MONGO_SERVICE_ACCOUNT_NAME">
+ <Text>{32767}</Text>
+ <Condition Action="disable">NOT MONGO_SERVICE_INSTALL OR MONGO_SERVICE_ACCOUNT_TYPE = "ServiceLocalNetwork"</Condition>
+ <Condition Action="enable"><![CDATA[MONGO_SERVICE_INSTALL AND MONGO_SERVICE_ACCOUNT_TYPE <> "ServiceLocalNetwork"]]></Condition>
+ </Control>
+ <Control Id="editAccountPassword" Type="Edit" X="124" Y="134" Width="101" Height="15" TabSkip="no" Password="yes" Property="MONGO_SERVICE_ACCOUNT_PASSWORD">
+ <Text>{32767}</Text>
+ <Condition Action="disable">NOT MONGO_SERVICE_INSTALL OR MONGO_SERVICE_ACCOUNT_TYPE = "ServiceLocalNetwork"</Condition>
+ <Condition Action="enable"><![CDATA[MONGO_SERVICE_INSTALL AND MONGO_SERVICE_ACCOUNT_TYPE <> "ServiceLocalNetwork"]]></Condition>
+ </Control>
+ <Control Id="textServiceName" Type="Text" X="23" Y="161" Width="62" Height="15" TabSkip="yes">
+ <Text>Service Name:</Text>
+ <Condition Action="disable">NOT MONGO_SERVICE_INSTALL</Condition>
+ <Condition Action="enable">MONGO_SERVICE_INSTALL</Condition>
+ </Control>
+ <Control Id="editServiceName" Type="Edit" X="98" Y="161" Width="105" Height="15" TabSkip="no" Property="MONGO_SERVICE_NAME">
+ <Condition Action="disable">NOT MONGO_SERVICE_INSTALL</Condition>
+ <Condition Action="enable">MONGO_SERVICE_INSTALL</Condition>
+ </Control>
+ <Control Id="textDataDirectory" Type="Text" X="23" Y="188" Width="64" Height="15" TabSkip="yes">
+ <Text>Data Directory:</Text>
+ <Condition Action="disable">NOT MONGO_SERVICE_INSTALL</Condition>
+ <Condition Action="enable">MONGO_SERVICE_INSTALL</Condition>
+ </Control>
+ <Control Id="textLogDirectory" Type="Text" X="23" Y="210" Width="62" Height="15" TabSkip="yes">
+ <Text>Log Directory:</Text>
+ <Condition Action="disable">NOT MONGO_SERVICE_INSTALL</Condition>
+ <Condition Action="enable">MONGO_SERVICE_INSTALL</Condition>
+ </Control>
+ <Control Id="editDataDirectory" Type="Edit" X="98" Y="188" Width="237" Height="15" TabSkip="no" Property="MONGO_DATA_PATH">
+ <Text>{32767}</Text>
+ <Condition Action="disable">NOT MONGO_SERVICE_INSTALL</Condition>
+ <Condition Action="enable">MONGO_SERVICE_INSTALL</Condition>
+ </Control>
+ <Control Id="editLogDirectory" Type="Edit" X="98" Y="210" Width="238" Height="15" TabSkip="no" Property="MONGO_LOG_PATH">
+ <Text>{32767}</Text>
+ <Condition Action="disable">NOT MONGO_SERVICE_INSTALL</Condition>
+ <Condition Action="enable">MONGO_SERVICE_INSTALL</Condition>
+ </Control>
+ </Dialog>
+
+ <!-- A dialog box to choose to optionally install Compass -->
<Dialog Id="CompassDlg" X="50" Y="50" Width="370" Height="270" Title="MongoDB Compass">
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" Text="WixUI_Bmp_Banner" TabSkip="no" Disabled="yes" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" TabSkip="yes" Disabled="yes" />
@@ -49,8 +160,7 @@
<Control Id="InstallCompass" CheckBoxValue="1" Property="SHOULD_INSTALL_COMPASS" X="15" Y="243" Width="150" Height="17" Text="Install MongoDB Compass" Type="CheckBox" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back" TabSkip="no">
- <Publish Event="NewDialog" Value="MongoSetupTypeDlg">WixUI_InstallMode = "InstallComplete" OR WixUI_InstallMode = "InstallTypical"</Publish>
- <Publish Event="NewDialog" Value="CustomizeDlg">WixUI_InstallMode = "InstallCustom"</Publish>
+ <Publish Event="NewDialog" Value="ServiceDlg">1</Publish>
</Control>
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Text="&amp;Next" TabSkip="no" Disabled="no" >
<Publish Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
@@ -61,6 +171,7 @@
</Dialog>
<ProgressText Action="InstallCompassScript">Installing MongoDB Compass... (this may take a few minutes)</ProgressText>
- </UI>
+
+ </UI>
</Fragment>
</Wix>