[otrs-cvs] otrs4win InstallerBuildGuide.txt, 1.30, 1.31 CHANGES-otrs4win, 1.6, 1.7 OTRS.nsi, 1.50, 1.51

"CVS commits notifications of OTRS.org" <[email protected]>
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/otrs4win
In directory lancelot:/tmp/cvs-serv18579

Modified Files:
	InstallerBuildGuide.txt CHANGES-otrs4win OTRS.nsi 
Log Message:
Added ng OTRS installer script.

Author: mb

Index: InstallerBuildGuide.txt
===================================================================
RCS file: /home/cvs/otrs4win/InstallerBuildGuide.txt,v
retrieving revision 1.30
retrieving revision 1.31
diff -2 -u -d -r1.30 -r1.31
--- InstallerBuildGuide.txt	21 Jan 2013 16:40:40 -0000	1.30
+++ InstallerBuildGuide.txt	21 Feb 2013 10:13:21 -0000	1.31
@@ -106,4 +106,7 @@
         http://strawberryperl.com/package/kmx/mod_perl/5.12_x86/libapreq2.dll
 
+    6. Download mod_auth_sspi, extract it and put it in C:\otrs4win\Apache\Modules
+        - this is an optional module people can configure for easy SSO on Windows
+
 Prepare MySQL
 =============

Author: mb

Index: CHANGES-otrs4win
===================================================================
RCS file: /home/cvs/otrs4win/CHANGES-otrs4win,v
retrieving revision 1.6
retrieving revision 1.7
diff -2 -u -d -r1.6 -r1.7
--- CHANGES-otrs4win	23 May 2011 14:43:43 -0000	1.6
+++ CHANGES-otrs4win	21 Feb 2013 10:13:21 -0000	1.7
@@ -1,5 +1,5 @@
 # --
 # CHANGES - change log of the Windows Installer
-# Copyright (C) 2001-2011 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
 # --
 # $Id$
@@ -10,4 +10,8 @@
 # --
 
+3.0.0 2013-02-08
+ - New upgradable installer
+ - Support for configuring Internet Information Server and ActiveState Perl
+
 2.4.4 2011-05-23
 - Added support for OTRS Scheduler service (if bundled with 3.1).

Author: mb

Index: OTRS.nsi
===================================================================
RCS file: /home/cvs/otrs4win/OTRS.nsi,v
retrieving revision 1.50
retrieving revision 1.51
diff -2 -u -d -r1.50 -r1.51
--- OTRS.nsi	18 Dec 2012 11:57:09 -0000	1.50
+++ OTRS.nsi	21 Feb 2013 10:13:21 -0000	1.51
@@ -1,5 +1,5 @@
 # --
 # OTRS.nsi - a script to generate the otrs4win installer
-# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
 # --
 # $Id$
@@ -25,22 +25,22 @@
 # ------------------------------------------------------------ #
 
-!define Installer_Home            "c:\otrs34win"
+!define Installer_Home            "D:\otrs4winNG"
 !define Installer_Home_Nsis       "${Installer_Home}\otrs4win"
-!define Installer_Version_Major   2
-!define Installer_Version_Minor   4
-!define Installer_Version_Patch   4
-#!define Installer_Version_Jointer "-"
-#!define Installer_Version_Postfix "beta2"
-!define Installer_Version_Jointer ""
-!define Installer_Version_Postfix ""
+!define Installer_Version_Major   3
+!define Installer_Version_Minor   0
+!define Installer_Version_Patch   0
+!define Installer_Version_Jointer "-"
+!define Installer_Version_Postfix "beta2"
+#!define Installer_Version_Jointer ""
+#!define Installer_Version_Postfix ""
 
 !define OTRS_Name            "OTRS"
 !define OTRS_Version_Major   3
-!define OTRS_Version_Minor   1
-!define OTRS_Version_Patch   0
-!define OTRS_Version_Jointer "."
-!define OTRS_Version_Postfix "beta2"
-#!define OTRS_Version_Jointer ""
-#!define OTRS_Version_Postfix ""
+!define OTRS_Version_Minor   2
+!define OTRS_Version_Patch   2
+#!define OTRS_Version_Jointer "."
+#!define OTRS_Version_Postfix "rc1"
+!define OTRS_Version_Jointer ""
+!define OTRS_Version_Postfix ""
 !define OTRS_Company         "OTRS Group"
 !define OTRS_Url             "www.otrs.com"
@@ -55,4 +55,20 @@
 !define Win_RegKey_Uninstall "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${OTRS_Name}"
 
+var ActiveStatePerl
+var PerlEx
+var PerlMajor
+var PerlMinor
+var PerlExe
+var MySQLInstalled
+var MyDirectory
+var Installed_OTRS_Major
+var Installed_OTRS_Minor
+var Installed_OTRS_Patch
+var Installed_OTRS_Postfix
+var Installed_OTRS_Version
+var InstallDirShort
+var InstallMode
+var Upgrade
+
 # ------------------------------------------------------------ #
 # define installer information
