diff options
| author | pca <pca@6c8d7289-2bf4-0310-a012-ef5d649a1542> | 2011-05-09 06:16:35 +0000 |
|---|---|---|
| committer | pca <pca@6c8d7289-2bf4-0310-a012-ef5d649a1542> | 2011-05-09 06:16:35 +0000 |
| commit | 440e3ba88773f786b53c663d4f8871398ac771b9 (patch) | |
| tree | eef4ecc33888d52951c7bb36185785481e5cca17 /build.nsi | |
| parent | 039126cfaf2ce91629ef8df7006ac30773f2818c (diff) | |
Windows Installer:
- remove firewall-handling for WinXP (can only open for JRE not for
special port)
- Vista/Win 7: open port 1900 for communication with router (uPnP)
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7710 6c8d7289-2bf4-0310-a012-ef5d649a1542
Diffstat (limited to 'build.nsi')
| -rwxr-xr-x | build.nsi | 55 |
1 files changed, 30 insertions, 25 deletions
@@ -42,13 +42,10 @@ InstallDirRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\YaCy" !define RecommendSpace "30"
; some string for Firewall
-!define WinXPAddFwRulePort 'netsh firewall add portopening protocol=tcp port=8090 name=YaCy mode=enable'
-!define WinXPDelFwRulePort 'netsh firewall del portopening protocol=tcp port=8090'
-!define WinVistaAddFwRulePort 'netsh advfirewall firewall add rule name="YaCy" program="%SystemRoot%\System32\javaw.exe" dir=in action=allow protocol=tcp localport=8090'
-!define WinVistaDelFwRulePort 'netsh advfirewall firewall del rule name="YaCy"'
-var WinAddFwRulePort
-var WinDelFwRulePort
-
+!define WinAddYaCyPort 'netsh advfirewall firewall add rule name="YaCy" program="%SystemRoot%\System32\javaw.exe" dir=in action=allow protocol=tcp localport=8090'
+!define WinDelYaCyPort 'netsh advfirewall firewall del rule name="YaCy"'
+!define WinAdduPnpPort 'netsh advfirewall firewall add rule name="YaCy uPnp" program="%SystemRoot%\System32\javaw.exe" dir=in action=allow protocol=udp remoteip=defaultgateway remoteport=1900'
+!define WinDeluPnpPort 'netsh advfirewall firewall del rule name="YaCy uPnp"'
;requested execution level on Vista / 7
RequestExecutionLevel admin
@@ -186,7 +183,7 @@ Section "Desktop Icon" CreateShortCut "$DESKTOP\YaCy.lnk" "$INSTDIR\startYACY.bat" "" "$INSTDIR\addon\YaCy.ico" "" SW_SHOWMINIMIZED
SectionEnd
-Section "Open Firewall (Port 8090)" Sec_Firewall_id
+Section "Open Firewall (Port 8090 for YaCy and 1900 for uPnP)" Sec_Firewall_id
SectionIn 1
SetShellVarContext current
call OpenFirewall
@@ -268,18 +265,9 @@ Function .onInit ${If} ${IsWinVista}
${OrIf} ${IsWin7}
- StrCpy $WinAddFwRulePort '${WinVistaAddFwRulePort}'
- StrCpy $WinDelFwRulePort '${WinVistaDelFwRulePort}'
- ReadRegDWORD $FirewallServiceStart HKLM "SYSTEM\CurrentControlSet\services\MpsSvc" "Start"
+ ReadRegDWORD $FirewallServiceStart HKLM "SYSTEM\CurrentControlSet\services\MpsSvc" "Start"
${EndIf}
- ${If} ${IsWinXP}
- ${AndIf} ${AtLeastServicePack} 2
- StrCpy $WinAddFwRulePort '${WinXPAddFwRulePort}'
- StrCpy $WinDelFwRulePort '${WinXPDelFwRulePort}'
- ReadRegDWORD $FirewallServiceStart HKLM "SYSTEM\CurrentControlSet\services\SharedAccess" "Start"
- ${EndIf}
-
;need Admin for firewall-config
${IfNot} $0 = "Admin"
IntOp $FirewallServiceStart 3 + 0
@@ -386,12 +374,22 @@ FunctionEnd Function OpenFirewall
var /global ExecErrorCode
- ; run netsh
- nsExec::ExecToStack '$WinAddFwRulePort'
+ ; run netsh for Port 8090
+ nsExec::ExecToStack '${WinAddYaCyPort}'
pop $ExecErrorCode
; if run without error register for uninstall and clear finish page
${If} $ExecErrorCode = "0"
- WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\YaCy" "DelFwRulePort" '$WinDelFwRulePort'
+ WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\YaCy" "DelFwYaCyPort" '${WinDelYaCyPort}'
+ IntOp $FirewallServiceStart 0 + 0
+ ${Else}
+ IntOp $FirewallServiceStart 3 + 0
+ ${EndIf}
+ ; run netsh for Port 1900 - uPnP
+ nsExec::ExecToStack '${WinAdduPnpPort}'
+ pop $ExecErrorCode
+ ; if run without error register for uninstall and clear finish page
+ ${If} $ExecErrorCode = "0"
+ WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\YaCy" "DelFwuPnpPort" '${WinDeluPnpPort}'
IntOp $FirewallServiceStart 0 + 0
${Else}
IntOp $FirewallServiceStart 3 + 0
@@ -402,15 +400,22 @@ Function SHOW_PageFinish_custom ; hide and disable firewall info from wiki if firewall is open
${If} $FirewallServiceStart = 0
SendMessage $mui.FinishPage.ShowReadme ${BM_SETCHECK} 0 0
- ShowWindow $mui.FinishPage.ShowReadme ${SW_HIDE}
+ ShowWindow $mui.FinishPage.ShowReadme ${SW_HIDE}
${EndIf}
FunctionEnd
Function un.CloseFirewall
; get string for closing port from registy
- ReadRegStr '$WinDelFwRulePort' HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\YaCy" "DelFwRulePort"
+ var /global UninstallCmd
+ ; close YaCy-Port 8090
+ ReadRegStr '$UninstallCmd' HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\YaCy" "DelFwYaCyPort"
; if found > run netsh to close port
- ${IfNot} '$WinDelFwRulePort' == ''
- nsExec::ExecToStack '$WinDelFwRulePort'
+ ${IfNot} '$UninstallCmd' == ''
+ nsExec::ExecToStack '$UninstallCmd'
+ ${EndIf}
+ ; close uPnp-Port 1900
+ ReadRegStr '$UninstallCmd' HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\YaCy" "DelFwuPnPPort"
+ ${IfNot} '$UninstallCmd' == ''
+ nsExec::ExecToStack '$UninstallCmd'
${EndIf}
FunctionEnd
|
