Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
Windows Installer: - add support for Windows Firewall on Win XP (SP2/SP3), Vista and Win 7 (open port 8090) - this should cover almost every Windows installation at home
pca4a237bfa5d00
diff --git a/build.nsi b/build.nsiindex 5a9564d52..66408e812 100755--- a/build.nsi+++ b/build.nsi@@ -16,7 +16,6 @@ COMMAND LINE OPTIONS (case sensitive):; MODERN UI!include MUI2.nsh-!include x64.nsh!include FileFunc.nsh!include WinVer.nsh@@ -41,6 +40,15 @@ InstallDirRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\YaCy";recommend free space in GB for YaCy!define RecommendSpace "30"+; some string for Firewall+!define WinXPAddFwRule 'netsh firewall add portopening protocol=tcp port=8090 name=YaCy mode=enable'+!define WinXPDelFwRule 'netsh firewall del portopening protocol=tcp port=8090'+!define WinVistaAddFwRule 'netsh advfirewall firewall add rule name="YaCy" dir=in action=allow protocol=tcp localport=8090'+!define WinVistaDelFwRule 'netsh advfirewall firewall del rule name="YaCy"'+var WinAddFwRule+var WinDelFwRule++;requested execution level on Vista / 7RequestExecutionLevel admin@@ -87,6 +95,7 @@ ComponentText "YaCy v@REPL_VERSION@ (Build @REPL_DATE@)"!insertmacro MUI_PAGE_INSTFILES+!define MUI_PAGE_CUSTOMFUNCTION_SHOW SHOW_PageFinish_custom!define MUI_FINISHPAGE_SHOWREADME http://www.yacy-websuche.de/wiki/index.php/InstallerFinished!define MUI_FINISHPAGE_SHOWREADME_TEXT $(finishPage)!insertmacro MUI_PAGE_FINISH@@ -176,6 +185,12 @@ Section "Desktop Icon"CreateShortCut "$DESKTOP\YaCy.lnk" "$INSTDIR\startYACY.bat" "" "$INSTDIR\addon\YaCy.ico" "" SW_SHOWMINIMIZEDSectionEnd+Section "Open Firewall (Port 8090)" Sec_Firewall_id+ SectionIn 1+ SetShellVarContext current+ call OpenFirewall+SectionEnd+/*Section "YaCy in Startup"SetShellVarContext current@@ -190,8 +205,9 @@ Section "Uninstall"IfFileExists "$INSTDIR\DATA\yacy.running" 0 uninstallMessageBox MB_ICONSTOP "$(stillRunning)" /SD IDOKGoto nouninstall-+uninstall:+ Call un.CloseFirewallSetShellVarContext currentRMDir /r "$INSTDIR\addon"@@ -231,6 +247,8 @@ Function .onInitMessageBox MB_ICONSTOP "$(yacyNeedOs)"Abort${EndIf}++ ; init of JRE section; detect JRE firstvar /global InstalledJREVersion${If} ${RunningX64}@@ -242,21 +260,50 @@ Function .onInitSectionSetText ${Sec_Java_id} ""SectionSetFlags ${Sec_Java_id} 0${EndIf}++ ; init of Firewall section, only valid for WindowsXP SP2/SP3 and Vista/Win 7 with Admin+ var /global FirewallServiceStart+ IntOp $FirewallServiceStart 3 + 0++ ${If} ${IsWinVista}+ ${OrIf} ${IsWin7}+ StrCpy $WinAddFwRule '${WinVistaAddFwRule}'+ StrCpy $WinDelFwRule '${WinVistaDelFwRule}'+ ReadRegDWORD $FirewallServiceStart HKLM "SYSTEM\CurrentControlSet\services\MpsSvc" "Start"+ ${EndIf}++ ${If} ${IsWinXP}+ ${AndIf} ${AtLeastServicePack} 2+ StrCpy $WinAddFwRule '${WinXPAddFwRule}'+ StrCpy $WinDelFwRule '${WinXPDelFwRule}'+ ReadRegDWORD $FirewallServiceStart HKLM "SYSTEM\CurrentControlSet\services\SharedAccess" "Start"+ ${EndIf}++ ;need Admin for firewall-config+ ${IfNot} $0 = "Admin"+ IntOp $FirewallServiceStart 3 + 0+ ${EndIf}++ ; hide and deselect Firewall if no proper configuration+ ${If} $FirewallServiceStart > 2+ SectionSetText ${Sec_Firewall_id} ""+ SectionSetFlags ${Sec_Firewall_id} 0+ ${EndIf}FunctionEndFunction GetJRE; based on http://nsis.sourceforge.net/Simple_Java_Runtime_Download_Script${If} ${RunningX64}- StrCpy $3 ${JRE_64}+ StrCpy $3 ${JRE_64}${Else}StrCpy $3 ${JRE_32}${EndIf}-;check if admin before download, advise if non+ ;check if admin before download, advise if nonuserInfo::getAccountTypePop $0- ${If} $0 != "Admin"+ ${IfNot} $0 = "Admin"MessageBox MB_ICONEXCLAMATION "$(noAdminForJava)" /SD IDOK${EndIf}@@ -266,7 +313,7 @@ Function GetJREnsisdl::download /TIMEOUT=30000 $3 $2Pop $R0 ;Get the return value- ${If} $R0 != "success"+ ${IfNot} $R0 = "success"MessageBox MB_OK "Download failed: $R0" /SD IDOKReturn${EndIf}@@ -284,31 +331,31 @@ Function CheckDriveSpacevar /global TempDriveFreevar /global RootFolderType-; If "\\Folder" it's a Network-Folder+ ; if "\\Folder" it's a Network-FolderStrCpy $RootFolder $InstDir 2StrCmp $RootFolder "\\" NetworkFolder DriveletterNetworkfolder:-; prepare String for DriveSpace+ ; prepare String for DriveSpace${GetRoot} $RootFolder $InstDirgoto NoHDD-; Now check drive-letters+ ; now check drive-lettersDriveletter:StrCpy $RootFolder $InstDir 3-; prepare for {GetDrives-Loop}+ ; prepare for {GetDrives-Loop}StrCpy $RootFolderType "invalid"${GetDrives} "ALL" "CheckDriveType"-; jump if error+ ; jump if errorStrCmp $RootFolderType "invalid" CheckSpace-; jump if HDD+ ; jump if HDDStrCmp $RootFolderType "HDD" CheckSpaceNoHDD:-; Stay on folder-selection if user wants to give another folder, else check free space+ ; stay on folder-selection if user wants to give another folder, else check free spaceMessageBox MB_ICONEXCLAMATION|MB_YESNO "$(yacyNoHd)" IDYES NextPageAbort@@ -316,7 +363,7 @@ Function CheckDriveSpaceClearErrors${DriveSpace} $RootFolder "/D=F /S=G" $TempDriveFree-; If DriveSpace fails for any reason -> jump ahead+ ; if DriveSpace fails for any reason -> jump aheadIfErrors NextPage${If} $TempDriveFree < ${RecommendSpace}@@ -335,3 +382,34 @@ Function CheckDriveType${EndIf}Push $0FunctionEnd++Function OpenFirewall+ var /global ExecErrorCode+ ; run netsh+ nsExec::ExecToStack '$WinAddFwRule'+ pop $ExecErrorCode+ ; if run without error register for uninstall and clear finish page+ ${If} $ExecErrorCode = "0"+ WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\YaCy" "DelFwRule" '$WinDelFwRule'+ IntOp $FirewallServiceStart 0 + 0+ ${Else}+ IntOp $FirewallServiceStart 3 + 0+ ${EndIf}+FunctionEnd++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}+ ${EndIf}+FunctionEnd++Function un.CloseFirewall+ ; get string for closing port from registy+ ReadRegStr '$WinDelFwRule' HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\YaCy" "DelFwRule"+ ; if found > run netsh to close port+ ${IfNot} '$WinDelFwRule' == ''+ nsExec::ExecToStack '$WinDelFwRule'+ ${EndIf}+FunctionEnd