[Greater-commits] r3777 - in branches: . cefic-approved/packaging
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Oct 4 17:38:46 CEST 2011
Author: aheinecke
Date: 2011-10-04 17:38:46 +0200 (Tue, 04 Oct 2011)
New Revision: 3777
Added:
branches/cefic-approved/
branches/cefic-approved/packaging/greater-installer.nsi
branches/cefic-approved/packaging/makeinstaller.py
Removed:
branches/cefic-approved/packaging/greater-installer.nsi
branches/cefic-approved/packaging/makeinstaller.py
Log:
Move Trunk into cefic-approved branch
Copied: branches/cefic-approved (from rev 3770, trunk)
Deleted: branches/cefic-approved/packaging/greater-installer.nsi
===================================================================
--- trunk/packaging/greater-installer.nsi 2011-09-20 13:47:30 UTC (rev 3770)
+++ branches/cefic-approved/packaging/greater-installer.nsi 2011-10-04 15:38:46 UTC (rev 3777)
@@ -1,679 +0,0 @@
-; GREAT-ER Installer
-;(c)2011, Intevation GmbH
-;Authors:
-; Andre Heinecke aheinecke at 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
-
-;-----------------------------
-; 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 at 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 at 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 at 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 at 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 at 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 at 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
- 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
-
- 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 leave 0
- MessageBox MB_YESNO|MB_ICONEXCLAMATION "${productname_short} \
- $(T_AlreadyInstalled)" IDYES leave
- 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}
- ; 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_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}."
Copied: branches/cefic-approved/packaging/greater-installer.nsi (from rev 3773, trunk/packaging/greater-installer.nsi)
Deleted: branches/cefic-approved/packaging/makeinstaller.py
===================================================================
--- trunk/packaging/makeinstaller.py 2011-09-20 13:47:30 UTC (rev 3770)
+++ branches/cefic-approved/packaging/makeinstaller.py 2011-10-04 15:38:46 UTC (rev 3777)
@@ -1,202 +0,0 @@
-# GREAT-ER Installer
-#(c)2011, Intevation GmbH
-#Authors:
-# Andre Heinecke aheinecke at 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.
-
-# Execute this script from the toplevel GREATER directory
-
-import time
-import os
-import run
-import os.path
-import compileall
-
-
-ADMINTOOL_PATH = "../bin"
-
-INSTALLER_OPTIONS = {
- "executable" : "GREAT-ER.pyw",
- "company" : "Intevation GmbH",
- "productname" : "GREAT-ER",
- "setupname" : "Greater-Installer",
- "license" : os.path.abspath(os.path.join("GREAT-ER", "COPYING")),
- "copyright" : "Copyright (c) %s Intevation GmbH" % time.strftime("%Y"),
- "productname_short" : "GREAT-ER",
- "description" : ("Geo-referenced Regional Exposure "
- "Assessment Tool for European Rivers"),
- "version_number" : "3.0.0.0",
- "version_date" : time.strftime("%Y-%m-%d-%H-%M")}
-
-
-INSTALLER_OPTIONS["setupname" ] = INSTALLER_OPTIONS[ "setupname" ] + \
- "-%s.exe" % time.strftime("%Y-%m-%d-%H-%M")
-
-def traverse(directory, whitelist = lambda f: True):
- '''
- Traverse through a directory tree and return every
- dirname and filename that the function whitelist returns as true
- '''
- dirs = [ directory ]
- while dirs:
- mypath = dirs.pop()
- for f in os.listdir(mypath):
- f = os.path.join(mypath, f)
- if os.path.isdir(f):
- dirs.append(f)
- elif os.path.isfile(f) and whitelist(f):
- yield f
-
-def generate_files(dirs, in_name, un_name, whitelist = lambda f: True, keep_subdirs = True):
- curoutpath = None
- dirlist = []
- fptr, unptr = (open(in_name, "w"), open(un_name, "w"))
- for dir in dirs:
- absdir = os.path.abspath(dir)
- if not keep_subdirs:
- dir = ""
- for fname in traverse(absdir, whitelist):
- if os.path.dirname(fname) != curoutpath:
- curoutpath = os.path.dirname(fname)
- fptr.write('SetOutPath "%s"\r\n' % \
- curoutpath.replace(absdir, "$INSTDIR\%s" % dir))
- dirlist.insert(0, curoutpath.replace(absdir,
- "$INSTDIR\%s" % dir))
- fptr.write('File "%s"\r\n' % fname)
- if dir:
- unptr.write('Delete "%s"\r\n' % \
- fname.replace(absdir, "$INSTDIR\%s" % dir))
- else:
- unptr.write('Delete "%s"\r\n' % \
- fname.replace(absdir, "$INSTDIR"))
- dirlist.sort(key=lambda x: len(x))
- dirlist.reverse()
- for dir in dirlist:
- unptr.write('RMDir "%s"\r\n' % dir)
- unptr.write('RMDir "$INSTDIR"')
- fptr.close()
- unptr.close()
- return (os.path.abspath(in_name), os.path.abspath(un_name))
-
-def generate_administration():
- admintool_files = ["greater.dtd", "greater.xsl", "administration.pdf"]
- cmd = ["depends",
- "/c", # Console mode
- "/a:1", # Expand dependencies = on
- "/oc:admintool-dependencies.txt"]
- cmd.append(os.path.abspath(os.path.join(ADMINTOOL_PATH,
- "Administration.exe")))
- try:
- run.call(cmd, shell=True)
- except run.SubprocessError , s:
- # Depends likes to return with nonzero
- pass
-
- with open("admintool-dependencies.txt", "r") as fptr:
- for line in fptr:
- if line.startswith("Status"): continue
- admintool_files.append(line.split(",")[1].lower().replace('"',''))
- outfiles = generate_files([ADMINTOOL_PATH], "admin-in.nsi", "admin-un.nsi",
- lambda f: os.path.basename(f).lower() in admintool_files,
- keep_subdirs=False)
- prefix_subdir("Administration", outfiles)
- return outfiles
-
-def prefix_subdir(prefix, files):
- for fname in files:
- output = ""
- with open(fname, "r") as fptr:
- for line in fptr:
- output += line.replace("$INSTDIR", "$INSTDIR\%s" % prefix)
- with open(fname, "w") as fptr:
- fptr.write(output)
-
-def generate_clientfiles():
- instdirs = ["GREAT-ER", "GREAT-ERModel", "GREAT-ER-DB"]
- for idir in instdirs:
- compileall.compile_dir(idir, quiet = True)
- def whitelist(f):
- for bad in [".svn", "test_", ".log"]:
- if bad in f:
- return False
- if os.path.basename(f).startswith("."):
- return False
- if "GREAT-ER-DB" in f and not "GreaterDB" in f:
- return False
- return True
- return generate_files(instdirs, "client-in.nsi", "client-un.nsi", whitelist)
-
-def generate_sediment():
- instdirs = ["GREAT-ER-Sediment"]
- for idir in instdirs:
- compileall.compile_dir(idir, quiet = True)
- def whitelist(f):
- for bad in [".svn", "test_", ".log"]:
- if bad in f:
- return False
- if os.path.basename(f).startswith("."):
- return False
- if "GREAT-ER-DB" in f and not "GreaterDB" in f:
- return False
- return True
- return generate_files(instdirs, "sediment-in.nsi", "sediment-un.nsi", whitelist)
-
-def generate_serverfiles():
-
- pass
-
-def generate_usf():
- instdirs = ["GREAT-ER-USF"]
- for idir in instdirs:
- compileall.compile_dir(idir, quiet = True)
- def whitelist(f):
- for bad in [".svn", "test_", ".log"]:
- if bad in f:
- return False
- if os.path.basename(f).startswith("."):
- return False
- if "GREAT-ER-DB" in f and not "GreaterDB" in f:
- return False
- return True
- return generate_files(instdirs, "usf-in.nsi", "usf-un.nsi", whitelist)
-
-def main():
- (INSTALLER_OPTIONS["client-in"],
- INSTALLER_OPTIONS["client-un"]) = generate_clientfiles()
- (INSTALLER_OPTIONS["admin-in"],
- INSTALLER_OPTIONS["admin-un"]) = generate_administration()
- (INSTALLER_OPTIONS["sediment-in"],
- INSTALLER_OPTIONS["sediment-un"]) = generate_sediment()
- (INSTALLER_OPTIONS["usf-in"],
- INSTALLER_OPTIONS["usf-un"]) = generate_usf()
-# INSTALLER_OPTIONS["allfiles"],
-# INSTALLER_OPTIONS["un-allfiles"] = generate_allfiles()
-
- cmd = ["makensis"]
- for key in INSTALLER_OPTIONS:
- cmd.append('/D%s=%s' % (key, INSTALLER_OPTIONS[key]))
- cmd.append(os.path.join("packaging", "greater-installer.nsi"))
- print "Calling NSIS with command: \n %s " % " ".join(cmd)
- try:
- output = run.capture_output(cmd, env = os.environ.copy(), shell=True)
- for line in output.splitlines():
- if line.startswith("warning:"):
- print line
- except run.SubprocessError, e:
- print e.output[:-20]
-
-if __name__ == '__main__':
- main()
Copied: branches/cefic-approved/packaging/makeinstaller.py (from rev 3773, trunk/packaging/makeinstaller.py)
More information about the Greater-commits
mailing list