@@ -74,6 +90,4 @@
 InstallDir $PROGRAMFILES32\${OTRS_Name}
 InstallDirRegKey HKLM "${OTRS_RegKey_Instance}" Path
-var InstallDirShort
-var InstallMode
 
 # ------------------------------------------------------------ #
@@ -110,11 +124,13 @@
 # ------------------------------------------------------------ #
 
-!include MultiUser.nsh
-!include Sections.nsh
-!include MUI2.nsh
+!include EnvVarUpdate.nsh
 !include FileFunc.nsh
 !include LogicLib.nsh
-!include EnvVarUpdate.nsh
+!include MUI2.nsh
+!include MultiUser.nsh
 !include Ports.nsh
+!include Sections.nsh
+!include WordFunc.nsh
+!include x64.nsh
 
 !insertmacro "DirState"
@@ -132,18 +148,7 @@
 !insertmacro MUI_PAGE_LICENSE "${Installer_Home_Nsis}\Licenses\GNU_Affero_License.rtf"
 
-# license page (GPL v2)
-!define MUI_LICENSEPAGE_RADIOBUTTONS
-!insertmacro MUI_PAGE_LICENSE "${Installer_Home_Nsis}\Licenses\GNU_License_v2.rtf"
-
-# license page (GPL v1 for dmake)
-!define MUI_LICENSEPAGE_RADIOBUTTONS
-!insertmacro MUI_PAGE_LICENSE "${Installer_Home_Nsis}\Licenses\GNU_License_v1.rtf"
-
-# license page (Apache v2)
-!define MUI_LICENSEPAGE_RADIOBUTTONS
-!insertmacro MUI_PAGE_LICENSE "${Installer_Home_Nsis}\Licenses\Apache_License_v2.rtf"
-
 # directory page
 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE InstInstallationDirValidate
+!define MUI_PAGE_CUSTOMFUNCTION_PRE DirectoryHide
 !insertmacro MUI_PAGE_DIRECTORY
 
@@ -158,10 +163,10 @@
 
 # install page
-ShowInstDetails NeverShow
+ShowInstDetails Hide
 !insertmacro MUI_PAGE_INSTFILES
 
 # finish page
 !define MUI_FINISHPAGE_RUN
-!define MUI_FINISHPAGE_RUN_FUNCTION  InstStartWebInstaller
+!define MUI_FINISHPAGE_RUN_FUNCTION  InstStartWeb
 !define MUI_FINISHPAGE_RUN_TEXT      $(mui_finishpage_run_text)
 !define MUI_FINISHPAGE_LINK          "powered by ${OTRS_Company}"
@@ -193,38 +198,8 @@
 # ------------------------------------------------------------ #
 
-# installer languages
-!insertmacro MUI_LANGUAGE English
-!insertmacro MUI_LANGUAGE German
-!insertmacro MUI_LANGUAGE Spanish
-!insertmacro MUI_LANGUAGE French
-!insertmacro MUI_LANGUAGE Greek
-!insertmacro MUI_LANGUAGE Italian
-!insertmacro MUI_LANGUAGE Russian
-!insertmacro MUI_LANGUAGE Dutch
-
 # english strings
+!insertmacro MUI_LANGUAGE English
 LangString mui_finishpage_run_text ${LANG_ENGLISH} "Continue with Web Installer"
 
-# german strings
-LangString mui_finishpage_run_text ${LANG_GERMAN} "Weiter mit Web-Installer"
-
-# spanish strings
-LangString mui_finishpage_run_text ${LANG_SPANISH} "Continue with Web Installer"
-
-# french strings
-LangString mui_finishpage_run_text ${LANG_FRENCH} "Continue with Web Installer"
-
-# greek strings
-LangString mui_finishpage_run_text ${LANG_GREEK} "Continue with Web Installer"
-
-# italian strings
-LangString mui_finishpage_run_text ${LANG_ITALIAN} "Continue with Web Installer"
-
-# russian strings
-LangString mui_finishpage_run_text ${LANG_RUSSIAN} "Continue with Web Installer"
-
-# dutch strings
-LangString mui_finishpage_run_text ${LANG_DUTCH} "Verder met de Web Installer"
-
 # ------------------------------------------------------------ #
 # install sections
@@ -237,6 +212,4 @@
     SetOutPath $INSTDIR\otrs4win
     File /r "${Installer_Home_Nsis}\Graphics\Icons\OTRS.ico"
-    File /r "${Installer_Home_Nsis}\Graphics\Icons\OTRS.ico"
-    File /r "${Installer_Home_Nsis}\Graphics\Icons\OTRS.ico"
     File /r "${Installer_Home_Nsis}\Graphics\Icons\OTRSServices.ico"
 
