; GREAT-ER Installer ;(c)2011, Intevation GmbH ;Authors: ; Andre Heinecke aheinecke@intevation.de ; ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License version 2, ; or, at your option, any later version as published by the Free ; Software Foundation ; ; This program 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 this program; if not, write to the Free Software ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ; ;-------------------------------- ; Includes ; Modern UI !include "MUI.nsh" ; Add (custom) plugin dir !addplugindir plugins ;-------------------------------- ; Variable declarations Var POSTGRESQL_INSTALLED Var SEDIMENT_SELECTED Var USF_SELECTED Var PYTHON_PATH ;-------------------------------- ;Version Information (for installer file properties) VIProductVersion "${version_number}" ;needs integer format: x.x.x.x VIAddVersionKey "ProductName" "${productname_short}" VIAddVersionKey "Comments" "${productname_short} is Free Software" VIAddVersionKey "CompanyName" "${company}" VIAddVersionKey "LegalTrademarks" "" VIAddVersionKey "LegalCopyright" "${copyright}" VIAddVersionKey "FileDescription" "${description}" VIAddVersionKey "FileVersion" "${version_number} (build ${version_date})" ;-------------------------------- ; General ; Define Name, File and Installdir of Installer Name "${productname}" OutFile "${setupname}" InstallDir "$PROGRAMFILES\${productname_short}" InstType "Single User" InstType "Client Only" InstType "Server Only" ;-------------------------------- ;Interface Settings !define MUI_ABORTWARNING BrandingText "GREAT-ER III - PostgreSQL" ; MUI Settings / Header !define MUI_WELCOMEPAGE_TITLE "Welcome to the installation of GREAT-ER III - PostgreSQL" !define MUI_WELCOMEPAGE_TEXT "This Installer will install \r\n\ The Geo-referenced Regional Exposure Assesment Tool for European Rivers\r\n\ Version ${version_number}-${version_date} using the Postges SQL Database backend." !define MUI_HEADERIMAGE_BITMAP "" !define MUI_COMPONENTSPAGE_TEXT_TOP "Please select installation type" !define MUI_WELCOMEFINISHPAGE_BITMAP "ressources\welcome_left.bmp" !define MUI_ICON "ressources\greater.ico" ;-------------------------------- ;Pages !define MUI_PAGE_CUSTOMFUNCTION_SHOW PrintNonAdminWarning !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE ${license} !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY Page custom CustomPageOptions !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH !define MUI_PAGE_CUSTOMFUNCTION_SHOW un.PrintNonAdminWarning !insertmacro MUI_UNPAGE_WELCOME !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_COMPONENTS !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_FINISH ;-------------------------------- ;Supported Languages !insertmacro MUI_LANGUAGE "English" ;------------------------------- ;Reserve Files !insertmacro MUI_RESERVEFILE_LANGDLL !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ReserveFile "installer-options.ini" ;-------------------------------- ;Installer Sections Section "PostgreSQL 9.0.4" SecPostgreSQL Banner::show /NOUNLOAD /set 76 "Installing..." "PostgreSQL 9.0.4" "" SetOutPath "$TEMP" File "postgresql-9.0.4-1-windows.exe" ; Should be more generalized DetailPrint "Installing PostgreSQL..." ExecWait '"$TEMP\postgresql-9.0.4-1-windows.exe" --mode unattended --prefix "$INSTDIR\postgres9" \ --superpassword greater --superaccount greater \ --serviceaccount greater-db --servicepassword greater \ --datadir "$INSTDIR\GREAT-ER-DB\database" --create_shortcuts 0 \ --servicename greater_postgres_server' $0 Delete "$TEMP\postgresql-9.0.4-1-windows.exe" banner::destroy ;-------------------------------- ; Install default database ; Set the temporary PGPASSWORD variable for this process and it's children System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("PGPASSWORD", "greater").r0' SetOutPath "$TEMP" File "defaultdata\defaultdb.backup" File "defaultdata\10_create_users.sql" File "defaultdata\90_grant_access.sql" DetailPrint "Creating default GREAT-ER datasets" ExecDos::exec '"$INSTDIR\postgres9\bin\pg_restore.exe" -C -O -d postgres -U greater \ "$TEMP\defaultdb.backup"' "" "$TEMP\greater_insert.log" ExecDos::exec '"$INSTDIR\postgres9\bin\psql" -d greater -U greater -f \ "$TEMP\10_create_users.sql"' "" "$TEMP\greater_insert.log" ExecDos::exec '"$INSTDIR\postgres9\bin\psql" -d greater -U greater -f \ "$TEMP\90_grant_access.sql"' "" "$TEMP\greater_insert.log" ; Also the sediment database? CALL CheckIfSedimentSelected StrCmp $SEDIMENT_SELECTED "no" no_sediment File "defaultdata\sedimentdb.backup" ExecDos::exec '"$INSTDIR\postgres9\bin\pg_restore.exe" -C -O -d postgres -U greater \ "$TEMP\sedimentdb.backup"' "" "$TEMP\greater_sediment_insert.log" ExecDos::exec '"$INSTDIR\postgres9\bin\psql" -d greater-sediment -U greater -f \ "$TEMP\10_create_users.sql"' "" "$TEMP\greater_sediment_insert.log" ExecDos::exec '"$INSTDIR\postgres9\bin\psql" -d greater-sediment -U greater -f \ "$TEMP\90_grant_access.sql"' "" "$TEMP\greater_sediment_insert.log" Delete "$TEMP\sedimentdb.backup" no_sediment: CALL CheckIfUSFSelected StrCmp $USF_SELECTED "no" no_usf File "defaultdata\usfdb.backup" ExecDos::exec '"$INSTDIR\postgres9\bin\pg_restore.exe" -C -O -d postgres -U greater \ "$TEMP\usfdb.backup"' "" "$TEMP\greater_usf_insert.log" ExecDos::exec '"$INSTDIR\postgres9\bin\psql" -d greater-usf -U greater -f \ "$TEMP\10_create_users.sql"' "" "$TEMP\greater_usf_insert.log" ExecDos::exec '"$INSTDIR\postgres9\bin\psql" -d greater-usf -U greater -f \ "$TEMP\90_grant_access.sql"' "" "$TEMP\greater_usf_insert.log" Delete "$TEMP\usfdb.backup" no_usf: Delete "$TEMP\defaultdb.backup" Delete "$TEMP\10_create_users.sql" Delete "$TEMP\90_grant_access.sql" ; Database should now be ready SectionEnd Section "Python 2.7.2" SecPython Banner::show /NOUNLOAD /set 76 "Installing..." "Python 2.7.2" "" SetOutPath "$TEMP" File "python-2.7.2.msi" ; Should be more generalized DetailPrint "Installing Python..." ExecWait '"msiexec" /i $TEMP\python-2.7.2.msi /quiet TARGETDIR="$INSTDIR\Python2.7"' $0 Delete "$TEMP\python-2.7.2.msi" StrCpy $PYTHON_PATH '"$INSTDIR\Python2.7\pythonw"' banner::destroy SectionEnd ;--------------------------- ; General Section - Included in all installations Section "" ; Create uninstaller WriteUninstaller "$INSTDIR\Uninstall.exe" SetOutPath "$TEMP" DetailPrint "Installing Microsoft Visual C Runtime Libraries..." File "vcredist_x86.exe" File "vcredist-80_x86.exe" ExecWait '$TEMP\vcredist_x86.exe /q' $0 ExecWait '$TEMP\vcredist-80_x86.exe /q' $0 Delete "$TEMP\vcredist_x86.exe" Delete "$TEMP\vcredist-80_x86.exe" ; Store installation folder WriteRegStr HKLM "Software\${productname_short}" "" $INSTDIR ; Create Registry keys WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" "DisplayName" "${productname_short} ${version_date}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" "Displayversion_number" "${version_number}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" "Displayversion_date" "${version_date}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" "UninstallString" '"$INSTDIR\uninstall.exe"' WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" "NoModify" 1 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" "NoRepair" 1 SectionEnd ;--------------------------- ; Admintool Section Section "Administration Tool" admin_section_id SetOutPath "$INSTDIR" !include ${admin-in} ; Set Path to $PROFILE SetOutPath "%HOMEDRIVE%%HOMEPATH%" # 'all users' shell folder is used (for $DESKTOP, $SMPROGRAMS, $QUICKLAUNCH,...) !insertmacro MUI_INSTALLOPTIONS_READ $R0 "installer-options.ini" \ "Field 4" "State" SetShellVarContext all IntCmp $R0 0 just_current_user all_users just_current_user: SetShellVarContext current all_users: # ** Start menu ** # Delete old Start menu entries. RMDir /R "$SMPROGRAMS\${productname_short} ${version_number}" # Check if the start menu entries where requested. !insertmacro MUI_INSTALLOPTIONS_READ $R0 "installer-options.ini" \ "Field 2" "State" IntCmp $R0 0 no_start_menu # Create new Start menu entries CreateDirectory "$SMPROGRAMS\${productname}" CreateShortCut "$SMPROGRAMS\${productname}\GREAT-ER Administration.lnk" '"$INSTDIR\Administration\Administration.exe"' no_start_menu: Return SectionEnd ;-------------------------- ; Greater pre processing Section Section "Greater Preprocessing" gpp_section_id SetOutPath "$INSTDIR" !include ${gpp-in} ; Set Path to $PROFILE SetOutPath "%HOMEDRIVE%%HOMEPATH%" # 'all users' shell folder is used (for $DESKTOP, $SMPROGRAMS, $QUICKLAUNCH,...) !insertmacro MUI_INSTALLOPTIONS_READ $R0 "installer-options.ini" \ "Field 4" "State" SetShellVarContext all IntCmp $R0 0 just_current_user all_users just_current_user: SetShellVarContext current all_users: # ** Start menu ** # Delete old Start menu entries. RMDir /R "$SMPROGRAMS\${productname_short} ${version_number}" # Check if the start menu entries where requested. !insertmacro MUI_INSTALLOPTIONS_READ $R0 "installer-options.ini" \ "Field 2" "State" IntCmp $R0 0 no_start_menu # Create new Start menu entries CreateDirectory "$SMPROGRAMS\${productname}" CreateShortCut "$SMPROGRAMS\${productname}\${productname_short} USF.lnk" \ "$PYTHON_PATH" '"$INSTDIR\greater-pre-processing\upload-catchment.py"' \ "$INSTDIR\GREAT-ER\Resources\greater2.ico" no_start_menu: Return SectionEnd ;----------------------------- ; Client sections Section "Client (USF)" usf_section_id !include ${usf-in} ; Set Path to $PROFILE SetOutPath "%HOMEDRIVE%%HOMEPATH%" # 'all users' shell folder is used (for $DESKTOP, $SMPROGRAMS, $QUICKLAUNCH,...) !insertmacro MUI_INSTALLOPTIONS_READ $R0 "installer-options.ini" \ "Field 4" "State" SetShellVarContext all IntCmp $R0 0 just_current_user all_users just_current_user: SetShellVarContext current all_users: # ** Start menu ** # Delete old Start menu entries. RMDir /R "$SMPROGRAMS\${productname_short} ${version_number}" # Check if the start menu entries where requested. !insertmacro MUI_INSTALLOPTIONS_READ $R0 "installer-options.ini" \ "Field 2" "State" IntCmp $R0 0 no_start_menu # Create new Start menu entries CreateDirectory "$SMPROGRAMS\${productname}" CreateShortCut "$SMPROGRAMS\${productname}\${productname_short} USF.lnk" \ "$PYTHON_PATH" '"$INSTDIR\GREAT-ER-USF\GREAT-ER\${executable}" "greater/greater@greater-usf"' \ "$INSTDIR\GREAT-ER\Resources\greater2.ico" no_start_menu: # ** Desktop Icon ** # Delete old Desktop link Delete "$DESKTOP\${productname_short}.lnk" # Check if the desktop entries where requested. !insertmacro MUI_INSTALLOPTIONS_READ $R0 "installer-options.ini" \ "Field 3" "State" IntCmp $R0 0 no_desktop # Create new Desktop link CreateShortCut "$DESKTOP\${productname_short} USF.lnk" \ "$PYTHON_PATH" '"$INSTDIR\GREAT-ER-USF\GREAT-ER\${executable}" \ "greater/greater@greater-usf"' \ "$INSTDIR\GREAT-ER-USF\GREAT-ER\Resources\greater2.ico" no_desktop: Return SectionEnd Section "Client (Sediment Model)" sediment_section_id !include ${sediment-in} ; Set Path to $PROFILE SetOutPath "%HOMEDRIVE%%HOMEPATH%" # 'all users' shell folder is used (for $DESKTOP, $SMPROGRAMS, $QUICKLAUNCH,...) !insertmacro MUI_INSTALLOPTIONS_READ $R0 "installer-options.ini" \ "Field 4" "State" SetShellVarContext all IntCmp $R0 0 just_current_user all_users just_current_user: SetShellVarContext current all_users: # ** Start menu ** # Delete old Start menu entries. RMDir /R "$SMPROGRAMS\${productname_short} ${version_number}" # Check if the start menu entries where requested. !insertmacro MUI_INSTALLOPTIONS_READ $R0 "installer-options.ini" \ "Field 2" "State" IntCmp $R0 0 no_start_menu # Create new Start menu entries CreateDirectory "$SMPROGRAMS\${productname}" CreateShortCut "$SMPROGRAMS\${productname}\${productname_short} Sediment.lnk" \ "$PYTHON_PATH" '"$INSTDIR\GREAT-ER-Sediment\GREAT-ER\${executable}" \ "greater/greater@greater-sediment"' \ "$INSTDIR\GREAT-ER\Resources\greater2.ico" no_start_menu: # ** Desktop Icon ** # Delete old Desktop link Delete "$DESKTOP\${productname_short}.lnk" # Check if the desktop entries where requested. !insertmacro MUI_INSTALLOPTIONS_READ $R0 "installer-options.ini" \ "Field 3" "State" IntCmp $R0 0 no_desktop # Create new Desktop link CreateShortCut "$DESKTOP\${productname_short} Sediment.lnk" \ "$PYTHON_PATH" '"$INSTDIR\GREAT-ER-Sediment\GREAT-ER\${executable}" \ "greater/greater@greater-sediment"' \ "$INSTDIR\GREAT-ER-Sediment\GREAT-ER\Resources\greater2.ico" no_desktop: Return SectionEnd Section "GREAT-ER Desktop" client_section_id ; Include the input files ; package all files, recursively, preserving attributes ; assume files are in the correct places !include ${client-in} ; Set Path to $PROFILE SetOutPath "%HOMEDRIVE%%HOMEPATH%" # 'all users' shell folder is used (for $DESKTOP, $SMPROGRAMS, $QUICKLAUNCH,...) !insertmacro MUI_INSTALLOPTIONS_READ $R0 "installer-options.ini" \ "Field 4" "State" SetShellVarContext all IntCmp $R0 0 just_current_user all_users just_current_user: SetShellVarContext current all_users: # ** Start menu ** # Delete old Start menu entries. RMDir /R "$SMPROGRAMS\${productname_short} ${version_number}" # Check if the start menu entries where requested. !insertmacro MUI_INSTALLOPTIONS_READ $R0 "installer-options.ini" \ "Field 2" "State" IntCmp $R0 0 no_start_menu # Create new Start menu entries CreateDirectory "$SMPROGRAMS\${productname}" CreateShortCut "$SMPROGRAMS\${productname}\${productname_short}.lnk" \ "$PYTHON_PATH" '"$INSTDIR\GREAT-ER\${executable}" greater/greater@greater' \ "$INSTDIR\GREAT-ER\Resources\greater2.ico" no_start_menu: # ** Desktop Icon ** # Delete old Desktop link Delete "$DESKTOP\${productname_short}.lnk" # Check if the desktop entries where requested. !insertmacro MUI_INSTALLOPTIONS_READ $R0 "installer-options.ini" \ "Field 3" "State" IntCmp $R0 0 no_desktop # Create new Desktop link CreateShortCut "$DESKTOP\${productname_short}.lnk" \ "$PYTHON_PATH" '"$INSTDIR\GREAT-ER\${executable}" greater/greater@greater' \ "$INSTDIR\GREAT-ER\Resources\greater2.ico" no_desktop: Return SectionEnd ;-------------------------------- ;Install Functions Function ".onInit" InstTypeSetText 0 "Full (recommended)" InstTypeSetText 1 "Client only (no Database)" InstTypeSetText 2 "Server only" SectionSetInstTypes ${usf_section_id} 1 SectionSetInstTypes ${sediment_section_id} 1 SectionSetInstTypes ${client_section_id} 3 SectionSetInstTypes ${SecPostgreSQL} 5 SectionSetInstTypes ${SecPython} 3 SectionSetInstTypes ${admin_section_id} 5 SectionSetInstTypes ${gpp_section_id} 1 SectionSetFlags ${client_section_id} 1 SectionSetFlags ${SecPostgreSQL} 1 SectionSetFlags ${SecPython} 1 SectionSetFlags ${admin_section_id} 1 SectionSetFlags ${usf_section_id} 1 SectionSetFlags ${sediment_section_id} 1 SectionSetFlags ${gpp_section_id} 1 SectionSetSize ${SecPostgreSQL} "207330" SectionSetSize ${SecPython} "55279" !insertmacro MUI_INSTALLOPTIONS_EXTRACT "installer-options.ini" call CheckExistingVersion CALL DetectPostgreSQL FunctionEnd Function DetectPostgreSQL ClearErrors readregstr $1 HKLM "SOFTWARE\PostgreSQL\Installations\postgresql-9.0" "Version" IfErrors done !insertmacro UnSelectSection ${SecPostgreSQL} StrCpy $POSTGRESQL_INSTALLED "yes" done: FunctionEnd ;Check whether application has already been installed. Function CheckExistingVersion ClearErrors Push $0 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" "UninstallString" IfErrors overwrite 0 MessageBox MB_YESNO|MB_ICONEXCLAMATION "${productname_short} \ $(T_AlreadyInstalled)" IDYES leave IDNO overwrite leave: ExecWait '$0 _?=$INSTDIR' overwrite: FunctionEnd # PrintNonAdminWarning # Check whether the current user is in the Administrator group or an # OS version without the need for an Administrator is in use. Print a # diagnostic if this is not the case and abort installation. Function PrintNonAdminWarning ClearErrors UserInfo::GetName IfErrors leave Pop $0 UserInfo::GetAccountType Pop $1 StrCmp $1 "Admin" leave +1 MessageBox MB_OK|MB_ICONEXCLAMATION "$(T_AdminNeeded)" Quit leave: FunctionEnd ; Custom Page for add Desktop, Startmenu and Quick Launch links Function CustomPageOptions !insertmacro MUI_HEADER_TEXT "$(T_InstallOptions)" "$(T_InstallOptLinks)" # Note that the default selection is done in the ini file. !insertmacro MUI_INSTALLOPTIONS_WRITE "installer-options.ini" \ "Field 1" "Text" "Please select where ${productname_short} should place shortcuts:" !insertmacro MUI_INSTALLOPTIONS_WRITE "installer-options.ini" \ "Field 2" "Text" "Start Menu" !insertmacro MUI_INSTALLOPTIONS_WRITE "installer-options.ini" \ "Field 3" "Text" "Desktop" !insertmacro MUI_INSTALLOPTIONS_WRITE "installer-options.ini" \ "Field 4" "Text" "Install Shortcuts for all users" !insertmacro MUI_INSTALLOPTIONS_DISPLAY "installer-options.ini" FunctionEnd ; AbortDisplayLogOption - give the user the option to display an error log ; and abort the installation. ; R8 - Error message ; R9 - Log filename; Function AbortDisplayLogOption ; Display a message box with the error MessageBox MB_YESNO|MB_ICONSTOP "$R8$\r$\n$\r$\nDo you wont to open '$R9'?" IDYES adlo_show_error_log ; If the user selects NO, simply abort the installation Abort "$R8" Return adlo_show_error_log: ;Otherwise show the error log first ExecShell "open" "$R9" Abort "$R8" Return FunctionEnd Function CheckIfSedimentSelected SectionGetFlags ${sediment_section_id} $R0 StrCpy $SEDIMENT_SELECTED "no" IntCmp $R0 0 no_sediment StrCpy $SEDIMENT_SELECTED "yes" no_sediment: FunctionEnd Function CheckIfUSFSelected SectionGetFlags ${usf_section_id} $R0 StrCpy $USF_SELECTED "no" IntCmp $R0 0 no_sediment StrCpy $USF_SELECTED "yes" no_sediment: FunctionEnd ;--------------------- ; Disable the next button on the components page as long as there ; are no sections selected ; Also make sure that the greater desktop is enabled as soon as ; at least sediment or usf is enabled Function .onSelChange ; Push $0 ; Push $1 ; SectionGetFlags ${sediment_section_id} $1 ; IntOp $1 ${SF_SELECTED} & $1 ; IntOp $0 $1 | $0 ; SectionGetFlags ${usf_section_id} $1 ; IntOp $1 ${SF_SELECTED} & $1 ; IntOp $0 $1 | $0 ; SectionGetFlags ${client_section_id} $1 ; IntOp $0 $1 | $0 ; SectionSetFlags ${client_section_id} $0 ; Pop $1 ; Pop $0 Push $0 Push $1 SectionGetFlags ${SecPython} $0 IntOp $0 ${SF_SELECTED} & $0 SectionGetFlags ${SecPostgreSQL} $1 IntOp $1 ${SF_SELECTED} & $1 IntOp $0 $1 | $0 SectionGetFlags ${sediment_section_id} $1 IntOp $1 ${SF_SELECTED} & $1 IntOp $0 $1 | $0 SectionGetFlags ${usf_section_id} $1 IntOp $1 ${SF_SELECTED} & $1 IntOp $0 $1 | $0 SectionGetFlags ${client_section_id} $1 IntOp $1 ${SF_SELECTED} & $1 IntOp $0 $1 | $0 SectionGetFlags ${admin_section_id} $1 IntOp $1 ${SF_SELECTED} & $1 IntOp $0 $1 | $0 GetDlgItem $1 $HWNDPARENT 1 EnableWindow $1 $0 Pop $1 Pop $0 FunctionEnd ;-------------------------------- ;Uninstaller Section "un.Python" Banner::show /NOUNLOAD /set 76 "Uninstalling Python..." SetOutPath "$TEMP" File "python-2.7.2.msi" ExecWait '"msiexec" /uninstall $TEMP\python-2.7.2.msi' Delete "$TEMP\python-2.7.2.msi" Banner::destroy SectionEnd Section "un.PostgreSQL" UnSecPostgreSQL Banner::show /NOUNLOAD /set 76 "Uninstalling PostgreSQL..." ; TODO find path from registry and uninstall ExecDos::exec '"$INSTDIR\postgres9\bin\pg_ctl.exe" stop -D "$INSTDIR\GREAT-ER-DB\database"' ExecWait '"$INSTDIR\postgres9\uninstall-postgresql.exe" --mode unattended' Banner::destroy RMDIR "$INSTDIR\postgres9\bin" RMDIR "$INSTDIR\postgres9" RMDIR "$INSTDIR" MessageBox MB_YESNO|MB_ICONQUESTION "Do you also want to delete contents of your \ GREAT-ER Database?" \ IDYES deletedb IDNO no deletedb: RMDIR /r "$INSTDIR\GREAT-ER-DB\database" no: SectionEnd Section "un." !include ${client-un} !include ${usf-un} !include ${sediment-un} !include ${admin-un} !include ${gpp-un} ; Delete Registry keys DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${productname_short}" DeleteRegKey HKLM "Software\${productname_short}" ; Delete Shortcuts SetShellVarContext all RMDir /R "$SMPROGRAMS\${productname}" Delete "$DESKTOP\${productname_short}.lnk" Delete "$QUICKLAUNCH\${productname_short}.lnk" SetShellVarContext current RMDir /R "$SMPROGRAMS\${productname}" Delete "$DESKTOP\${productname_short}.lnk" Delete "$QUICKLAUNCH\${productname_short}.lnk" ; Cleanup RMDir /R "$INSTDIR\GREAT-ER" RMDir /R "$INSTDIR\GREAT-ER-Sediment" RMDir /R "$INSTDIR\GREAT-ER-USF" RMDir "$INSTDIR\GREAT-ER-DB" RMDir "$INSTDIR\Administration" Delete "$INSTDIR\Uninstall.exe" RMDir "$INSTDIR" SectionEnd ;-------------------------------- ;Uninstall Functions Function un.onInit CALL un.DetectPostgreSQL FunctionEnd # PrintNonAdminWarning (uninstall) Function un.DetectPostgreSQL ClearErrors readregstr $1 HKLM "SOFTWARE\PostgreSQL\Installations\postgresql-9.0" "Version" IfErrors noexist done noexist: !insertmacro UnSelectSection ${UnSecPostgreSQL} !insertmacro SetSectionFlag ${UnSecPostgreSQL} ${SF_RO} done: FunctionEnd Function un.PrintNonAdminWarning ClearErrors UserInfo::GetName IfErrors leave Pop $0 UserInfo::GetAccountType Pop $1 StrCmp $1 "Admin" leave +1 MessageBox MB_OK|MB_ICONEXCLAMATION "$(T_AdminNeeded_uninstall)" Quit leave: FunctionEnd ;--------------------------- ; Language Strings ;--------------------------- !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${SecPostgreSQL} "Installs the PostgreSQL 9.0.4 Database with \ basic ${productname_short} datasets." !insertmacro MUI_DESCRIPTION_TEXT ${client_section_id} "Installs the ${productname_short} \ client. $\r$\n With the CEFIC approved models from GREAT-ER II $\r$\n" !insertmacro MUI_DESCRIPTION_TEXT ${usf_section_id} "Installs the client together with \ additional Models:$\r$\n Lakes $\r$\n Metals" !insertmacro MUI_DESCRIPTION_TEXT ${sediment_section_id} "Installs the client together with \ additional Models:$\r$\n Sediment" !insertmacro MUI_DESCRIPTION_TEXT ${admin_section_id} "Installs the Administration tool for the \ GREAT-ER Database." !insertmacro MUI_DESCRIPTION_TEXT ${SecPython} "Installs Python Version 2.7.2 necessary for \ GREAT-ER" !insertmacro MUI_DESCRIPTION_TEXT ${gpp_section_id} "Installs the catchment preprocessing and \ upload tools." !insertmacro MUI_FUNCTION_DESCRIPTION_END # From Function CheckExistingVersion LangString T_AlreadyInstalled ${LANG_ENGLISH} \ "has already been installed.$\r$\n \ It is recommended that you uninstall \ it before continuing the installation of:$\r$\n\ ${productname_short} ${version_date} $\r$\n\ Do you want to uninstall the old Version of ${productname_short} ?" # From Custom Welcome Page # # Title LangString T_Aboutversion_date ${LANG_ENGLISH} \ "Release date: ${version_date}" # From Function CustomPageOptions # English LangString T_InstallOptions ${LANG_ENGLISH} "Install Options" LangString T_InstallOptLinks ${LANG_ENGLISH} "Shortcut Options" LangString T_InstOptLabelA ${LANG_ENGLISH} "Please select where ${productname_short} shall install links:" LangString T_InstOptFieldA ${LANG_ENGLISH} "Start Menu" LangString T_InstOptFieldB ${LANG_ENGLISH} "Desktop" LangString T_InstOptFieldC ${LANG_ENGLISH} "Quick Launch Bar" # From Function (un.)PrintNonAdminWarning LangString T_AdminNeeded ${LANG_ENGLISH} \ "Warning: Administrator permissions required for the installation of ${productname_short}." LangString T_AdminNeeded_uninstall ${LANG_ENGLISH} \ "Warning: Administrator permissions required for the uninstallation of ${productname_short}."