root/windows/Neo2.0_installer.nsi @ 2155

Revision 2155, 12.1 KB (checked in by florian, 7 months ago)

Aktueller Installer und Dummy

RevLine 
[2129]1;NSIS-Installer f�e Windowstreiber
2;Geschrieben von Florian Jan�n
3;
4; Offene Punkte:
5; - Uninstaller
[2155]6; - bislang keine Abfrage ob Autostart
[2129]7;
8; Status:
[2155]9; - Installiert kbdneo (mit und ohne Zustatzskript)
10; - F�t bei Bedarf auf NeoVars-Installation zur� - Erkennt 32- und 64bit Systeme und w�t entsprechenden Treiber aus.
[2129]11; - Kann auf die 64bit Registry und 64bit-Systemordner von Vista und 7 zugreifen
12; - Rechteverwaltung bei XP, Vista und 7
[2155]13; - Autostart wird angelegt
14
[2129]15
16
[2155]17;--------------------------------
[2129]18;MUI Oberfl�e
19;Nur eine Section ausw�bar
20;64bit Zauberei
21;bisschen Logik
[2155]22;Benutzerkontensteuerung
23        !include "MUI2.nsh"
24        !include "Sections.nsh"
25        !include "x64.nsh"
26        !include "LogicLib.nsh"
27        !include "UAC.nsh"
28
[2129]29
30
[2155]31;--------------------------------
[2129]32;Allgemeines
33
34;Name und Name der Datei
35
36        !define /date ZEIT "%y%m%d.%H"
[2155]37        Name "Neo2.0 - Das ergonomische Tastaturlayout"
38        OutFile "Neo2.0_setup.exe"
39
40;Standardordner (f�)
[2129]41        InstallDir "$PROGRAMFILES\Neo2"
[2155]42
[2129]43;Mal sehen ob Neo schon mal da war
44        InstallDirRegKey HKCU "Software\Neo 2.0" ""
[2155]45
[2129]46;Rechte anfordern
47        RequestExecutionLevel user ;Muss �user� sein, Admin wird nachtr�ich gerufen
[2155]48
[2129]49;Zeige was geschieht
[2155]50        ShowInstDetails show
51
52;Warnung bei Abbruch
[2129]53        !define MUI_ABORTWARNING ;Warnt falls Installations abgebrochen wird
[2155]54
[2129]55
[2155]56
57;--------------------------------
[2129]58;Seiten des Installers
59
60        !define WELCOME_TITLE "Willkommen zum Installations-  Assistenten f� 2.0"
[2155]61        !define UNWELCOME_TITLE "Willkommen zum Deinstallations-  Assistenten f� 2.0"
62        !define FINISH_TITLE "Die Installation von Neo 2.0 wurde erfolgreich beendet."
63        !define UNFINISH_TITLE "Die Deinstallation von Neo 2.0 wurde erfolgreich beendet."
64        !define MUI_COMPONENTSPAGE_SMALLDESC
65       
66        !define MUI_WELCOMEPAGE_TITLE "${WELCOME_TITLE}"
67        !define MUI_WELCOMEPAGE_TITLE_3LINES ;3 Zeilen f� Titel
68        !insertmacro MUI_PAGE_WELCOME
69       
70        !insertmacro MUI_PAGE_LICENSE "lizenz.txt"
71       
72        !define MUI_PAGE_CUSTOMFUNCTION_PRE preComp
73        !define MUI_PAGE_CUSTOMFUNCTION_LEAVE leaveComp
74        !insertmacro MUI_PAGE_COMPONENTS
75       
76        !define MUI_PAGE_CUSTOMFUNCTION_PRE preDir
77        !insertmacro MUI_PAGE_DIRECTORY
78       
79        !define MUI_PAGE_CUSTOMFUNCTION_LEAVE leaveInst
80        !insertmacro MUI_PAGE_INSTFILES
81       
82        !define MUI_FINISHPAGE_TITLE "${FINISH_TITLE}"
83        !define MUI_FINISHPAGE_TITLE_3LINES
84        !insertmacro MUI_PAGE_FINISH
85
[2129]86
87
88;Deutsche Oberfl�e
[2155]89        !insertmacro MUI_LANGUAGE "German"
90
[2129]91
92
93;---------------------------------
[2155]94;Ein paar Variablen
95        !define KLF_REORDER             8
96        !define KLF_ACTIVATE    1
97
[2129]98
99
100;--------------------------------
[2155]101;Installer Sections
102
[2131]103;Verschiedene Installationstypen
[2155]104        InstType  "Vollst�ig"
105        InstType  "Nur Teiber kein Skript"
106        InstType  "Nur NeoVars"
107        ;InstType /NOCUSTOM
108
[2129]109;Die eigentlichen Sections
[2155]110        Section /o "Neo-2.0-Treiber" installiereKbdneoOhneAHK
111        SectionIn  2
112                SetOutPath "$SYSDIR"
113                ${If} ${RunningX64}
114                        SetRegView 64
115                        WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout Text" "Deutsch (Neo 2.0 ergonomisch)"
116                        WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout File" "kbdneo2.dll"
117                        WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout Id" "00c0"
118                        WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout Display Name" "@%SystemRoot%\system32\kbdneo2.dll,-1000"
119                        WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Custom Language Name" "German (Germany)"
120                        WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Custom Language Display Name" "@%SystemRoot%\system32\kbdneo2.dll,-1100"
121                        SetRegView 32
122                        ${DisableX64FSRedirection}
123                        file kbdneo2\Treiber\64bit_Windows\kbdneo2.dll
124            ${Else}
125                        SetRegView 32
126                        WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout Text" "Deutsch (Neo 2.0 ergonomisch)"
127                        WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout File" "kbdneo2.dll"
128                        WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout Id" "00c0"
129                        WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout Display Name" "@%SystemRoot%\system32\kbdneo2.dll,-1000"
130                        WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Custom Language Name" "German (Germany)"
131                        WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Custom Language Display Name" "@%SystemRoot%\system32\kbdneo2.dll,-1100"
132                        ${EnableX64FSRedirection}
133                        file kbdneo2\Treiber\32bit_Windows\kbdneo2.dll
134                ${EndIf}
135               
136                !insertmacro UAC_AsUser_Call Function makeKBDactive ${UAC_SYNCREGISTERS}
137               
138        SectionEnd
139
[2129]140
141        Section /o "Neo-2.0-Treiber und AHK-Erweiterung" installiereKbdneoPlusAHK
[2155]142        SectionIn 1
143                SetOutPath "$INSTDIR"
144               
145        ;Zustatz Skript kopieren (immer als 32bit)
146                file kbdneo2\Treiber\AHK_f�neo2\kbdneo_ahk.exe
147               
148        ;Erstellt eine Verkn� im Autostart-Ordner 
149                !insertmacro UAC_AsUser_Call Function goUserDir ${UAC_SYNCREGISTERS}
150               
151                SetOutPath "$SYSDIR"
152                ${If} ${RunningX64}
153                SetRegView 64
154                        WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout Text" "Deutsch (Neo 2.0 ergonomisch)"
155                        WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout File" "kbdneo2.dll"
156                        WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout Id" "00c0"
157                        WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout Display Name" "@%SystemRoot%\system32\kbdneo2.dll,-1000"
158                        WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Custom Language Name" "German (Germany)"
159                        WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Custom Language Display Name" "@%SystemRoot%\system32\kbdneo2.dll,-1100"
160                        SetRegView 32
161                        ${DisableX64FSRedirection}
162                        file kbdneo2\Treiber\64bit_Windows\kbdneo2.dll
163                ${Else}
164                        SetRegView 32
165                        WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout Text" "Deutsch (Neo 2.0 ergonomisch)"
166                        WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout File" "kbdneo2.dll"
167                        WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout Id" "00c0"
168                        WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Layout Display Name" "@%SystemRoot%\system32\kbdneo2.dll,-1000"
169                        WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Custom Language Name" "German (Germany)"
170                        WriteRegStr HKEY_LOCAL_MACHINE "SYSTEM\CurrentControlSet\Control\Keyboard Layouts\b0000407" "Custom Language Display Name" "@%SystemRoot%\system32\kbdneo2.dll,-1100"
171                        ${EnableX64FSRedirection}
172                        file kbdneo2\Treiber\32bit_Windows\kbdneo2.dll
173                ${EndIf}
174               
175                ; !insertmacro UAC_AsUser_Call Function makeKBDactive ${UAC_SYNCREGISTERS}
176               
177        SectionEnd
178
[2129]179
180        Section /o "Eigenst�iges Neo2.0-AHK-Skript (NeoVars)" installiereAHK
[2155]181        SectionIn 3
182                SetOutPath "$INSTDIR"
183                file neo-vars\out\neo20.exe
184                createShortCut "$SMPROGRAMS\Startup\Neo2.0 (AHK).lnk"  "$INSTDIR\neo20.exe"
185                WriteRegStr HKCU "Software\Neo 2.0" "" $INSTDIR
186               
187        SectionEnd
188
[2131]189
[2129]190
191;--------------------------------
[2155]192; Functions
193
[2129]194;nur ein Installationszweig ausw�bar
[2155]195        Function .onSelChange
196                !insertmacro StartRadioButtons $1
197                !insertmacro RadioButton ${installiereKbdneoOhneAHK}
198                !insertmacro RadioButton ${installiereKbdneoPlusAHK}
199                !insertmacro RadioButton ${installiereAHK}
200                !insertmacro EndRadioButtons
201        FunctionEnd
202
[2129]203
204;UAC Zauberei
[2155]205        Function .onInit
206                StrCpy $1 ${installiereKbdneoPlusAHK}
207               
208                uac_tryagain:
209                !insertmacro UAC_RunElevated
210                #MessageBox mb_TopMost "0=$0 1=$1 2=$2 3=$3"
211                ${Switch} $0
212                ${Case} 0
213                        ${IfThen} $1 = 1 ${|} Quit ${|} ;we are the outer process, the inner process has done its work, we are done
214                        ${IfThen} $3 <> 0 ${|} ${Break} ${|} ;we are admin, let the show go on
215                        ${If} $1 = 3 ;RunAs completed successfully, but with a non-admin user
216                                MessageBox mb_IconExclamation|mb_TopMost|mb_SetForeground "Dieser Installationsassistent ben�t Adminrechte, bitte erneut versuchen." /SD IDNO IDOK uac_tryagain IDNO 0
217                        ${EndIf}
218                        ;fall-through and die
219                ${Case} 1223 ;hier kommt der Ausstieg falls der User keine Adminrechte erwerben kann.
220                        MessageBox MB_YESNO|mb_IconStop|mb_TopMost|mb_SetForeground "F� Installation des Windowstreibers werden Adminrechte ben�t. Mit NeoVars kann jedoch auch ohne Adminrechte das Neo2.0-Tastaturlayout installiert werden. Bitte die Hinweise auf der Website beachten. Soll Neo-Vars gestartet werden?" IDYES gogogo
221                        ExecShell "open" "http://neo-layout.org/windows"
222                        Quit
223                        gogogo:
224                        ExecShell "open" http://neo-layout.org/windows
225                        goto end
226                ${Case} 1062
227                        MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Logon-Dienst nicht verf� Abbruch!"
228                        Quit
229                ${Default}
230                        MessageBox mb_IconStop|mb_TopMost|mb_SetForeground "Ups , Error $0"
231                        Quit
232                ${EndSwitch}
233                        end:
234        FunctionEnd
235
[2129]236
237;Sperrt ohne Adminrechte alles au�r NeoVars
[2155]238        Function preComp
239                userInfo::getAccountType
240                pop $R0
241                strCmp $R0 "Admin" +5 ;falls Admin h�Commandozeilen weiter
242                ;wenn kein Admin wird das hier angezeigt:
243                messageBox MB_OK  "Wir sind kein Admin, sondern �$R0�"
244                        SectionSetFlags ${installiereKbdneoPlusAHK} ${SF_RO} ;Installationsarten mit Adminrechten werden gesperrt
245                        SectionSetFlags ${installiereKbdneoOhneAHK} ${SF_RO} ;Installationsarten mit Adminrechten werden gesperrt
246                        return
247                messageBox MB_OK "Wir sind Admin"
248        FunctionEnd
249
[2129]250
251;�erspringt die Directory-Seite falls kein AHK installiert wird
[2155]252        Function leaveComp
253                SectionGetFlags ${installiereKbdneoOhneAHK} $0
254                IntOp $1 $0 & ${SF_SELECTED}
255                IntCmp $1 0 showDir
256                push "skip components" ;schiebt es auf den Stack
257                showDir:
258        FunctionEnd
259 
[2129]260        Function preDir
[2155]261                pop $R0 ;holt es sich vom Stack zur�    StrCmp "$R0" "skip components" 0 end ;vergleicht es und springt zu Ende wenn es nicht passt
262                abort ;hat gepasst, Components-Seite wird �rungen.
263                end:
264        FunctionEnd
265
266
[2129]267;Verschafft etwas Zeit zum Kucken
268        Function leaveInst
[2155]269                sleep 3000 ;Ein bisschen Pause, damit man was sieht.
270        FunctionEnd
271       
272       
273;Layout beim User Aktivieren (hoffentlich ;)
274        Function makeKBDactive
275                System::Call "user32::LoadKeyboardLayout(t "b0000407",${KLF_ACTIVATE})"
276        FunctionEnd
277
278
[2129]279;Datei beim User schreiben, obwohl als Admin eingeloggt
280        Function goUserDir
[2155]281                createShortCut "$SMPROGRAMS\Startup\AHK f�neo.lnk"  "$INSTDIR\kbdneo_ahk.exe"
282        FunctionEnd
283
284
[2129]285
286;--------------------------------
[2155]287;Beschreibung der Installationstypen
[2129]288;LangsStrings (nur Deutsch)
[2155]289        LangString DESC_installiereKbdneoPlusAHK ${LANG_GERMAN} "System32-Test und bel. Ordner (hier sollten immer Adminrechte angefordert werden)"
290        LangString DESC_installiereKbdneoOhneAHK ${LANG_GERMAN} "nur System32-Test (hier sollten immer Adminrechte angefordert werden)"
291        LangString DESC_installiereAHK ${LANG_GERMAN} "Installiert den Neo2.0-AHK-Standalone-Treiber Neo-Vars (keine Adminrechte n�)"
292
293
[2129]294;LangsStrings den Sections zuordnen
295        !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
[2155]296                !insertmacro MUI_DESCRIPTION_TEXT ${installiereKbdneoPlusAHK} $(DESC_installiereKbdneoPlusAHK)
297                !insertmacro MUI_DESCRIPTION_TEXT ${installiereKbdneoOhneAHK} $(DESC_installiereKbdneoOhneAHK)
298                !insertmacro MUI_DESCRIPTION_TEXT ${installiereAHK} $(DESC_installiereAHK)     
299        !insertmacro MUI_FUNCTION_DESCRIPTION_END
300
301
[2129]302
303;---------------------------------
304;Dateieigenschaften des Installers
[2155]305
306VIAddVersionKey /LANG=${LANG_GERMAN} "ProductName" "Neo 2.0"
[2129]307VIAddVersionKey /LANG=${LANG_GERMAN} "Comments" "Buy me a Caff�;)"
[2155]308VIAddVersionKey /LANG=${LANG_GERMAN} "FileDescription" "Neo 2.0 Installationsassistent"
309VIAddVersionKey /LANG=${LANG_GERMAN} "FileVersion" "${ZEIT}"
310VIProductVersion "2.0.${ZEIT}"
Note: See TracBrowser for help on using the browser.