@@ -248,21 +221,52 @@
     RmDir /r /REBOOTOK $INSTDIR\otrs4win\Scripts\CVS
 
-SectionEnd
-
-# install StrawberryPerl section
-Section -InstStrawberryPerl
-
-    # install StrawberryPerl files
-    SetOutPath $INSTDIR
-    File /r "${Installer_Home}\StrawberryPerl"
+    ${If} $Upgrade != 'no'
+        DetailPrint "Stopping services"
+        nsExec::Exec "$\"$PerlExe$\" $\"$INSTDIR\OTRS\bin\otrs.Scheduler4win.pl$\" -a stop"
+        nsExec::Exec "NET STOP $\"Cron Service (CRONw)$\""
+        nsExec::Exec "NET STOP Apache2.2"
+        nsExec::Exec "NET STOP MySQL"
+    ${EndIf}
 
-    # configure StrawberryPerl
-    GetFullPathName /SHORT $InstallDirShort $INSTDIR
-    ExecWait "$\"$INSTDIR\StrawberryPerl\perl\bin\perl.exe$\" $\"$INSTDIR\otrs4win\Scripts\ConfigureStrawberryPerl.pl$\" -d $\"$InstallDirShort$\""
+SectionEnd
 
-    # remove the helper script
-    ${If} $InstallMode != "Unittest"
-        sleep 1000  # sleep one second to give the OS time to unlock the file
-        Delete /REBOOTOK "$INSTDIR\otrs4win\Scripts\ConfigureStrawberryPerl.pl"
+Section -InstPerl
+    ${If} ${FileExists} "$ActiveStatePerl"
+        # For ActiveState perl, we prefer to install any modules
+        # via PPM. We'll also install MinGW so we can install 
+        # whatever else via cpan.
+        ExpandEnvStrings $0 %COMSPEC%
+        DetailPrint "Configuring ActiveState Perl. Warning: this can take a very long time..."
+        NSExec::ExecToLog '"$0" /C "ppm install DBD::mysql"'
+        NSExec::ExecToLog '"$0" /C "ppm install DBD::Pg"'
+        NSExec::ExecToLog '"$0" /C "ppm install Crypt::SSLeay"'
+        NSExec::ExecToLog '"$0" /C "ppm install Date::Format"'
+        NSExec::ExecToLog '"$0" /C "ppm install Date::Manip"'
+        NSExec::ExecToLog '"$0" /C "ppm install JSON::XS"'
+        NSExec::ExecToLog '"$0" /C "ppm install Log::Dispatch"'
+        NSExec::ExecToLog '"$0" /C "ppm install Log::Dispatch::FileRotate"'
+        NSExec::ExecToLog '"$0" /C "ppm install Log::Log4perl"'
+        NSExec::ExecToLog '"$0" /C "ppm install Mail::IMAPClient"'
+        NSExec::ExecToLog '"$0" /C "ppm install Net::DNS"'
+        NSExec::ExecToLog '"$0" /C "ppm install Net::LDAP"'
+        NSExec::ExecToLog '"$0" /C "ppm install PDF::API2"'
+        NSExec::ExecToLog '"$0" /C "ppm install Win32::Console::ANSI"'        
+        NSExec::ExecToLog '"$0" /C "ppm install Win32::Daemon"'        
+        NSExec::ExecToLog '"$0" /C "ppm install MinGW"'
+        NSExec::ExecToLog '"$0" /C "cpan Encode::HanExtra"'
+        
+        # set perlexe
+        StrCpy $PerlExe $ActiveStatePerl
+        DetailPrint "ActivePerl configured."
+    ${Else}    
+        # StrawberryPerl is pre-configured with all modules we need
+        # we only need to copy the files
+        DetailPrint "Installing Strawberry Perl"
+        SetOutPath $INSTDIR
+        File /r "${Installer_Home}\StrawberryPerl"
+        
+        # set perlexe
+        StrCpy $PerlExe "$INSTDIR\StrawberryPerl\perl\bin\perl.exe"
+        DetailPrint "StrawberryPerl installed."        
     ${EndIf}
 
@@ -278,8 +282,8 @@
     # configure CRONw
     GetFullPathName /SHORT $InstallDirShort $INSTDIR
-    ExecWait "$\"$INSTDIR\StrawberryPerl\perl\bin\perl.exe$\" $\"$INSTDIR\otrs4win\Scripts\ConfigureCRONw.pl$\" -d $\"$InstallDirShort$\""
+    NSExec::ExecToLog "$\"$PerlExe$\" $\"$INSTDIR\OTRS\bin\otrs.Cron4Win32.pl$\" $\"$InstallDirShort\CRONw\crontab.txt$\""
 
     # register CRONw as service
