Statistiques
| Révision :

root / tmp / org.txm.setups / nsis / Examples / example2.nsi @ 2247

Historique | Voir | Annoter | Télécharger (2,57 ko)

1 728 mdecorde
; example2.nsi
2 728 mdecorde
;
3 728 mdecorde
; This script is based on example1.nsi, but it remember the directory,
4 728 mdecorde
; has uninstall support and (optionally) installs start menu shortcuts.
5 728 mdecorde
;
6 728 mdecorde
; It will install example2.nsi into a directory that the user selects,
7 728 mdecorde
8 728 mdecorde
;--------------------------------
9 728 mdecorde
10 728 mdecorde
; The name of the installer
11 728 mdecorde
Name "Example2"
12 728 mdecorde
13 728 mdecorde
; The file to write
14 728 mdecorde
OutFile "example2.exe"
15 728 mdecorde
16 728 mdecorde
; The default installation directory
17 728 mdecorde
InstallDir $PROGRAMFILES\Example2
18 728 mdecorde
19 728 mdecorde
; Registry key to check for directory (so if you install again, it will
20 728 mdecorde
; overwrite the old one automatically)
21 728 mdecorde
InstallDirRegKey HKLM "Software\NSIS_Example2" "Install_Dir"
22 728 mdecorde
23 728 mdecorde
; Request application privileges for Windows Vista
24 728 mdecorde
RequestExecutionLevel admin
25 728 mdecorde
26 728 mdecorde
;--------------------------------
27 728 mdecorde
28 728 mdecorde
; Pages
29 728 mdecorde
30 728 mdecorde
Page components
31 728 mdecorde
Page directory
32 728 mdecorde
Page instfiles
33 728 mdecorde
34 728 mdecorde
UninstPage uninstConfirm
35 728 mdecorde
UninstPage instfiles
36 728 mdecorde
37 728 mdecorde
;--------------------------------
38 728 mdecorde
39 728 mdecorde
; The stuff to install
40 728 mdecorde
Section "Example2 (required)"
41 728 mdecorde
42 728 mdecorde
  SectionIn RO
43 728 mdecorde
44 728 mdecorde
  ; Set output path to the installation directory.
45 728 mdecorde
  SetOutPath $INSTDIR
46 728 mdecorde
47 728 mdecorde
  ; Put file there
48 728 mdecorde
  File "example2.nsi"
49 728 mdecorde
50 728 mdecorde
  ; Write the installation path into the registry
51 728 mdecorde
  WriteRegStr HKLM SOFTWARE\NSIS_Example2 "Install_Dir" "$INSTDIR"
52 728 mdecorde
53 728 mdecorde
  ; Write the uninstall keys for Windows
54 728 mdecorde
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "DisplayName" "NSIS Example2"
55 728 mdecorde
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "UninstallString" '"$INSTDIR\uninstall.exe"'
56 728 mdecorde
  WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "NoModify" 1
57 728 mdecorde
  WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "NoRepair" 1
58 728 mdecorde
  WriteUninstaller "uninstall.exe"
59 728 mdecorde
60 728 mdecorde
SectionEnd
61 728 mdecorde
62 728 mdecorde
; Optional section (can be disabled by the user)
63 728 mdecorde
Section "Start Menu Shortcuts"
64 728 mdecorde
65 728 mdecorde
  CreateDirectory "$SMPROGRAMS\Example2"
66 728 mdecorde
  CreateShortCut "$SMPROGRAMS\Example2\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
67 728 mdecorde
  CreateShortCut "$SMPROGRAMS\Example2\Example2 (MakeNSISW).lnk" "$INSTDIR\example2.nsi" "" "$INSTDIR\example2.nsi" 0
68 728 mdecorde
69 728 mdecorde
SectionEnd
70 728 mdecorde
71 728 mdecorde
;--------------------------------
72 728 mdecorde
73 728 mdecorde
; Uninstaller
74 728 mdecorde
75 728 mdecorde
Section "Uninstall"
76 728 mdecorde
77 728 mdecorde
  ; Remove registry keys
78 728 mdecorde
  DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2"
79 728 mdecorde
  DeleteRegKey HKLM SOFTWARE\NSIS_Example2
80 728 mdecorde
81 728 mdecorde
  ; Remove files and uninstaller
82 728 mdecorde
  Delete $INSTDIR\example2.nsi
83 728 mdecorde
  Delete $INSTDIR\uninstall.exe
84 728 mdecorde
85 728 mdecorde
  ; Remove shortcuts, if any
86 728 mdecorde
  Delete "$SMPROGRAMS\Example2\*.*"
87 728 mdecorde
88 728 mdecorde
  ; Remove directories used
89 728 mdecorde
  RMDir "$SMPROGRAMS\Example2"
90 728 mdecorde
  RMDir "$INSTDIR"
91 728 mdecorde
92 728 mdecorde
SectionEnd