DirectX Installation with Web Installer: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Reverted edits by 79.162.3.49 to last version by Seg telltale)
 
Line 22: Line 22:
The obvious flaw is when a user has unreliable Internet access. The web installer isn't very smart and will take a long time to exit if the Internet doesn't exist for the end user. You will need to introduce messaging to the user that explains the update will work best with Internet access.
The obvious flaw is when a user has unreliable Internet access. The web installer isn't very smart and will take a long time to exit if the Internet doesn't exist for the end user. You will need to introduce messaging to the user that explains the update will work best with Internet access.


<span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">==Installing DirectX== The process of using the web installer is the following: # Copy the Web Installer onto the user's TEMP folder. # Run the installer from the TEMP folder. # Wait till DirectX is done updating. # Remove the locally stored installer from the TEMP folder. To start, you will need to declare the following variable early in the NSIS script: <highlight-nsis>Var DirectXSetupError</highlight-nsis> To make things easier on yourself, create a new Section for DirectX.</span> == Instalacja DirectX == proces przy użyciu instalatora internetowej jest następujący: # Copy Web Installer na użytkownika folderze TEMP. # Uruchom instalator z folderu Temp. # Zaczekaj, aż DirectX dokonuje aktualizacji. # Usunięcie przechowywanej lokalnie instalatora z folderu Temp. Aby rozpocząć, należy zadeklarować następującą zmienną na początku skryptu NSIS: <highlight-nsis> Var DirectXSetupError </ highlight-nsis> Aby ułatwić ich na siebie, tworzą nową sekcję dla DirectX.</span> <span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">NSIS will run the section while installing.</span> NSIS będzie działał punkt podczas instalacji.</span> <span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">The placement of the section could go anywhere, but it's highly recommended that DirectX be ''the last install section'' after everything else is complete.</span> Umieszczanie sekcji można przejść w dowolnym miejscu, ale bardzo zalecane DirectX być''ostatnio zainstalować sekcji''po wszystko, co jest kompletna.</span> <span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">This is incase DirectX fails, your software will be installed. If you use component install UI, DirectX will show up as an entry.</span> To jest okrywać DirectX nie, program zostanie zainstalowany. Przypadku korzystania z części instalacji interfejsu DirectX będą wyświetlane jako wejścia.</span> <span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">You can force on with "SectionIn RO", or leave out if you wish the user to have the option to run the DirectX install. <highlight-nsis>Section "DirectX Install" SEC_DIRECTX SectionIn RO SetOutPath "$TEMP" File "dxwebsetup.exe" DetailPrint "Running DirectX Setup..." ExecWait '"$TEMP\dxwebsetup.exe" /Q' $DirectXSetupError DetailPrint "Finished DirectX Setup" Delete "$TEMP\dxwebsetup.exe" SetOutPath "$INSTDIR" SectionEnd</highlight-nsis> '''Note:''' I redeclare the '''SetOutPath''' to $INSTDIR.</span> Możesz życie z "SectionIn RO" lub pominąć, jeśli chcesz, aby użytkownik miał możliwość uruchomienia instalacji DirectX. <highlight-nsis> Sekcji "Instalacja DirectX" SEC_DIRECTX SectionIn RO SetOutPath "$ temp" File "dxwebsetup. exe "DetailPrint" Running DirectX Setup ... "ExecWait" $ temp \ dxwebsetup.exe "/ Q" $ DirectXSetupError DetailPrint "Zakończono DirectX Setup" Delete "$ temp \ dxwebsetup.exe" SetOutPath "$ INSTDIR" SectionEnd </ highlight -nsis>'' 'Uwaga:''' I redeclare'' 'SetOutPath''' to $ INSTDIR.</span> <span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">This way shortcuts and other functions using SetOutPath won't get messed up.</span> Ten sposób skrótów i innych funkcji za pomocą SetOutPath nie będzie zawiedli.</span> <span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">Alter this line accordingly. The variable $DirectXSetupError is used to force NSIS to pause while the DirectX setup is running.</span> Alter tej linii w związku. Zmienną $ DirectXSetupError służy do obowiązujących NSIS wstrzymać konfiguracji DirectX jest uruchomiony.</span> <span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">You can use the error code to further script error handling, but a variable is required to be there in order for NSIS to wait. I've also included '''DetailPrint''' lines to display the DirectX status in the install logs.</span> Możesz użyć kodu błędu do dalszej obróbki błąd skryptu, ale zmienna wymagana jest tam w celu NSIS czekać. Ive 'także''' DetailPrint'' 'linii do wyświetlania statusu DirectX zainstalować dzienników.</span> <span onmouseover="_tipon(this)" onmouseout="_tipoff()"><span class="google-src-text" style="direction: ltr; text-align: left">These strings can be localized to your liking.</span> Takie łańcuchy mogą być zlokalizowane do swoich potrzeb.</span>
==Installing DirectX==
 