-    ExecWait "$\"$INSTDIR\StrawberryPerl\perl\bin\perl.exe$\" $\"$INSTDIR\CRONw\cronHelper.pl$\" --install"
+    NSExec::ExecToLog "$\"$PerlExe$\" $\"$INSTDIR\CRONw\cronHelper.pl$\" --install"
 
     # remove the helper script
@@ -294,19 +298,21 @@
 Section /o -InstMySQL InstMySQL
 
-    # install MySQL files
-    SetOutPath $INSTDIR
-    File /r "${Installer_Home}\MySQL"
+    ${If} $MySQLInstalled <> 1
 
-    # configure the mysql server
-    GetFullPathName /SHORT $InstallDirShort $INSTDIR
-    ExecWait "$\"$INSTDIR\StrawberryPerl\perl\bin\perl.exe$\" $\"$INSTDIR\otrs4win\Scripts\ConfigureMySQL.pl$\" -d $\"$InstallDirShort$\""
+        # install MySQL files
+        SetOutPath $INSTDIR
+        File /r "${Installer_Home}\MySQL"
 
-    # register mysql as service
-    ExecWait '"$INSTDIR\MySQL\bin\mysqld.exe" --install MySQL --defaults-file="$INSTDIR\MySQL\my.ini"'
+        # configure the mysql server
+        GetFullPathName /SHORT $InstallDirShort $INSTDIR
+        NSExec::ExecToLog "$\"$PerlExe$\" $\"$INSTDIR\otrs4win\Scripts\ConfigureMySQL.pl$\" -d $\"$InstallDirShort$\""
 
-    # remove the helper script
-    ${If} $InstallMode != "Unittest"
+        # register mysql as service
+        NSExec::ExecToLog '"$INSTDIR\MySQL\bin\mysqld.exe" --install MySQL --defaults-file="$INSTDIR\MySQL\my.ini"'
+
+        # remove the helper script
         sleep 1000  # sleep one second to give the OS time to unlock the file
         Delete /REBOOTOK "$INSTDIR\otrs4win\Scripts\ConfigureMySQL.pl"
+
     ${EndIf}
 
@@ -316,24 +322,50 @@
 Section /o -InstApache InstApache
 
-    # install Apache files
-    SetOutPath $INSTDIR
-    File /r "${Installer_Home}\Apache"
+   ${If} ${FileExists} "$INSTDIR\StrawberryPerl\perl\bin\perl.exe"
 
-    # configure apache
-    GetFullPathName /SHORT $InstallDirShort $INSTDIR
-    ExecWait "$\"$INSTDIR\StrawberryPerl\perl\bin\perl.exe$\" $\"$INSTDIR\otrs4win\Scripts\ConfigureApache.pl$\" -d $\"$InstallDirShort$\""
+        DetailPrint "Installing/upgrading Apache" 
+        nsExec::Exec "NET STOP Apache2.2"    
+        # install Apache files
+        SetOutPath $INSTDIR
+        File /r "${Installer_Home}\Apache"
 
-    # register apache as service
-    ExecWait '"$INSTDIR\Apache\bin\httpd.exe" -k install'
+       # configure apache
+       GetFullPathName /SHORT $InstallDirShort $INSTDIR
+       NSExec::ExecToLog "$\"$PerlExe$\" $\"$INSTDIR\otrs4win\Scripts\ConfigureApache.pl$\" -d $\"$InstallDirShort$\""
 
-    # add the apache service to the firewall exection list
-    SimpleFC::AddApplication "Apache HTTP Server" "$INSTDIR\Apache\bin\httpd.exe" 0 2 "" 1
-    Pop $0
+       # register apache as service
+       NSExec::ExecToLog '"$INSTDIR\Apache\bin\httpd.exe" -k install'
 
