From: Brian S. <xue...@us...> - 2005-03-02 19:53:56
|
Update of /cvsroot/popfile/windows In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23180 Modified Files: installer.nsi Added Files: installer-SecMinPerl-body.nsh installer-SecPOPFile-body.nsh installer-SecPOPFile-func.nsh installer-Uninstall.nsh Log Message: Script now issues a warning if used with a compiler which has not been tested yet. Sometimes compilers fail to compile scripts developed with older versions and even if the script can be compiled the installer's behaviour may differ significantly. Replace the clumsy static "SFN Support" detection with improved dynamic detection based upon the destination selection by the user (no need to check the NTFS flag if the destination uses FAT). Better reporting of SFN problems (now using language strings). Library items now use the "PFI_" prefix to help identify them. Divide the huge 'installer.nsi' script into smaller files. (1) installer.nsi - the master script for the POPFile installer which uses the following 'include' files: (2) installer-SecPOPFile-body.nsh - body of the section used to install the POPFile program (3) installer-SecPOPFile-func.nsh - non-library functions used by (2) (4) installer-SecMinPerl-body.nsh - body of the section used to install the basic minimal Perl required by the default POPFile configuration (5) installer-Uninstall.nsh - source for all of the POPFile uninstaller. --- NEW FILE: installer-SecPOPFile-body.nsh --- #-------------------------------------------------------------------------- # # installer-SecPOPFile-body.nsh --- This 'include' file contains the body of the "POPFile" # Section of the main 'installer.nsi' NSIS script used to # create the Windows installer for POPFile. # # The non-library functions used in this file are contained # in a separate file (see 'installer-SecPOPFile-func.nsh') # # Copyright (c) 2005 John Graham-Cumming # # This file is part of POPFile # # POPFile is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # POPFile is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with POPFile; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # #-------------------------------------------------------------------------- # The 'installer.nsi' script file contains the following code: # # Section "POPFile" SecPOPFile # !include "installer-SecPOPFile-body.nsh" # SectionEnd # # ; Functions used only by "installer-SecPOPFile-body.nsh" # # !include "installer-SecPOPFile-func.nsh" #-------------------------------------------------------------------------- # Processing performed: # # (a) If upgrading, shutdown existing version and rearrange minimal Perl files # (b) Create registry entries (HKLM and/or HKCU) for POPFile program files # (c) Install POPFile core program files and release notes # (d) Write the uninstaller program and create/update the Start Menu shortcuts # (e) Create 'Add/Remove Program' entry #-------------------------------------------------------------------------- ; Section "POPFile" SecPOPFile !insertmacro SECTIONLOG_ENTER "POPFile" ; Make this section mandatory (i.e. it is always installed) SectionIn RO !define L_RESULT $R9 !define L_TEMP $R8 Push ${L_RESULT} Push ${L_TEMP} SetDetailsPrint textonly DetailPrint "$(PFI_LANG_INST_PROG_UPGRADE) $(PFI_LANG_TAKE_A_FEW_SECONDS)" SetDetailsPrint listonly ; Before POPFile 0.21.0, POPFile and the minimal Perl shared the same folder structure ; and there was only one set of user data (stored in the same folder as POPFile). ; Phase 1 of the multi-user support introduced in 0.21.0 required some slight changes ; to the folder structure (to permit POPFile to be run from any folder after setting the ; POPFILE_ROOT and POPFILE_USER environment variables to appropriate values). ; The folder arrangement used for this build: ; ; (a) $INSTDIR - main POPFile installation folder, holds popfile.pl and several ; other *.pl scripts, runpopfile.exe, popfile*.exe plus three of the ; minimal Perl files (perl.exe, wperl.exe and perl58.dll) ; ; (b) $INSTDIR\kakasi - holds the Kakasi package used to process Japanese email ; (only installed when Japanese support is required) ; ; (c) $INSTDIR\lib - minimal Perl installation (except for the three files stored ; in the $INSTDIR folder to avoid runtime problems) ; ; (d) $INSTDIR\* - the remaining POPFile folders (Classifier, languages, skins, etc) ; ; For this build, each user is expected to have separate user data folders. By default each ; user data folder will contain popfile.cfg, stopwords, stopwords.default, popfile.db, ; the messages folder, etc. The 'Add POPFile User' wizard (adduser.exe) is responsible for ; creating/updating these user data folders and for handling conversion of existing flat file ; or BerkeleyDB corpus files to the new SQL database format. ; ; For increased flexibility, some global user variables are used in addition to $INSTDIR ; (this makes it easier to change the folder structure used by the installer). ; $G_ROOTDIR is initialised by 'CheckExistingProgDir' (the DIRECTORY page's "leave" function) StrCpy $G_MPLIBDIR "$G_ROOTDIR\lib" IfFileExists "$G_ROOTDIR\*.*" rootdir_exists ClearErrors CreateDirectory "$G_ROOTDIR" IfErrors 0 rootdir_exists SetDetailsPrint both DetailPrint "Fatal error: unable to create folder for the POPFile program files" SetDetailsPrint listonly MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST "Error: Unable to create folder for the POPFile program files\ ${MB_NL}${MB_NL}\ ($G_ROOTDIR)" Abort rootdir_exists: ; Starting with POPFile 0.22.0 the system tray icon uses 'localhost' instead of '127.0.0.1' ; to display the User Interface (and the installer has been updated to follow suit), so we ; need to ensure Win9x systems have a suitable 'hosts' file Call PFI_IsNT Pop ${L_RESULT} StrCmp ${L_RESULT} "1" continue Call CheckHostsFile continue: ; If we are installing over a previous version, ensure that version is not running Call MakeRootDirSafe ; Starting with 0.21.0, a new structure is used for the minimal Perl (to enable POPFile to ; be started from any folder, once POPFILE_ROOT and POPFILE_USER have been initialized) Call MinPerlRestructure ; Now that the HTML for the UI is no longer embedded in the Perl code, a new skin system is ; used so we attempt to convert the existing skins to work with the new system Call SkinsRestructure StrCmp $G_WINUSERTYPE "Admin" 0 current_user_root WriteRegStr HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "Installer Language" "$LANGUAGE" WriteRegStr HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "POPFile Major Version" "${C_POPFILE_MAJOR_VERSION}" WriteRegStr HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "POPFile Minor Version" "${C_POPFILE_MINOR_VERSION}" WriteRegStr HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "POPFile Revision" "${C_POPFILE_REVISION}" WriteRegStr HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "POPFile RevStatus" "${C_POPFILE_RC}" WriteRegStr HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "InstallPath" "$G_ROOTDIR" WriteRegStr HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "Author" "setup.exe" WriteRegStr HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "RootDir_LFN" "$G_ROOTDIR" StrCmp $G_SFN_DISABLED "0" find_HKLM_root_sfn StrCpy ${L_TEMP} "Not supported" Goto save_HKLM_root_sfn find_HKLM_root_sfn: GetFullPathName /SHORT ${L_TEMP} "$G_ROOTDIR" save_HKLM_root_sfn: WriteRegStr HKLM "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "RootDir_SFN" "${L_TEMP}" current_user_root: WriteRegStr HKCU "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "Installer Language" "$LANGUAGE" WriteRegStr HKCU "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "POPFile Major Version" "${C_POPFILE_MAJOR_VERSION}" WriteRegStr HKCU "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "POPFile Minor Version" "${C_POPFILE_MINOR_VERSION}" WriteRegStr HKCU "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "POPFile Revision" "${C_POPFILE_REVISION}" WriteRegStr HKCU "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "POPFile RevStatus" "${C_POPFILE_RC}" WriteRegStr HKCU "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "InstallPath" "$G_ROOTDIR" WriteRegStr HKCU "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "Author" "setup.exe" WriteRegStr HKCU "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "RootDir_LFN" "$G_ROOTDIR" StrCmp $G_SFN_DISABLED "0" find_HKCU_root_sfn StrCpy ${L_TEMP} "Not supported" Goto save_HKCU_root_sfn find_HKCU_root_sfn: GetFullPathName /SHORT ${L_TEMP} "$G_ROOTDIR" save_HKCU_root_sfn: WriteRegStr HKCU "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "RootDir_SFN" "${L_TEMP}" ; Install the POPFile Core files SetDetailsPrint textonly DetailPrint "$(PFI_LANG_INST_PROG_CORE)" SetDetailsPrint listonly SetOutPath "$G_ROOTDIR" ; Remove redundant files (from earlier test versions of the installer) Delete "$G_ROOTDIR\wrapper.exe" Delete "$G_ROOTDIR\wrapperf.exe" Delete "$G_ROOTDIR\wrapperb.exe" ; Install POPFile 'core' files File "..\engine\license" File "${C_RELEASE_NOTES}" CopyFiles /SILENT /FILESONLY "$PLUGINSDIR\${C_README}.txt" "$G_ROOTDIR\${C_README}.txt" File "..\engine\popfile.exe" File "..\engine\popfilef.exe" File "..\engine\popfileb.exe" File "..\engine\popfileif.exe" File "..\engine\popfileib.exe" File "..\engine\popfile-service.exe" File /nonfatal "/oname=pfi-stopwords.default" "..\engine\stopwords" File "runpopfile.exe" File "stop_pf.exe" File "sqlite.exe" File "runsqlite.exe" File "adduser.exe" File /nonfatal "test\pfidiag.exe" File "msgcapture.exe" IfFileExists "$G_ROOTDIR\pfimsgcapture.exe" 0 app_paths Delete "$G_ROOTDIR\pfimsgcapture.exe" File "/oname=pfimsgcapture.exe" "msgcapture.exe" app_paths: ; Add 'stop_pf.exe' to 'App Paths' to allow it to be run using Start -> Run -> stop_pf params WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\stop_pf.exe" \ "" "$G_ROOTDIR\stop_pf.exe" SetOutPath "$G_ROOTDIR" File "..\engine\popfile.pl" File "..\engine\popfile-check-setup.pl" File "..\engine\popfile.pck" File "..\engine\insert.pl" File "..\engine\bayes.pl" File "..\engine\pipe.pl" File "..\engine\favicon.ico" SetOutPath "$G_ROOTDIR\Classifier" File "..\engine\Classifier\Bayes.pm" File "..\engine\Classifier\WordMangle.pm" File "..\engine\Classifier\MailParse.pm" IfFileExists "$G_ROOTDIR\Classifier\popfile.sql" update_the_schema no_previous_version: WriteINIStr "$G_ROOTDIR\pfi-data.ini" "Settings" "Owner" "$G_WINUSERNAME" DeleteINIStr "$G_ROOTDIR\pfi-data.ini" "Settings" "OldSchema" Goto install_schema update_the_schema: Push "$G_ROOTDIR\Classifier\popfile.sql" Call PFI_GetPOPFileSchemaVersion Pop ${L_RESULT} StrCmp ${L_RESULT} "()" assume_early_schema StrCpy ${L_TEMP} ${L_RESULT} 1 StrCmp ${L_TEMP} "(" no_previous_version remember_version assume_early_schema: StrCpy ${L_RESULT} "0" remember_version: WriteINIStr "$G_ROOTDIR\pfi-data.ini" "Settings" "Owner" "$G_WINUSERNAME" WriteINIStr "$G_ROOTDIR\pfi-data.ini" "Settings" "OldSchema" "${L_RESULT}" install_schema: File "..\engine\Classifier\popfile.sql" SetOutPath "$G_ROOTDIR\Platform" File "..\engine\Platform\MSWin32.pm" Delete "$G_ROOTDIR\Platform\POPFileIcon.dll" SetOutPath "$G_ROOTDIR\POPFile" File "..\engine\POPFile\MQ.pm" File "..\engine\POPFile\Database.pm" File "..\engine\POPFile\History.pm" File "..\engine\POPFile\Loader.pm" File "..\engine\POPFile\Logger.pm" File "..\engine\POPFile\Module.pm" File "..\engine\POPFile\Mutex.pm" File "..\engine\POPFile\Configuration.pm" File "..\engine\POPFile\popfile_version" SetOutPath "$G_ROOTDIR\Proxy" File "..\engine\Proxy\Proxy.pm" File "..\engine\Proxy\POP3.pm" SetOutPath "$G_ROOTDIR\UI" File "..\engine\UI\HTML.pm" File "..\engine\UI\HTTP.pm" ;----------------------------------------------------------------------- ; 'English' version of the QuickStart Guide SetOutPath "$G_ROOTDIR\manual" File "..\engine\manual\*.gif" SetOutPath "$G_ROOTDIR\manual\en" File "..\engine\manual\en\*.html" ;----------------------------------------------------------------------- ; Default UI language SetOutPath "$G_ROOTDIR\languages" File "..\engine\languages\English.msg" ;----------------------------------------------------------------------- ; Default UI skin (the POPFile UI looks better if a skin is used) SetOutPath "$G_ROOTDIR\skins\default" File "..\engine\skins\default\*.*" ;----------------------------------------------------------------------- ; Create the uninstall program BEFORE creating the shortcut to it ; (this ensures that the correct "uninstall" icon appears in the START MENU shortcut) SetOutPath "$G_ROOTDIR" Delete "$G_ROOTDIR\uninstall.exe" WriteUninstaller "$G_ROOTDIR\uninstall.exe" ; Attempt to remove some StartUp and Start Menu shortcuts created by previous installations SetShellVarContext all Delete "$SMSTARTUP\Run POPFile.lnk" Delete "$SMSTARTUP\Run POPFile in background.lnk" Delete "$SMPROGRAMS\${C_PFI_PRODUCT}\Run POPFile in background.lnk" Delete "$SMPROGRAMS\${C_PFI_PRODUCT}\Manual.url" Delete "$SMPROGRAMS\${C_PFI_PRODUCT}\Support\POPFile Manual.url" SetShellVarContext current Delete "$SMSTARTUP\Run POPFile.lnk" Delete "$SMSTARTUP\Run POPFile in background.lnk" Delete "$SMPROGRAMS\${C_PFI_PRODUCT}\Run POPFile in background.lnk" Delete "$SMPROGRAMS\${C_PFI_PRODUCT}\Manual.url" Delete "$SMPROGRAMS\${C_PFI_PRODUCT}\Support\POPFile Manual.url" ; Create the START MENU entries SetDetailsPrint textonly DetailPrint "$(PFI_LANG_INST_PROG_SHORT)" SetDetailsPrint listonly ; 'CreateShortCut' uses '$OUTDIR' as the working directory for the shortcut ; ('SetOutPath' is one way to change the value of $OUTDIR) ; 'CreateShortCut' fails to update existing shortcuts if they are read-only, so try to clear ; the read-only attribute first. Similar handling is required for the Internet shortcuts. ; If the user has 'Admin' rights, create a 'POPFile' folder with a set of shortcuts in ; the 'All Users' Start Menu . If the user does not have 'Admin' rights, the shortcuts ; are created in the 'Current User' Start Menu. ; If the 'All Users' folder is not found, NSIS will return the 'Current User' folder. SetShellVarContext all StrCmp $G_WINUSERTYPE "Admin" create_shortcuts SetShellVarContext current create_shortcuts: SetOutPath "$SMPROGRAMS\${C_PFI_PRODUCT}" SetOutPath "$G_ROOTDIR" SetFileAttributes "$SMPROGRAMS\${C_PFI_PRODUCT}\Run POPFile.lnk" NORMAL CreateShortCut "$SMPROGRAMS\${C_PFI_PRODUCT}\Run POPFile.lnk" \ "$G_ROOTDIR\runpopfile.exe" SetFileAttributes "$SMPROGRAMS\${C_PFI_PRODUCT}\Uninstall POPFile.lnk" NORMAL CreateShortCut "$SMPROGRAMS\${C_PFI_PRODUCT}\Uninstall POPFile.lnk" \ "$G_ROOTDIR\uninstall.exe" SetOutPath "$G_ROOTDIR" SetFileAttributes "$SMPROGRAMS\${C_PFI_PRODUCT}\Release Notes.lnk" NORMAL CreateShortCut "$SMPROGRAMS\${C_PFI_PRODUCT}\Release Notes.lnk" \ "$G_ROOTDIR\${C_README}.txt" SetOutPath "$SMPROGRAMS\${C_PFI_PRODUCT}" SetFileAttributes "$SMPROGRAMS\${C_PFI_PRODUCT}\POPFile User Interface.url" NORMAL WriteINIStr "$SMPROGRAMS\${C_PFI_PRODUCT}\POPFile User Interface.url" \ "InternetShortcut" "URL" "http://${C_UI_URL}:$G_GUI/" SetFileAttributes "$SMPROGRAMS\${C_PFI_PRODUCT}\Shutdown POPFile.url" NORMAL WriteINIStr "$SMPROGRAMS\${C_PFI_PRODUCT}\Shutdown POPFile.url" \ "InternetShortcut" "URL" "http://${C_UI_URL}:$G_GUI/shutdown" SetFileAttributes "$SMPROGRAMS\${C_PFI_PRODUCT}\QuickStart Guide.url" NORMAL WriteINIStr "$SMPROGRAMS\${C_PFI_PRODUCT}\QuickStart Guide.url" \ "InternetShortcut" "URL" "file://$G_ROOTDIR/manual/en/manual.html" SetFileAttributes "$SMPROGRAMS\${C_PFI_PRODUCT}\FAQ.url" NORMAL !ifndef ENGLISH_MODE StrCmp $LANGUAGE ${LANG_JAPANESE} japanese_faq !endif WriteINIStr "$SMPROGRAMS\${C_PFI_PRODUCT}\FAQ.url" \ "InternetShortcut" "URL" \ "http://getpopfile.org/cgi-bin/wiki.pl?FrequentlyAskedQuestions" !ifndef ENGLISH_MODE Goto support japanese_faq: WriteINIStr "$SMPROGRAMS\${C_PFI_PRODUCT}\FAQ.url" \ "InternetShortcut" "URL" \ "http://getpopfile.org/cgi-bin/wiki.pl?JP_FrequentlyAskedQuestions" support: !endif SetOutPath "$SMPROGRAMS\${C_PFI_PRODUCT}\Support" SetFileAttributes "$SMPROGRAMS\${C_PFI_PRODUCT}\Support\POPFile Home Page.url" NORMAL WriteINIStr "$SMPROGRAMS\${C_PFI_PRODUCT}\Support\POPFile Home Page.url" \ "InternetShortcut" "URL" "http://getpopfile.org/" SetFileAttributes "$SMPROGRAMS\${C_PFI_PRODUCT}\Support\POPFile Support (Wiki).url" NORMAL !ifndef ENGLISH_MODE StrCmp $LANGUAGE ${LANG_JAPANESE} japanese_wiki !endif WriteINIStr "$SMPROGRAMS\${C_PFI_PRODUCT}\Support\POPFile Support (Wiki).url" \ "InternetShortcut" "URL" \ "http://getpopfile.org/cgi-bin/wiki.pl?POPFileDocumentationProject" !ifndef ENGLISH_MODE Goto pfidiagnostic japanese_wiki: WriteINIStr "$SMPROGRAMS\${C_PFI_PRODUCT}\Support\POPFile Support (Wiki).url" \ "InternetShortcut" "URL" \ "http://getpopfile.org/cgi-bin/wiki.pl?JP_POPFileDocumentationProject" pfidiagnostic: !endif IfFileExists "$G_ROOTDIR\pfidiag.exe" 0 silent_shutdown Delete "$SMPROGRAMS\${C_PFI_PRODUCT}\PFI Diagnostic utility.lnk" SetFileAttributes "$SMPROGRAMS\${C_PFI_PRODUCT}\Support\PFI Diagnostic utility (simple).lnk" NORMAL CreateShortCut "$SMPROGRAMS\${C_PFI_PRODUCT}\Support\PFI Diagnostic utility (simple).lnk" \ "$G_ROOTDIR\pfidiag.exe" SetFileAttributes "$SMPROGRAMS\${C_PFI_PRODUCT}\Support\PFI Diagnostic utility (full).lnk" NORMAL CreateShortCut "$SMPROGRAMS\${C_PFI_PRODUCT}\Support\PFI Diagnostic utility (full).lnk" \ "$G_ROOTDIR\pfidiag.exe" "/full" silent_shutdown: SetOutPath "$G_ROOTDIR" SetFileAttributes "$SMPROGRAMS\${C_PFI_PRODUCT}\Shutdown POPFile silently.lnk" NORMAL CreateShortCut "$SMPROGRAMS\${C_PFI_PRODUCT}\Shutdown POPFile silently.lnk" \ "$G_ROOTDIR\stop_pf.exe" "/showerrors $G_GUI" ; Create entry in the Control Panel's "Add/Remove Programs" list StrCmp $G_WINUSERTYPE "Admin" use_HKLM WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${C_PFI_PRODUCT}" \ "DisplayName" "${C_PFI_PRODUCT} ${C_PFI_VERSION}" WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${C_PFI_PRODUCT}" \ "UninstallString" "$G_ROOTDIR\uninstall.exe" WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${C_PFI_PRODUCT}" \ "NoModify" "1" WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${C_PFI_PRODUCT}" \ "NoRepair" "1" Goto end_section use_HKLM: WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${C_PFI_PRODUCT}" \ "DisplayName" "${C_PFI_PRODUCT} ${C_PFI_VERSION}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${C_PFI_PRODUCT}" \ "UninstallString" "$G_ROOTDIR\uninstall.exe" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${C_PFI_PRODUCT}" \ "NoModify" "1" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${C_PFI_PRODUCT}" \ "NoRepair" "1" end_section: SetDetailsPrint textonly DetailPrint "$(PFI_LANG_INST_PROG_ENDSEC)" SetDetailsPrint listonly !insertmacro SECTIONLOG_EXIT "POPFile" Pop ${L_TEMP} Pop ${L_RESULT} !undef L_RESULT !undef L_TEMP ; SectionEnd #-------------------------------------------------------------------------- # End of 'installer-SecPOPFile-body.nsh' #-------------------------------------------------------------------------- Index: installer.nsi =================================================================== RCS file: /cvsroot/popfile/windows/installer.nsi,v retrieving revision 1.254 retrieving revision 1.255 diff -C2 -d -r1.254 -r1.255 *** installer.nsi 17 Feb 2005 16:18:27 -0000 1.254 --- installer.nsi 2 Mar 2005 19:53:41 -0000 1.255 *************** *** 39,46 **** # #-------------------------------------------------------------------------- - ; This version of the script has been tested with the "NSIS 2" compiler (final), - ; released 7 February 2004, with no "official" NSIS patches/CVS updates applied. - ; ; Expect 3 compiler warnings, all related to standard NSIS language files which are out-of-date ; (if the default multi-language installer is compiled). --- 39,71 ---- # [...2405 lines suppressed...] ! !include "installer-Uninstall.nsh" ! #========================================================================== ! #========================================================================== #-------------------------------------------------------------------------- *************** *** 3770,3774 **** Push ${L_RESULT} ! Call IsNT Pop ${L_RESULT} StrCmp ${L_RESULT} "1" show_banner --- 1978,1982 ---- Push ${L_RESULT} ! Call PFI_IsNT Pop ${L_RESULT} StrCmp ${L_RESULT} "1" show_banner --- NEW FILE: installer-SecPOPFile-func.nsh --- #-------------------------------------------------------------------------- # # installer-SecPOPFile-func.nsh --- This 'include' file contains the non-library functions # used by the 'installer-SecPOPFile-body.nsh' file. # # Copyright (c) 2005 John Graham-Cumming # # This file is part of POPFile # # POPFile is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # POPFile is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with POPFile; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # #-------------------------------------------------------------------------- # The 'installer.nsi' script file contains the following code: # # Section "POPFile" SecPOPFile # !include "installer-SecPOPFile-body.nsh" # SectionEnd # # ; Functions used only by "installer-SecPOPFile-body.nsh" # # !include "installer-SecPOPFile-func.nsh" #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- # The following functions are only used by the 'installer-SecPOPFile-body.nsh' file: # # CheckHostsFile # MakeRootDirSafe # MinPerlRestructure # SkinsRestructure #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- # Installer Function: CheckHostsFile # # Starting with the 0.22.0 release the system tray icon uses 'http://localhost:port' to open # the User Interface (earlier versions used 'http://127.0.0.1:port' instead). The installer has # been updated to follow suit. Some Windows 9x systems may not have a HOSTS file which defines # 'localhost' so we ensure a suitable one exists #-------------------------------------------------------------------------- Function CheckHostsFile !define L_CFG $R9 !define L_LINE $R8 !define L_LOCALHOST $R7 !define L_TEMP $R6 Push ${L_CFG} Push ${L_LINE} Push ${L_LOCALHOST} Push ${L_TEMP} IfFileExists "$WINDIR\HOSTS" look_for_localhost FileOpen ${L_CFG} "$WINDIR\HOSTS" w FileWrite ${L_CFG} "# Created by the installer for ${C_PFI_PRODUCT} ${C_PFI_VERSION}${MB_NL}" FileWrite ${L_CFG} "${MB_NL}" FileWrite ${L_CFG} "127.0.0.1 localhost${MB_NL}" FileClose ${L_CFG} Goto exit look_for_localhost: StrCpy ${L_LOCALHOST} "" FileOpen ${L_CFG} "$WINDIR\HOSTS" r loop: FileRead ${L_CFG} ${L_LINE} StrCmp ${L_LINE} "" done StrCpy ${L_TEMP} ${L_LINE} 10 StrCmp ${L_TEMP} "127.0.0.1 " 0 loop Push ${L_LINE} Call PFI_TrimNewlines Push " localhost" Call PFI_StrStr Pop ${L_TEMP} StrCmp ${L_TEMP} "" loop StrCmp ${L_TEMP} " localhost" found StrCpy ${L_TEMP} ${L_TEMP} 11 StrCmp ${L_TEMP} " localhost " found Goto loop found: StrCpy ${L_LOCALHOST} "1" done: FileClose ${L_CFG} StrCmp ${L_LOCALHOST} "1" exit FileOpen ${L_CFG} "$WINDIR\HOSTS" a FileSeek ${L_CFG} 0 END FileWrite ${L_CFG} "${MB_NL}" FileWrite ${L_CFG} "# Inserted by the installer for ${C_PFI_PRODUCT} ${C_PFI_VERSION}${MB_NL}" FileWrite ${L_CFG} "${MB_NL}" FileWrite ${L_CFG} "127.0.0.1 localhost${MB_NL}" FileClose ${L_CFG} exit: Pop ${L_TEMP} Pop ${L_LOCALHOST} Pop ${L_LINE} Pop ${L_CFG} !undef L_CFG !undef L_LINE !undef L_LOCALHOST !undef L_TEMP FunctionEnd #-------------------------------------------------------------------------- # Installer Function: MakeRootDirSafe # # If we are installing on top of a previous installation, we try to shut it down # (to allow the files to be overwritten without requiring a reboot) # # We also need to check if any of the PFI utilities are running (to avoid Abort/Retry/Ignore # messages or the need to reboot in order to update them) #-------------------------------------------------------------------------- Function MakeRootDirSafe IfFileExists "$G_ROOTDIR\*.exe" 0 nothing_to_check !define L_CFG $R9 ; file handle !define L_EXE $R8 ; name of EXE file to be monitored !define L_LINE $R7 !define L_NEW_GUI $R6 !define L_OLD_GUI $R5 !define L_PARAM $R4 !define L_RESULT $R3 !define L_TEXTEND $R2 ; used to ensure correct handling of lines longer than 1023 chars Push ${L_CFG} Push ${L_EXE} Push ${L_LINE} Push ${L_NEW_GUI} Push ${L_OLD_GUI} Push ${L_PARAM} Push ${L_RESULT} Push ${L_TEXTEND} ; Starting with POPfile 0.21.0 an experimental version of 'popfile-service.exe' was included ; to allow POPFile to be run as a Windows service. Push "POPFile" Call PFI_ServiceRunning Pop ${L_RESULT} StrCmp ${L_RESULT} "true" manual_shutdown ; If we are about to overwrite an existing version which is still running, ; then one of the EXE files will be 'locked' which means we have to shutdown POPFile. ; ; POPFile v0.20.0 and later may be using 'popfileb.exe', 'popfilef.exe', 'popfileib.exe', ; 'popfileif.exe', 'perl.exe' or 'wperl.exe'. ; ; Earlier versions of POPFile use only 'perl.exe' or 'wperl.exe'. Push $G_ROOTDIR Call PFI_FindLockedPFE Pop ${L_EXE} StrCmp ${L_EXE} "" check_pfi_utils ; The program files we are about to update are in use so we need to shut POPFile down DetailPrint "... it is locked." ; Attempt to discover which POPFile UI port is used by the current user, so we can issue ; a shutdown request. The following cases are considered: ; ; (a) upgrading a 0.21.0 or later installation and runpopfile.exe was used to start POPFile, ; so POPFile is using environment variables which match the HKCU RootDir_SFN and ; UserDir_SFN registry data (or HKCU RootDir_LFN and UserDir_LFN if short file names are ; not supported) ; ; (b) upgrading a pre-0.21.0 installation, so popfile.cfg is in the $G_ROOTDIR folder. Need to ; look for old-style and new-style UI port specifications just like the old installer did. ReadRegStr ${L_CFG} HKCU "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "UserDir_LFN" StrCmp ${L_CFG} "" try_root_dir IfFileExists "${L_CFG}\popfile.cfg" check_cfg_file try_root_dir: IfFileExists "$G_ROOTDIR\popfile.cfg" 0 manual_shutdown StrCpy ${L_CFG} "$G_ROOTDIR" check_cfg_file: StrCpy ${L_NEW_GUI} "" StrCpy ${L_OLD_GUI} "" ; See if we can get the current gui port from an existing configuration. ; There may be more than one entry for this port in the file - use the last one found ; (but give priority to any "html_port" entry). FileOpen ${L_CFG} "${L_CFG}\popfile.cfg" r found_eol: StrCpy ${L_TEXTEND} "<eol>" loop: FileRead ${L_CFG} ${L_LINE} StrCmp ${L_LINE} "" done StrCmp ${L_TEXTEND} "<eol>" 0 check_eol StrCmp ${L_LINE} "$\n" loop StrCpy ${L_PARAM} ${L_LINE} 10 StrCmp ${L_PARAM} "html_port " got_html_port StrCpy ${L_PARAM} ${L_LINE} 8 StrCmp ${L_PARAM} "ui_port " got_ui_port Goto check_eol got_ui_port: StrCpy ${L_OLD_GUI} ${L_LINE} 5 8 Goto check_eol got_html_port: StrCpy ${L_NEW_GUI} ${L_LINE} 5 10 ; Now read file until we get to end of the current line ; (i.e. until we find text ending in <CR><LF>, <CR> or <LF>) check_eol: StrCpy ${L_TEXTEND} ${L_LINE} 1 -1 StrCmp ${L_TEXTEND} "$\n" found_eol StrCmp ${L_TEXTEND} "$\r" found_eol loop done: FileClose ${L_CFG} Push ${L_NEW_GUI} Call PFI_TrimNewlines Pop ${L_NEW_GUI} Push ${L_OLD_GUI} Call PFI_TrimNewlines Pop ${L_OLD_GUI} StrCmp ${L_NEW_GUI} "" try_old_style DetailPrint "$(PFI_LANG_INST_LOG_SHUTDOWN) ${L_NEW_GUI} [new style port]" DetailPrint "$(PFI_LANG_TAKE_A_FEW_SECONDS)" Push ${L_NEW_GUI} Call PFI_ShutdownViaUI Pop ${L_RESULT} StrCmp ${L_RESULT} "success" check_exe StrCmp ${L_RESULT} "password?" manual_shutdown try_old_style: StrCmp ${L_OLD_GUI} "" manual_shutdown DetailPrint "$(PFI_LANG_INST_LOG_SHUTDOWN) ${L_OLD_GUI} [old style port]" DetailPrint "$(PFI_LANG_TAKE_A_FEW_SECONDS)" Push ${L_OLD_GUI} Call PFI_ShutdownViaUI Pop ${L_RESULT} StrCmp ${L_RESULT} "success" check_exe Goto manual_shutdown check_exe: DetailPrint "Waiting for '${L_EXE}' to unlock after NSISdl request..." DetailPrint "Please be patient, this may take more than 30 seconds" Push ${L_EXE} Call PFI_WaitUntilUnlocked DetailPrint "Checking if '${L_EXE}' is still locked after NSISdl request..." Push ${L_EXE} Call PFI_CheckIfLocked Pop ${L_EXE} StrCmp ${L_EXE} "" unlocked_now manual_shutdown: StrCpy $G_PLS_FIELD_1 "POPFile" DetailPrint "Unable to shutdown $G_PLS_FIELD_1 automatically - manual intervention requested" MessageBox MB_OK|MB_ICONEXCLAMATION|MB_TOPMOST "$(PFI_LANG_MBMANSHUT_1)\ ${MB_NL}${MB_NL}\ $(PFI_LANG_MBMANSHUT_2)\ ${MB_NL}${MB_NL}\ $(PFI_LANG_MBMANSHUT_3)" Goto check_pfi_utils unlocked_now: DetailPrint "File is now unlocked" check_pfi_utils: Push $G_ROOTDIR Call PFI_RequestPFIUtilsShutdown Pop ${L_TEXTEND} Pop ${L_RESULT} Pop ${L_PARAM} Pop ${L_OLD_GUI} Pop ${L_NEW_GUI} Pop ${L_LINE} Pop ${L_EXE} Pop ${L_CFG} !undef L_CFG !undef L_EXE !undef L_LINE !undef L_NEW_GUI !undef L_OLD_GUI !undef L_PARAM !undef L_RESULT !undef L_TEXTEND nothing_to_check: FunctionEnd #-------------------------------------------------------------------------- # Installer Function: MinPerlRestructure # # Prior to POPFile 0.21.0, POPFile really only supported one user so the location of the # popfile.cfg configuration file was hard-coded and the minimal Perl files were intermingled # with the POPFile files. POPFile 0.21.0 introduced some multi-user support which means that # the location of the configuration file is now supplied via an environment variable to allow # POPFile to be run from any folder. As a result, some rearrangement of the minimal Perl files # is required (to avoid Perl runtime errors when POPFile is started from a folder other than # the one where POPFile is installed). #-------------------------------------------------------------------------- Function MinPerlRestructure ; Since the 0.18.0 release (February 2003), the minimal Perl has used perl58.dll. Earlier ; versions of POPFile used earlier versions of Perl (e.g. the 0.17.8 release (December 2002) ; used perl56.dll) Delete "$G_ROOTDIR\perl56.dll" ; If the minimal Perl folder used by 0.21.0 or later exists and has some Perl files in it, ; assume there are no pre-0.21.0 minimal Perl files to be moved out of the way. IfFileExists "$G_MPLIBDIR\*.pm" exit CreateDirectory "$G_MPLIBDIR" IfFileExists "$G_ROOTDIR\*.pm" 0 move_folders CopyFiles /SILENT /FILESONLY "$G_ROOTDIR\*.pm" "$G_MPLIBDIR\" Delete "$G_ROOTDIR\*.pm" move_folders: !insertmacro PFI_MinPerlMove "auto" !insertmacro PFI_MinPerlMove "Carp" !insertmacro PFI_MinPerlMove "DBD" !insertmacro PFI_MinPerlMove "Digest" !insertmacro PFI_MinPerlMove "Encode" !insertmacro PFI_MinPerlMove "Exporter" !insertmacro PFI_MinPerlMove "File" !insertmacro PFI_MinPerlMove "Getopt" !insertmacro PFI_MinPerlMove "IO" !insertmacro PFI_MinPerlMove "MIME" !insertmacro PFI_MinPerlMove "String" !insertmacro PFI_MinPerlMove "Sys" !insertmacro PFI_MinPerlMove "Text" !insertmacro PFI_MinPerlMove "warnings" ; Delete redundant minimal Perl files from earlier installations IfFileExists "$G_ROOTDIR\Win32\*.*" 0 exit Delete "$G_ROOTDIR\Win32\API\Callback.pm" Delete "$G_ROOTDIR\Win32\API\Struct.pm" Delete "$G_ROOTDIR\Win32\API\Type.pm" RMDir "$G_ROOTDIR\Win32\API" Delete "$G_ROOTDIR\Win32\API.pm" RMDir "$G_ROOTDIR\Win32" exit: FunctionEnd #-------------------------------------------------------------------------- # Installer Function: SkinsRestructure # # Now that the HTML for the UI is no longer embedded in the Perl code, some changes need to be # made to the skins. There is now a new default skin which includes a set of HTML template files # in addition to a CSS file. Additional skins consist of separate folders containing 'style.css' # and any image files used by the skin (instead of each skin using a uniquely named CSS file in # the 'skins' folder, with any necessary image files being stored either in the 'skins' folder # or in a separate sub-folder). # # We attempt to rearrange any existing skins to suit this new structure (the current build only # moves files, it does not edit the CSS files to update any image references within them). # # The new default skin and its associated HTML template files are always installed by the # mandatory 'POPFile' component (even if the 'skins' component is not installed). #-------------------------------------------------------------------------- Function SkinsRestructure RMDir "$G_ROOTDIR\skins\lavishImages" RMDir "$G_ROOTDIR\skins\sleetImages" IfFileExists "$G_ROOTDIR\skins\default\*.thtml" exit !insertmacro PFI_SkinMove "blue" "blue" !insertmacro PFI_SkinMove "CoolBlue" "coolblue" !insertmacro PFI_SkinMove "CoolBrown" "coolbrown" !insertmacro PFI_SkinMove "CoolGreen" "coolgreen" !insertmacro PFI_SkinMove "CoolOrange" "coolorange" !insertmacro PFI_SkinMove "CoolYellow" "coolyellow" !insertmacro PFI_SkinMove "default" "default" !insertmacro PFI_SkinMove "glassblue" "glassblue" !insertmacro PFI_SkinMove "green" "green" IfFileExists "$G_ROOTDIR\skins\lavishImages\*.*" 0 lavish Rename "$G_ROOTDIR\skins\lavishImages" "$G_ROOTDIR\skins\lavish" lavish: !insertmacro PFI_SkinMove "Lavish" "lavish" !insertmacro PFI_SkinMove "LRCLaptop" "lrclaptop" !insertmacro PFI_SkinMove "orange" "orange" !insertmacro PFI_SkinMove "orangeCream" "orangecream" !insertmacro PFI_SkinMove "outlook" "outlook" !insertmacro PFI_SkinMove "PRJBlueGrey" "prjbluegrey" !insertmacro PFI_SkinMove "PRJSteelBeach" "prjsteelbeach" !insertmacro PFI_SkinMove "SimplyBlue" "simplyblue" IfFileExists "$G_ROOTDIR\skins\sleetImages\*.*" 0 sleet Rename "$G_ROOTDIR\skins\sleetImages" "$G_ROOTDIR\skins\sleet" sleet: !insertmacro PFI_SkinMove "Sleet" "sleet" !insertmacro PFI_SkinMove "Sleet-RTL" "sleet-rtl" !insertmacro PFI_SkinMove "smalldefault" "smalldefault" !insertmacro PFI_SkinMove "smallgrey" "smallgrey" !insertmacro PFI_SkinMove "StrawberryRose" "strawberryrose" !insertmacro PFI_SkinMove "tinydefault" "tinydefault" !insertmacro PFI_SkinMove "tinygrey" "tinygrey" !insertmacro PFI_SkinMove "white" "white" !insertmacro PFI_SkinMove "windows" "windows" IfFileExists "$G_ROOTDIR\skins\chipped_obsidian.gif" 0 metalback CreateDirectory "$G_ROOTDIR\skins\prjsteelbeach" Rename "$G_ROOTDIR\skins\chipped_obsidian.gif" "$G_ROOTDIR\skins\prjsteelbeach\chipped_obsidian.gif" metalback: IfFileExists "$G_ROOTDIR\skins\metalback.gif" 0 check_for_extra_skins CreateDirectory "$G_ROOTDIR\skins\prjsteelbeach" Rename "$G_ROOTDIR\skins\metalback.gif" "$G_ROOTDIR\skins\prjsteelbeach\metalback.gif" check_for_extra_skins: ; Move any remaining CSS files to an appropriate folder (to make them available for selection) ; Only the CSS files are moved, the user will have to adjust any skins which use images !define L_CSS_HANDLE $R9 ; used when searching for non-standard skins !define L_SKIN_NAME $R8 ; name of a non-standard skin (i.e. not supplied with POPFile) Push ${L_CSS_HANDLE} Push ${L_SKIN_NAME} FindFirst ${L_CSS_HANDLE} ${L_SKIN_NAME} "$G_ROOTDIR\skins\*.css" StrCmp ${L_CSS_HANDLE} "" all_done_now process_skin: StrCmp ${L_SKIN_NAME} "." look_again StrCmp ${L_SKIN_NAME} ".." look_again IfFileExists "$G_ROOTDIR\skins\${L_SKIN_NAME}\*.*" look_again StrCpy ${L_SKIN_NAME} ${L_SKIN_NAME} -4 CreateDirectory "$G_ROOTDIR\skins\${L_SKIN_NAME}" Rename "$G_ROOTDIR\skins\${L_SKIN_NAME}.css" "$G_ROOTDIR\skins\${L_SKIN_NAME}\style.css" look_again: FindNext ${L_CSS_HANDLE} ${L_SKIN_NAME} StrCmp ${L_SKIN_NAME} "" all_done_now process_skin all_done_now: FindClose ${L_CSS_HANDLE} Pop ${L_SKIN_NAME} Pop ${L_CSS_HANDLE} !undef L_CSS_HANDLE !undef L_SKIN_NAME exit: FunctionEnd #-------------------------------------------------------------------------- # End of 'installer-SecPOPFile-func.nsh' #-------------------------------------------------------------------------- --- NEW FILE: installer-SecMinPerl-body.nsh --- #-------------------------------------------------------------------------- # # installer-SecMinPerl-body.nsh --- This 'include' file contains the body of the "MinPerl" # Section of the main 'installer.nsi' NSIS script used to # create the Windows installer for POPFile. The "MinPerl" # section installs a minimal Perl which suits the default # POPFile configuration. For some of the optional POPFile # components (e.g. XMLRPC) additional Perl components are # required and these are installed at the same time as the # optional POPFile component. # # Copyright (c) 2005 John Graham-Cumming # # This file is part of POPFile # # POPFile is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # POPFile is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with POPFile; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # #-------------------------------------------------------------------------- # The 'installer.nsi' script file contains the following code: # # Section "-Minimal Perl" SecMinPerl # !include "installer-SecMinPerl-body.nsh" # SectionEnd #-------------------------------------------------------------------------- ; Section "-Minimal Perl" SecMinPerl ; This section installs the "core" version of the minimal Perl. Some of the optional ; POPFile components, such as the Kakasi package and POPFile's XMLRPC module, require ; extra Perl components which are added when the optional POPFile components are installed. !insertmacro SECTIONLOG_ENTER "Minimal Perl" ; Install the Minimal Perl files SetDetailsPrint textonly DetailPrint "$(PFI_LANG_INST_PROG_PERL)" SetDetailsPrint listonly ; Remove empty minimal Perl folder (error flag set if folder not empty) ClearErrors RMDir "$G_MPLIBDIR" IfErrors 0 install_now StrCpy $G_PLS_FIELD_1 "$G_MPLIBDIR" MessageBox MB_YESNO|MB_ICONQUESTION "$(PFI_LANG_MINPERL_MBREMOLD)" IDNO install_now DetailPrint "Remove old minimal Perl folder" RMDir /r "$G_MPLIBDIR" DetailPrint "" install_now: SetOutPath "$G_ROOTDIR" File "${C_PERL_DIR}\bin\perl.exe" File "${C_PERL_DIR}\bin\wperl.exe" File "${C_PERL_DIR}\bin\perl58.dll" SetOutPath "$G_MPLIBDIR" File "${C_PERL_DIR}\lib\AutoLoader.pm" File "${C_PERL_DIR}\lib\Carp.pm" File "${C_PERL_DIR}\lib\Config.pm" File "${C_PERL_DIR}\lib\constant.pm" File "${C_PERL_DIR}\lib\DynaLoader.pm" File "${C_PERL_DIR}\lib\Errno.pm" File "${C_PERL_DIR}\lib\Exporter.pm" File "${C_PERL_DIR}\lib\Fcntl.pm" File "${C_PERL_DIR}\lib\integer.pm" File "${C_PERL_DIR}\lib\IO.pm" File "${C_PERL_DIR}\lib\lib.pm" File "${C_PERL_DIR}\lib\locale.pm" File "${C_PERL_DIR}\lib\POSIX.pm" File "${C_PERL_DIR}\lib\re.pm" File "${C_PERL_DIR}\lib\SelectSaver.pm" File "${C_PERL_DIR}\lib\Socket.pm" File "${C_PERL_DIR}\lib\strict.pm" File "${C_PERL_DIR}\lib\Symbol.pm" File "${C_PERL_DIR}\lib\vars.pm" File "${C_PERL_DIR}\lib\warnings.pm" File "${C_PERL_DIR}\lib\XSLoader.pm" SetOutPath "$G_MPLIBDIR\Carp" File "${C_PERL_DIR}\lib\Carp\*" SetOutPath "$G_MPLIBDIR\Date" File "${C_PERL_DIR}\site\lib\Date\Format.pm" File "${C_PERL_DIR}\site\lib\Date\Parse.pm" SetOutPath "$G_MPLIBDIR\Digest" File "${C_PERL_DIR}\lib\Digest\MD5.pm" SetOutPath "$G_MPLIBDIR\Exporter" File "${C_PERL_DIR}\lib\Exporter\*" SetOutPath "$G_MPLIBDIR\File" File "${C_PERL_DIR}\lib\File\Copy.pm" File "${C_PERL_DIR}\lib\File\Glob.pm" File "${C_PERL_DIR}\lib\File\Spec.pm" SetOutPath "$G_MPLIBDIR\File\Spec" File "${C_PERL_DIR}\lib\File\Spec\Unix.pm" File "${C_PERL_DIR}\lib\File\Spec\Win32.pm" SetOutPath "$G_MPLIBDIR\Getopt" File "${C_PERL_DIR}\lib\Getopt\Long.pm" SetOutPath "$G_MPLIBDIR\HTML" File "${C_PERL_DIR}\site\lib\HTML\Tagset.pm" File "${C_PERL_DIR}\site\lib\HTML\Template.pm" SetOutPath "$G_MPLIBDIR\IO" File "${C_PERL_DIR}\lib\IO\*" SetOutPath "$G_MPLIBDIR\IO\Socket" File "${C_PERL_DIR}\lib\IO\Socket\*" SetOutPath "$G_MPLIBDIR\MIME" File "${C_PERL_DIR}\lib\MIME\*" SetOutPath "$G_MPLIBDIR\Sys" File "${C_PERL_DIR}\lib\Sys\*" SetOutPath "$G_MPLIBDIR\Text" File "${C_PERL_DIR}\lib\Text\ParseWords.pm" SetOutPath "$G_MPLIBDIR\Time" File "${C_PERL_DIR}\lib\Time\Local.pm" File "${C_PERL_DIR}\site\lib\Time\Zone.pm" SetOutPath "$G_MPLIBDIR\warnings" File "${C_PERL_DIR}\lib\warnings\register.pm" SetOutPath "$G_MPLIBDIR\auto\Digest\MD5" File "${C_PERL_DIR}\lib\auto\Digest\MD5\*" SetOutPath "$G_MPLIBDIR\auto\DynaLoader" File "${C_PERL_DIR}\lib\auto\DynaLoader\*" SetOutPath "$G_MPLIBDIR\auto\Fcntl" File "${C_PERL_DIR}\lib\auto\Fcntl\Fcntl.dll" SetOutPath "$G_MPLIBDIR\auto\File\Glob" File "${C_PERL_DIR}\lib\auto\File\Glob\*" SetOutPath "$G_MPLIBDIR\auto\IO" File "${C_PERL_DIR}\lib\auto\IO\*" SetOutPath "$G_MPLIBDIR\auto\MIME\Base64" File "${C_PERL_DIR}\lib\auto\MIME\Base64\*" SetOutPath "$G_MPLIBDIR\auto\POSIX" File "${C_PERL_DIR}\lib\auto\POSIX\POSIX.dll" File "${C_PERL_DIR}\lib\auto\POSIX\autosplit.ix" File "${C_PERL_DIR}\lib\auto\POSIX\load_imports.al" SetOutPath "$G_MPLIBDIR\auto\Socket" File "${C_PERL_DIR}\lib\auto\Socket\*" SetOutPath "$G_MPLIBDIR\auto\Sys\Hostname" File "${C_PERL_DIR}\lib\auto\Sys\Hostname\*" ; Install Perl modules and library files for BerkeleyDB support. Although POPFile now uses ; SQLite (or another SQL database) to store the corpus and other essential data, it retains ; the ability to automatically convert old BerkeleyDB format corpus files to the SQL database ; format. Therefore the installer still installs the BerkeleyDB Perl components. SetOutPath "$G_MPLIBDIR" File "${C_PERL_DIR}\site\lib\BerkeleyDB.pm" File "${C_PERL_DIR}\lib\UNIVERSAL.pm" SetOutPath "$G_MPLIBDIR\auto\BerkeleyDB" File "${C_PERL_DIR}\site\lib\auto\BerkeleyDB\autosplit.ix" File "${C_PERL_DIR}\site\lib\auto\BerkeleyDB\BerkeleyDB.bs" File "${C_PERL_DIR}\site\lib\auto\BerkeleyDB\BerkeleyDB.dll" File "${C_PERL_DIR}\site\lib\auto\BerkeleyDB\BerkeleyDB.exp" File "${C_PERL_DIR}\site\lib\auto\BerkeleyDB\BerkeleyDB.lib" ; Install Perl modules and library files for SQLite support SetOutPath "$G_MPLIBDIR" File "${C_PERL_DIR}\lib\base.pm" File "${C_PERL_DIR}\lib\overload.pm" File "${C_PERL_DIR}\site\lib\DBI.pm" ; Required in order to use any version of SQLite SetOutPath "$G_MPLIBDIR\auto\DBI" File "${C_PERL_DIR}\site\lib\auto\DBI\DBI.bs" File "${C_PERL_DIR}\site\lib\auto\DBI\DBI.dll" File "${C_PERL_DIR}\site\lib\auto\DBI\DBI.exp" File "${C_PERL_DIR}\site\lib\auto\DBI\DBI.lib" ; Install SQLite support SetOutPath "$G_MPLIBDIR\DBD" File "${C_PERL_DIR}\site\lib\DBD\SQLite.pm" SetOutPath "$G_MPLIBDIR\auto\DBD\SQLite" File "${C_PERL_DIR}\site\lib\auto\DBD\SQLite\SQLite.bs" File "${C_PERL_DIR}\site\lib\auto\DBD\SQLite\SQLite.dll" File "${C_PERL_DIR}\site\lib\auto\DBD\SQLite\SQLite.exp" File "${C_PERL_DIR}\site\lib\auto\DBD\SQLite\SQLite.lib" ; Extra Perl modules required for the encrypted cookies introduced in POPFile 0.23.0 SetOutPath "$G_MPLIBDIR" File "${C_PERL_DIR}\lib\bytes.pm" File "${C_PERL_DIR}\lib\subs.pm" SetOutPath "$G_MPLIBDIR\Class" File "${C_PERL_DIR}\site\lib\Class\Loader.pm" SetOutPath "$G_MPLIBDIR\Crypt" File "${C_PERL_DIR}\site\lib\Crypt\Blowfish.pm" File "${C_PERL_DIR}\site\lib\Crypt\CBC.pm" File "${C_PERL_DIR}\site\lib\Crypt\Random.pm" SetOutPath "$G_MPLIBDIR\Crypt\Random" File "${C_PERL_DIR}\site\lib\Crypt\Random\Generator.pm" SetOutPath "$G_MPLIBDIR\Crypt\Random\Provider" File "${C_PERL_DIR}\site\lib\Crypt\Random\Provider\*.pm" SetOutPath "$G_MPLIBDIR\Data" File "${C_PERL_DIR}\lib\Data\Dumper.pm" SetOutPath "$G_MPLIBDIR\Digest" File "${C_PERL_DIR}\site\lib\Digest\SHA.pm" SetOutPath "$G_MPLIBDIR\Math" File "${C_PERL_DIR}\site\lib\Math\Pari.pm" SetOutPath "$G_MPLIBDIR\auto\Crypt\Blowfish" File "${C_PERL_DIR}\site\lib\auto\Crypt\Blowfish\Blowfish.bs" File "${C_PERL_DIR}\site\lib\auto\Crypt\Blowfish\Blowfish.dll" File "${C_PERL_DIR}\site\lib\auto\Crypt\Blowfish\Blowfish.exp" File "${C_PERL_DIR}\site\lib\auto\Crypt\Blowfish\Blowfish.lib" SetOutPath "$G_MPLIBDIR\auto\Data\Dumper" File "${C_PERL_DIR}\lib\auto\Data\Dumper\Dumper.bs" File "${C_PERL_DIR}\lib\auto\Data\Dumper\Dumper.dll" File "${C_PERL_DIR}\lib\auto\Data\Dumper\Dumper.exp" File "${C_PERL_DIR}\lib\auto\Data\Dumper\Dumper.lib" SetOutPath "$G_MPLIBDIR\auto\Digest\SHA" File "${C_PERL_DIR}\site\lib\auto\Digest\SHA\SHA.bs" File "${C_PERL_DIR}\site\lib\auto\Digest\SHA\SHA.dll" File "${C_PERL_DIR}\site\lib\auto\Digest\SHA\SHA.exp" File "${C_PERL_DIR}\site\lib\auto\Digest\SHA\SHA.lib" SetOutPath "$G_MPLIBDIR\auto\Math\Pari" File "${C_PERL_DIR}\site\lib\auto\Math\Pari\Pari.bs" File "${C_PERL_DIR}\site\lib\auto\Math\Pari\Pari.dll" File "${C_PERL_DIR}\site\lib\auto\Math\Pari\Pari.exp" File "${C_PERL_DIR}\site\lib\auto\Math\Pari\Pari.lib" SetDetailsPrint textonly DetailPrint "$(PFI_LANG_INST_PROG_ENDSEC)" SetDetailsPrint listonly !insertmacro SECTIONLOG_EXIT "Minimal Perl" ; SectionEnd #-------------------------------------------------------------------------- # End of 'installer-SecMinPerl-body.nsh' #-------------------------------------------------------------------------- --- NEW FILE: installer-Uninstall.nsh --- #-------------------------------------------------------------------------- # # installer-Uninstall.nsh --- This 'include' file contains the 'Uninstall' part of the main # NSIS 'installer.nsi' script used to create the POPFile installer. # # Copyright (c) 2005 John Graham-Cumming # # This file is part of POPFile # # POPFile is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # POPFile is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with POPFile; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # #-------------------------------------------------------------------------- # The 'installer.nsi' script file contains the following code: # # #========================================================================== # #========================================================================== # # The 'Uninstall' part of the script is in a separate file # #========================================================================== # #========================================================================== # # !include "installer-Uninstall.nsh" # # #========================================================================== # #========================================================================== # #-------------------------------------------------------------------------- ##################################################################################### # # # ## ## ## ## ## ## ## ##### ######## ##### ## ## # # ## ## ### ## ## ### ## ## ## ## ## ## ## ## # # ## ## #### ## ## #### ## ## ## ## ## ## ## # # ## ## ## ## ## ## ## ## ## ##### ## ####### ## ## # # ## ## ## #### ## ## #### ## ## ## ## ## ## # # ## ## ## ### ## ## ### ## ## ## ## ## ## ## # # ###### ## ## ## ## ## ##### ## ## ## ###### ###### # # # ##################################################################################### #-------------------------------------------------------------------------- # Initialise the uninstaller #-------------------------------------------------------------------------- Function un.onInit ; Retrieve the language used when POPFile was installed, and use it for the uninstaller ; (if the language entry is not found in the registry, a 'language selection' dialog is shown) !insertmacro MUI_UNGETLANGUAGE StrCpy $G_ROOTDIR "$INSTDIR" StrCpy $G_MPLIBDIR "$INSTDIR\lib" ; Starting with 0.21.0 the registry is used to store the location of the 'User Data' ; (if setup.exe or adduser.exe was used to create/update the 'User Data' for this user) ReadRegStr $G_USERDIR HKCU "Software\POPFile Project\${C_PFI_PRODUCT}\MRI" "UserDir_LFN" StrCmp $G_USERDIR "" 0 got_user_path ; Pre-release versions of the 0.21.0 installer used a sub-folder for the default user data StrCpy $G_USERDIR "$INSTDIR\user" ; If we are uninstalling an upgraded installation, the default user data may be in $INSTDIR ; instead of $INSTDIR\user IfFileExists "$G_USERDIR\popfile.cfg" got_user_path StrCpy $G_USERDIR "$INSTDIR" got_user_path: ; Email settings are stored on a 'per user' basis therefore we need to know which user is ; running the uninstaller (e.g. so we can check ownership of any local 'User Data' we find) ClearErrors UserInfo::GetName IfErrors 0 got_name ; Assume Win9x system, so user has 'Admin' rights ; (UserInfo works on Win98SE so perhaps it is only Win95 that fails ?) StrCpy $G_WINUSERNAME "UnknownUser" StrCpy $G_WINUSERTYPE "Admin" Goto start_uninstall got_name: Pop $G_WINUSERNAME StrCmp $G_WINUSERNAME "" 0 get_usertype StrCpy $G_WINUSERNAME "UnknownUser" get_usertype: UserInfo::GetAccountType Pop $G_WINUSERTYPE StrCmp $G_WINUSERTYPE "Admin" start_uninstall StrCmp $G_WINUSERTYPE "Power" start_uninstall StrCmp $G_WINUSERTYPE "User" start_uninstall StrCmp $G_WINUSERTYPE "Guest" start_uninstall StrCpy $G_WINUSERTYPE "Unknown" start_uninstall: FunctionEnd #-------------------------------------------------------------------------- # Uninstaller Sections (this build uses all of these and executes them in the order shown) # # (1) un.Uninstall Begin - requests confirmation if appropriate # (2) un.Local User Data - looks for and removes 'User Data' from the PROGRAM folder # (3) un.Shutdown POPFile - shutdown POPFile if necessary (to avoid the need to reboot) # (4) un.Start Menu Entries - remove StartUp shortcuts and Start Menu entries # (5) un.POPFile Core - uninstall POPFile PROGRAM files # (6) un.Skins - uninstall POPFile skins # (7) un.Languages - uninstall POPFile UI languages # (8) un.QuickStart Guide - uninstall POPFile English QuickStart Guide # (9) un.Kakasi - uninstall Kakasi package and remove its environment variables # (10) un.Minimal Perl - uninstall minimal Perl, including all of the optional modules # (11) un.Registry Entries - remove 'Add/Remove Program' data and other registry entries # (12) un.Uninstall End - remove remaining files/folders (if it is safe to do so) # #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- # Uninstaller Section: 'un.Uninstall Begin' (the first section in the uninstaller) #-------------------------------------------------------------------------- Section "un.Uninstall Begin" UnSecBegin !define L_TEMP $R9 Push ${L_TEMP} ReadINIStr ${L_TEMP} "$G_USERDIR\install.ini" "Settings" "Owner" StrCmp ${L_TEMP} "" section_exit StrCmp ${L_TEMP} $G_WINUSERNAME section_exit MessageBox MB_YESNO|MB_ICONSTOP|MB_DEFBUTTON2 \ "$(PFI_LANG_UN_MBDIFFUSER_1) ('${L_TEMP}') !\ ${MB_NL}${MB_NL}\ $(PFI_LANG_UN_MBNOTFOUND_2)" IDYES section_exit Abort "$(PFI_LANG_UN_ABORT_1)" section_exit: Pop ${L_TEMP} !undef L_TEMP SectionEnd #-------------------------------------------------------------------------- # Uninstaller Section: 'un.Local User Data' # # There may be 'User Data' in the same folder as the PROGRAM files (especially if this is # an upgraded installation) so we must run the 'User Data' uninstaller before we uninstall # POPFile (to restore any email settings changed by the installer). #-------------------------------------------------------------------------- Section "un.Local User Data" UnSecUserData !define L_RESULT $R9 Push ${L_RESULT} IfFileExists "$G_ROOTDIR\popfile.pl" look_for_uninstalluser IfFileExists "$G_ROOTDIR\popfile.exe" look_for_uninstalluser MessageBox MB_YESNO|MB_ICONSTOP|MB_DEFBUTTON2 \ "$(PFI_LANG_UN_MBNOTFOUND_1) '$G_ROOTDIR'.\ ${MB_NL}${MB_NL}\ $(PFI_LANG_UN_MBNOTFOUND_2)" IDYES look_for_uninstalluser Abort "$(PFI_LANG_UN_ABORT_1)" look_for_uninstalluser: IfFileExists "$G_ROOTDIR\uninstalluser.exe" 0 section_exit SetDetailsPrint textonly DetailPrint " " SetDetailsPrint listonly ; Uninstall the 'User Data' in the PROGRAM folder before uninstalling the PROGRAM files ; (note that running 'uninstalluser.exe' with the '_?=dir' option means it will be unable ; to delete itself because the program is NOT automatically relocated to the TEMP folder) HideWindow ExecWait '"$G_ROOTDIR\uninstalluser.exe" _?=$G_ROOTDIR' ${L_RESULT} BringToFront ; If the 'User Data' uninstaller did not return the normal "success" code (e.g. because user ; cancelled the 'User Data' uninstall) then we must retain the user data and uninstalluser.exe StrCmp ${L_RESULT} "0" 0 section_exit ; If any email settings have NOT been restored and the user wishes to try again later, ; the relevant INI file will still exist and we should not remove it or uninstalluser.exe IfFileExists "$G_ROOTDIR\pfi-outexpress.ini" section_exit IfFileExists "$G_ROOTDIR\pfi-outlook.ini" section_exit IfFileExists "$G_ROOTDIR\pfi-eudora.ini" section_exit Delete "$G_ROOTDIR\uninstalluser.exe" section_exit: SetDetailsPrint textonly DetailPrint " " SetDetailsPrint listonly Pop ${L_RESULT} !undef L_RESULT SectionEnd #-------------------------------------------------------------------------- # Uninstaller Section: 'un.Shutdown POPFile' #-------------------------------------------------------------------------- Section "un.Shutdown POPFile" UnSecShutdown !define L_CFG $R9 ; used as file handle !define L_EXE $R8 ; full path of the EXE to be monitored !define L_LNE $R7 ; a line from popfile.cfg !define L_TEMP $R6 !define L_TEXTEND $R5 ; used to ensure correct handling of lines longer than 1023 chars Push ${L_CFG} Push ${L_EXE} Push ${L_LNE} Push ${L_TEMP} Push ${L_TEXTEND} SetDetailsPrint textonly DetailPrint "$(PFI_LANG_UN_PROG_SHUTDOWN)" SetDetailsPrint listonly ; Starting with POPfile 0.21.0 an experimental version of 'popfile-service.exe' was included ; to allow POPFile to be run as a Windows service. Push "POPFile" Call un.PFI_ServiceRunning Pop ${L_TEMP} StrCmp ${L_TEMP} "true" manual_shutdown ; If the POPFile we are to uninstall is still running, one of the EXE files will be 'locked' Push $G_ROOTDIR Call un.PFI_FindLockedPFE Pop ${L_EXE} StrCmp ${L_EXE} "" check_pfi_utils ; The program files we are about to remove are in use so we need to shut POPFile down IfFileExists "$G_USERDIR\popfile.cfg" 0 manual_shutdown ; Use the UI port setting in the configuration file to shutdown POPFile StrCpy $G_GUI "" FileOpen ${L_CFG} "$G_USERDIR\popfile.cfg" r found_eol: StrCpy ${L_TEXTEND} "<eol>" loop: FileRead ${L_CFG} ${L_LNE} StrCmp ${L_LNE} "" ui_port_done StrCmp ${L_TEXTEND} "<eol>" 0 check_eol StrCmp ${L_LNE} "$\n" loop StrCpy ${L_TEMP} ${L_LNE} 10 StrCmp ${L_TEMP} "html_port " 0 check_eol StrCpy $G_GUI ${L_LNE} 5 10 ; Now read file until we get to end of the current line ; (i.e. until we find text ending in <CR><LF>, <CR> or <LF>) check_eol: StrCpy ${L_TEXTEND} ${L_LNE} 1 -1 StrCmp ${L_TEXTEND} "$\n" found_eol StrCmp ${L_TEXTEND} "$\r" found_eol loop ui_port_done: FileClose ${L_CFG} StrCmp $G_GUI "" manual_shutdown Push $G_GUI Call un.PFI_TrimNewlines Call un.PFI_StrCheckDecimal Pop $G_GUI StrCmp $G_GUI "" manual_shutdown DetailPrint "$(PFI_LANG_UN_LOG_SHUTDOWN) $G_GUI" DetailPrint "$(PFI_LANG_TAKE_A_FEW_SECONDS)" Push $G_GUI Call un.PFI... [truncated message content] |