The process of using the web installer is the following:
 
# Copy the Web Installer onto the user's TEMP folder.
# Run the installer from the TEMP folder.
# Wait till DirectX is done updating.
# Remove the locally stored installer from the TEMP folder.
 
To start, you will need to declare the following variable early in the NSIS script:
 
<highlight-nsis>Var DirectXSetupError</highlight-nsis>
 
To make things easier on yourself, create a new Section for DirectX. NSIS will run the section while installing. The placement of the section could go anywhere, but it's highly recommended that DirectX be ''the last install section'' after everything else is complete. This is incase DirectX fails, your software will be installed.
 
If you use component install UI, DirectX will show up as an entry. You can force on with "SectionIn RO", or leave out if you wish the user to have the option to run the DirectX install.
 
<highlight-nsis>Section "DirectX Install" SEC_DIRECTX
 
SectionIn RO
 
SetOutPath "$TEMP"
File "dxwebsetup.exe"
DetailPrint "Running DirectX Setup..."
ExecWait '"$TEMP\dxwebsetup.exe" /Q' $DirectXSetupError
DetailPrint "Finished DirectX Setup"
 
Delete "$TEMP\dxwebsetup.exe"
SetOutPath "$INSTDIR"
SectionEnd</highlight-nsis>
 
'''Note:''' I redeclare the '''SetOutPath''' to $INSTDIR. This way shortcuts and other functions using SetOutPath won't get messed up. Alter this line accordingly.
 
The variable $DirectXSetupError is used to force NSIS to pause while the DirectX setup is running. You can use the error code to further script error handling, but a variable is required to be there in order for NSIS to wait.
 
I've also included '''DetailPrint''' lines to display the DirectX status in the install logs. These strings can be localized to your liking.


==See Also==
==See Also==

Latest revision as of 17:04, 15 March 2010

The following is for NSIS installations that need DirectX and you assume the user to be connected to the Internet. While this isn't completely full-proof, it's better than adding over 100mb to your install file.

For off-line installers, especially when distributed via DVD, CD-ROM or other fixed media, see DirectX Installation for Fixed Media.

Prerequisites

Obtain the latest DirectX End-User Runtime Web Installer from Microsoft. It's very small as it dynamically pulls the content it needs when run.

This script also assumes the NSIS installer is requesting Admin privileges in the form of RequestExecutionLevel admin.

About the Web Installer

When you run the Web installer, the installer will do the following:

  1. Examine the user's current DirectX install.
  2. Obtain a list of all available DirectX files from the Microsoft servers.
  3. Compare the local install with the latest available.
  4. Download files not existent on the user computer.
  5. Install the new files.
  6. Clean up the existing DirectX install.

The obvious flaw is when a user has unreliable Internet access. The web installer isn't very smart and will take a long time to exit if the Internet doesn't exist for the end user. You will need to introduce messaging to the user that explains the update will work best with Internet access.

Installing DirectX

The process of using the web installer is the following:

  1. Copy the Web Installer onto the user's TEMP folder.
  2. Run the installer from the TEMP folder.
  3. Wait till DirectX is done updating.
  4. Remove the locally stored installer from the TEMP folder.

To start, you will need to declare the following variable early in the NSIS script:

Var DirectXSetupError

To make things easier on yourself, create a new Section for DirectX. NSIS will run the section while installing. The placement of the section could go anywhere, but it's highly recommended that DirectX be the last install section after everything else is complete. This is incase DirectX fails, your software will be installed.

If you use component install UI, DirectX will show up as an entry. You can force on with "SectionIn RO", or leave out if you wish the user to have the option to run the DirectX install.

Section "DirectX Install" SEC_DIRECTX
 
 SectionIn RO
 
 SetOutPath "$TEMP"
 File "dxwebsetup.exe"
 DetailPrint "Running DirectX Setup..."
 ExecWait '"$TEMP\dxwebsetup.exe" /Q' $DirectXSetupError
 DetailPrint "Finished DirectX Setup"
 
 Delete "$TEMP\dxwebsetup.exe"
 
 SetOutPath "$INSTDIR"
 
SectionEnd

Note: I redeclare the SetOutPath to $INSTDIR. This way shortcuts and other functions using SetOutPath won't get messed up. Alter this line accordingly.

The variable $DirectXSetupError is used to force NSIS to pause while the DirectX setup is running. You can use the error code to further script error handling, but a variable is required to be there in order for NSIS to wait.

I've also included DetailPrint lines to display the DirectX status in the install logs. These strings can be localized to your liking.

See Also