-    # remove the helper script
-    ${If} $InstallMode != "Unittest"
-        sleep 1000  # sleep one second to give the OS time to unlock the file
-        Delete /REBOOTOK "$INSTDIR\otrs4win\Scripts\ConfigureApache.pl"
-    ${EndIf}
+       # add the apache service to the firewall exeption list
+       SimpleFC::AddApplication "Apache HTTP Server" "$INSTDIR\Apache\bin\httpd.exe" 0 2 "" 1
+       Pop $0
+
+       # remove the helper script
+       ${If} $InstallMode != "Unittest"
+           sleep 1000  # sleep one second to give the OS time to unlock the file
+           Delete /REBOOTOK "$INSTDIR\otrs4win\Scripts\ConfigureApache.pl"
+       ${EndIf}
+   ${Else}
+       DetailPrint "Configuring Microsoft IIS"
+       
+       # locate PerlEx dll based on perl.exe
+       ${WordReplace} $ActiveStatePerl 'perl.exe' 'PerlEx30.dll' "-1" $PerlEx
+       ExpandEnvStrings $0 %COMSPEC%
+       
+       # first make sure Microsoft IIS is installed
+       ${DisableX64FSRedirection}
+       NSExec::ExecToLog '"$0" /c $WINDIR\system32\dism.exe /online /norestart /enable-feature /ignorecheck /featurename:$\"IIS-WebServerRole$\" /featurename:$\"IIS-ManagementConsole$\" /featurename:$\"IIS-ISAPIExtensions$\" /featurename:$\"IIS-ISAPIFilter$\"' 
+       ${EnableX64FSRedirection}
+
+       # now configure a web site, and setup perlex with its own application pool    
+       NSExec::ExecToLog '"$0\system32\inetsrv\appcmd.exe" add apppool /name:$\"OTRS$\"'
+       NSExec::ExecToLog '"$0\system32\inetsrv\appcmd.exe" set config /section:applicationPools -[name=$\'OTRS$\'].managedPipelineMode:Integrated'
+       NSExec::ExecToLog '"$0\system32\inetsrv\appcmd.exe" set config /section:applicationPools -[name=$\'OTRS$\'].enable32BitAppOnWin64:$\"True$\" /commit:apphost'
+       NSExec::ExecToLog '"$0\system32\inetsrv\appcmd.exe" set config /section:handlers /+[name=$\'PerlEx$\',path=$\'*.pl$\',verb=$\'*$\',modules=$\'IsapiModule$\',scriptProcessor=$\'c:\Perl\bin\PerlEx30.dll$\']'
+       NSExec::ExecToLog '"$0\system32\inetsrv\appcmd.exe" set config /section:system.webServer/security/isapiCgiRestriction /+[path=$\'$PerlEx$\',allowed=$\'True$\'] /commit:apphost'
+       NSExec::ExecToLog '"$0\system32\inetsrv\appcmd.exe" add vdir /app.name:$\"Default Web Site/$\" /path:/otrs-web /physicalPath:$INSTDIR\OTRS\var\httpd\htdocs'
+       NSExec::ExecToLog '"$0\system32\inetsrv\appcmd.exe" add app /site.name:$\"Default Web Site$\" /path:/otrs /physicalPath:$INSTDIR\OTRS\bin\cgi-bin -applicationPool:OTRS'
+       
+   ${EndIf}
 
 SectionEnd
@@ -344,13 +376,19 @@
     # install OTRS files
     SetOutPath $INSTDIR
+    IfFileExists $INSTDIR\OTRS\ARCHIVE 0 +2
+       CopyFiles $INSTDIR\OTRS\ARCHIVE $INSTDIR\OTRS\ARCHIVE_OLD
+        
     File /r "${Installer_Home}\OTRS"
 
+    ${If} $Upgrade == "no"
+
     # configure OTRS
-    GetFullPathName /SHORT $InstallDirShort $INSTDIR
-    ExecWait "$\"$INSTDIR\StrawberryPerl\perl\bin\perl.exe$\" $\"$INSTDIR\otrs4win\Scripts\ConfigureOTRS.pl$\" -d $\"$InstallDirShort$\""
+        GetFullPathName /SHORT $InstallDirShort $INSTDIR
+        NSExec::ExecToLog "$\"$PerlExe$\" $\"$INSTDIR\otrs4win\Scripts\ConfigureOTRS.pl$\" -d $\"$InstallDirShort$\""
 
-    # register Scheduler service (just for 3.1 and later)
-    IfFileExists $INSTDIR\OTRS\bin\otrs.Scheduler4winInstaller.pl 0 +2
-        ExecWait "$\"$INSTDIR\StrawberryPerl\perl\bin\perl.exe$\" $\"$INSTDIR\OTRS\bin\otrs.Scheduler4winInstaller.pl$\" -a install"
+        # register Scheduler service (just for 3.1 and later)
+        IfFileExists $INSTDIR\OTRS\bin\otrs.Scheduler4winInstaller.pl 0 +2
+            NSExec::ExecToLog "$\"$PerlExe$\" $\"$INSTDIR\OTRS\bin\otrs.Scheduler4winInstaller.pl$\" -a install"
+    ${EndIf}
         
     # add common otrs information
@@ -384,8 +422,11 @@
 Section -InstPost
 
-    # add paths
-    ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\StrawberryPerl\site\bin"
-    ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\StrawberryPerl\perl\bin"
-    ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\StrawberryPerl\c\bin"
+    ${If} ${FileExists} "$INSTDIR\StrawberryPerl\perl\bin\perl.exe"
+        GetFullPathName /SHORT $InstallDirShort $INSTDIR
+        # add paths
+        ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$InstallDirShort\StrawberryPerl\site\bin"
+        ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$InstallDirShort\StrawberryPerl\perl\bin"
+        ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$InstallDirShort\StrawberryPerl\c\bin"
+    ${EndIf}
 
     # add common instance information
@@ -411,21 +452,12 @@
     WriteRegDWORD HKLM "${Win_RegKey_Uninstall}" NoRepair        1
 
-    # create start menu entry for the uninstaller
-    !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
-    SetOutPath $SMPROGRAMS\$StartMenuGroup\Tools
-    CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Tools\Uninstall ${OTRS_Name}.lnk"        "$INSTDIR\uninstall.exe"
-    CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Tools\${OTRS_Name} Services Start.lnk"   "$INSTDIR\otrs4win\Scripts\OTRSServicesStart.bat"   "" "$INSTDIR\otrs4win\OTRSServices.ico"
-    CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Tools\${OTRS_Name} Services Stop.lnk"    "$INSTDIR\otrs4win\Scripts\OTRSServicesStop.bat"    "" "$INSTDIR\otrs4win\OTRSServices.ico"
-    CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Tools\${OTRS_Name} Services Restart.lnk" "$INSTDIR\otrs4win\Scripts\OTRSServicesRestart.bat" "" "$INSTDIR\otrs4win\OTRSServices.ico"
-    ShellLink::SetRunAsAdministrator "$SMPROGRAMS\$StartMenuGroup\Tools\Uninstall ${OTRS_Name}.lnk"
-    ShellLink::SetRunAsAdministrator "$SMPROGRAMS\$StartMenuGroup\Tools\${OTRS_Name} Services Start.lnk"
-    ShellLink::SetRunAsAdministrator "$SMPROGRAMS\$StartMenuGroup\Tools\${OTRS_Name} Services Stop.lnk" 
-    ShellLink::SetRunAsAdministrator "$SMPROGRAMS\$StartMenuGroup\Tools\${OTRS_Name} Services Restart.lnk" 
-    !insertmacro MUI_STARTMENU_WRITE_END
-
     # start the otrs services
     sleep 2000
-    ExecWait "$INSTDIR\otrs4win\Scripts\OTRSServicesStart.bat"
-
+    DetailPrint "Starting services"
+    nsExec::Exec "NET START MySQL"
+    nsExec::Exec "NET START $\"Cron Service (CRONw)$\""
+    nsExec::Exec "$\"$PerlExe$\" $\"$INSTDIR\OTRS\bin\otrs.Scheduler4win.pl$\" -a start"
+    nsExec::Exec "NET START Apache2.2"
+    
     # refresh the windows desktop (required for Vista's desktop)
     System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'
@@ -441,5 +473,10 @@
 
     # stop the otrs services
-    ExecWait "$INSTDIR\otrs4win\Scripts\OTRSServicesStop.bat"
+    DetailPrint "Stopping services"
+    nsExec::Exec "$\"$PerlExe$\" $\"$INSTDIR\OTRS\bin\otrs.Scheduler4win.pl$\" -a stop"
+    nsExec::Exec "NET STOP $\"Cron Service (CRONw)$\""
+    nsExec::Exec "NET STOP Apache2.2"
+    nsExec::Exec "NET STOP MySQL"
+
     sleep 2000
 
@@ -461,11 +498,12 @@
     
     # remove items from Path
-    ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\StrawberryPerl\site\bin"
-    ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\StrawberryPerl\perl\bin"
-    ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\StrawberryPerl\c\bin"
+    GetFullPathName /SHORT $InstallDirShort $INSTDIR
+    ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$InstallDirShort\StrawberryPerl\site\bin"
+    ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$InstallDirShort\StrawberryPerl\perl\bin"
+    ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$InstallDirShort\StrawberryPerl\c\bin"
 
     # deregister Scheduler service (just for 3.1 and later)
     IfFileExists $INSTDIR\OTRS\bin\otrs.Scheduler4winInstaller.pl 0 +2
-        ExecWait "$\"$INSTDIR\StrawberryPerl\perl\bin\perl.exe$\" $\"$INSTDIR\OTRS\bin\otrs.Scheduler4winInstaller.pl$\" -a remove"
+        NSExec::ExecToLog "$\"$PerlExe$\" $\"$INSTDIR\OTRS\bin\otrs.Scheduler4winInstaller.pl$\" -a remove"
     
     # delete the OTRS files
@@ -478,5 +516,5 @@
 
     # register CRONw as service
-    ExecWait "$\"$INSTDIR\StrawberryPerl\perl\bin\perl.exe$\" $\"$INSTDIR\CRONw\cronHelper.pl$\" --remove"
+    NSExec::ExecToLog "$\"$PerlExe$\" $\"$INSTDIR\CRONw\cronHelper.pl$\" --remove"
 
     # delete the CRONw files
@@ -489,7 +527,7 @@
 
     # deregister apache as service
-    ExecWait '"$INSTDIR\Apache\bin\httpd.exe" -k uninstall'
+    NSExec::ExecToLog '"$INSTDIR\Apache\bin\httpd.exe" -k uninstall'
 
-    # remove the apache service from the firewall exection list
+    # remove the apache service from the firewall exeption list
     SimpleFC::RemoveApplication "$INSTDIR\Apache\bin\httpd.exe"
     Pop $0
@@ -504,5 +542,5 @@
 
     # deregister mysql as service
-    ExecWait '"$INSTDIR\MySQL\bin\mysqld"  --remove MySQL'
+    NSExec::ExecToLog '"$INSTDIR\MySQL\bin\mysqld"  --remove MySQL'
 
     # delete the MySQL files
@@ -561,9 +599,9 @@
     Call InstCheckAlreadyRunning
     Call InstCheckAlreadyInstalled
+    Call InstCheckActiveStatePerl
     Call InstCheckMySQLAlreadyInstalled
     Call InstCheckWebServerAlreadyInstalled
 
     # insert plugins
-    !insertmacro MUI_LANGDLL_DISPLAY
     !insertmacro MULTIUSER_INIT
 
@@ -598,19 +636,117 @@
 
     ReadRegStr $R0 HKLM "${Win_RegKey_Uninstall}" "UninstallString"
-    IfFileExists $R0 +1 NotInstalled
-    MessageBox MB_OK|MB_ICONSTOP "${OTRS_Name} is already installed."
-    Abort
 
-    NotInstalled:
+    # if OTRS is already installed, make sure this is a newer version
+    ${If} ${FileExists} $R0
+
+        # read version from history
+        ReadRegStr $Installed_OTRS_Major   HKLM "${OTRS_RegKey_Instance}" OTRS_Version_Major   
+        ReadRegStr $Installed_OTRS_Minor   HKLM "${OTRS_RegKey_Instance}" OTRS_Version_Minor   
+        ReadRegStr $Installed_OTRS_Patch   HKLM "${OTRS_RegKey_Instance}" OTRS_Version_Patch   
+        ReadRegStr $Installed_OTRS_Postfix HKLM "${OTRS_RegKey_Instance}" OTRS_Version_Postfix
+
+        # combine to one string
+        StrCpy $Installed_OTRS_Version "$Installed_OTRS_Major.$Installed_OTRS_Minor.$Installed_OTRS_Patch.$Installed_OTRS_Postfix"
+
+        # convert to numbers so 'beta' and 'rc' will be no problem    
+        ${VersionConvert} $Installed_OTRS_Version "" $R0
+        ${VersionConvert} ${OTRS_Version} "" $R1    
+
+        # comparison: 0 = equal, 1 = installed is newer, 2 = we are newer
+        ${VersionCompare} $R0 $R1 $R0
+
+        ${If} $R0 = 0
+                MessageBox MB_OK|MB_ICONSTOP "You have already installed OTRS $Installed_OTRS_Version."
+                Abort
+        ${EndIf}        
+
+        ${If} $R0 = 1
+                MessageBox MB_OK|MB_ICONSTOP "You have installed $Installed_OTRS_Version, which is newer than ${OTRS_Version}."
+                Abort
+        ${EndIf}        
+
+        ${If} $R0 = 1
+            # we can only do patch level upgrades or upgrades that differ one minor
+            ${If} $Installed_OTRS_Major < ${OTRS_Version_Major}
+                MessageBox MB_OK|MB_ICONSTOP "You have installed $Installed_OTRS_Version. Please don't skip minor levels when upgrading."
+                Abort
+            ${Else}
+                # same major level
+                ${If} $Installed_OTRS_Minor == 0
+                   MessageBox MB_OK|MB_ICONSTOP "You have installed $Installed_OTRS_Version. Please don't skip minor levels when upgrading."
+                   Abort
+                ${EndIf}
+                ${If} $Installed_OTRS_Minor == 1
+                    StrCpy $Upgrade "minor" 
+                ${EndIf}
+                ${If} $Installed_OTRS_Minor == ${OTRS_Version_Minor}
+                    StrCpy $Upgrade "patch" 
+                ${EndIf}                
+            ${EndIf}        
+        ${EndIf}        
+    ${Else}
+        StrCpy $Upgrade "no"
+    ${EndIf}
 
 FunctionEnd
 
-# to check if MySQL is already installed - fatal
+Function InstCheckActiveStatePerl
+
+    # check if 64-bit Perl is installed, we need 32-bit because of PerlEx
+    # we need to use SetRegView64 on 64-bit OS otherwise we can not find
+    # the correct regkey because the installer is a 32-bit 
+    # application itself
+    ${If} ${FileExists} $WINDIR\SYSWOW64\*.*
+        SetRegView 64
+        ReadRegStr $ActiveStatePerl HKLM Software\Perl BinDir
+        SetRegView 32
+        ${If} ${FileExists} "$ActiveStatePerl"
+                MessageBox MB_OK|MB_ICONSTOP "You have installed ActiveState Perl 64-bit. Please uninstall the 64-bit version and install the x86 version before continuing setup."
+                ExecShell "open" "http://www.activestate.com/activeperl/downloads"            
+                Abort
+        ${EndIf}
+    ${EndIf}
+    
+    # check if ActiveState is installed 
+    ReadRegStr $ActiveStatePerl HKLM Software\Perl BinDir
+        
+    # if we have ActiveState, test its properties
+    ${If} ${FileExists} "$ActiveStatePerl"
+        
+        # check if ActiveState Perl is correct version
+        # we need 5.16 because of apache mod_perl libs
+        nsExec::ExecToStack '"$ActiveStatePerl" -MConfig -e $\"print $Config{api_revision}$\"'
+        Pop $0
+        Pop $PerlMajor
+
+        nsExec::ExecToStack '"$ActiveStatePerl" -MConfig -e $\"print $Config{api_version}$\"'
+        Pop $0
+        Pop $PerlMinor
+        
+        ${If} $PerlMajor = 5
+            ${If} $PerlMinor <> 16
+                MessageBox MB_OK|MB_ICONSTOP "Please install ActivePerl 5.16 for x86. I found version $perlmajor.$perlminor."
+                ExecShell "open" "http://www.activestate.com/activeperl/downloads"            
+                Abort
+            ${EndIf}
+        ${Else}
+            # different major version than 5? Really?
+            MessageBox MB_OK|MB_ICONSTOP "Please install ActivePerl 5.16 for x86. I found version $perlmajor.$perlminor."
+            ExecShell "open" "http://www.activestate.com/activeperl/downloads"            
+            Abort
+        ${EndIf}        
+
+
+    ${Else}
+           DetailPrint "No ActiveState perl found"
+    ${EndIf}
+
+FunctionEnd
+
+# to check if MySQL is already installed
 Function InstCheckMySQLAlreadyInstalled
 
-    ReadRegStr $R0 HKLM "${Win_RegKey_Uninstall}" "UninstallString"
     ${If} ${TCPPortOpen} 3306
-        MessageBox MB_OK|MB_ICONSTOP "Port 3306 is already in use. MySQL is probably already installed on your machine. OTRS installs it's own MySQL instance and will need an open port 3306."
-        Abort
+        StrCpy $MySQLInstalled 1
     ${EndIf}
 
@@ -621,29 +757,47 @@
 
     ${If} ${TCPPortOpen} 80
-    MessageBox MB_OK "Port 80 is already in use. You probably already have a web server installed. OTRS brings it's own Apache instance and can only run on ports 80 or 443 (HTTPS). Make sure you configure your server so this causes no issues."
+#    MessageBox MB_OK "Port 80 is already in use. You probably already have a web server installed. OTRS brings it's own Apache instance and can only run on ports 80 or 443 (HTTPS). Make sure you configure your server so this causes no issues."
     ${EndIf}
 
 FunctionEnd
 
+Function DirectoryHide
+
+    ${If} $Upgrade != "no"
+         # set install dir from registry
+         ReadRegStr $INSTDIR HKLM "${OTRS_RegKey_Instance}" "Path"
+         Abort
+    ${EndIf}
+ 
+FunctionEnd 
+
 # to check if install directory is empty
 Function InstInstallationDirValidate
 
-    #make sure $INSTDIR path is either empty or does not exist.
-    Push $0
-    ${DirState} "$INSTDIR" $0
+    ${If} $Upgrade == "no"
+        #make sure $INSTDIR path is either empty or does not exist.
+        Push $0
+        ${DirState} "$INSTDIR" $0
 
-    ${If} $0 == 1   #folder is full.  (other values: 0: empty, -1: not found)
-        MessageBox MB_OK|MB_ICONEXCLAMATION "Directory not empty! Please select another directory."
-        Abort
-    ${EndIf}
+        ${If} $0 == 1   #folder is full.  (other values: 0: empty, -1: not found)
+            MessageBox MB_OK|MB_ICONEXCLAMATION "Directory not empty! Please select another directory."
+            Abort
+        ${EndIf}
 
-    Pop $0
+        Pop $0
+    ${EndIf}
 
 FunctionEnd
 
-# to open the webinstaller after the installation
-Function InstStartWebInstaller
 
-    ExecShell "open" "http://localhost/otrs/installer.pl"
+Function InstStartWeb
+# after completion launch the web installer for a new install
+# or the agent interface for upgrade (possibly even package manager?)    
+
+    ${If} $Upgrade == "no"
+        ExecShell "open" "http://localhost/otrs/installer.pl"
+    ${Else}
+        ExecShell "open" "http://localhost/otrs/index.pl"
+    ${EndIf}
 
 FunctionEnd
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.