# HG changeset patch # User Dan # Date 1247321252 14400 # Node ID 0cce88c7cf7c4ed51b4cebf989fef125a2fa782c # Parent 0c0d5dadfca3c3bf8e636141a8e99837e1f731ca Added Makefile diff -r 0c0d5dadfca3 -r 0cce88c7cf7c Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Makefile Sat Jul 11 10:07:32 2009 -0400 @@ -0,0 +1,5 @@ +EXPERIENCEUI=/public/exui/Contrib/ExperienceUI +ENANOHG=/var/www/html/enano-1.1/repo + +all: + makensis "-DXPUI_SYSDIR=$(EXPERIENCEUI)" "-DENANO_ROOT=$(ENANOHG)" enano-bundle.nsi diff -r 0c0d5dadfca3 -r 0cce88c7cf7c enano-bundle.nsi --- a/enano-bundle.nsi Wed May 27 01:17:11 2009 -0400 +++ b/enano-bundle.nsi Sat Jul 11 10:07:32 2009 -0400 @@ -8,6 +8,7 @@ !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_ROOT_KEY "HKLM" !define PRODUCT_SHORTNAME "enanocms" +; !define UNINSTALL_DEBUG !ifndef ENANO_ROOT !define ENANO_ROOT "Q:\enano-1.1\repo" @@ -38,6 +39,7 @@ Var site_copyright Var url_scheme Var start_with +Var skip_install !include "inst-resources\bitnamiutils.nsh" !include "inst-resources\dbal.nsh" @@ -49,6 +51,11 @@ !include "inst-resources\applist.nsh" Function .onInit + !ifdef UNINSTALL_DEBUG + WriteUninstaller "$EXEDIR\uninstall.exe" + MessageBox MB_OKCANCEL "Uninstaller written. OK to run installer, Cancel to quit" IDOK +2 + Abort + !endif Call BNSetWAMPInstalledFlag Call BNSetWAPPInstalledFlag @@ -75,6 +82,7 @@ !define XPUI_BRANDINGTEXT_COLOR_FG "b6d9ff" !define XPUI_BRANDINGTEXT_COLOR_BG "4c5b6b" !define XPUI_FASTERSKINNING +!define XPUI_UNINSTALLER ; MUI 1.67 compatible / XPUI 1.11 (2.0pre) compatible ------ !ifndef XPUI_SYSDIR @@ -88,10 +96,14 @@ !define MUI_UNICON "inst-resources\generic-uninstall.ico" !include "WinMessages.nsh" +; +; INSTALL PAGES +; + ; Welcome page !insertmacro XPUI_PAGE_WELCOME2 ; License page -!insertmacro MUI_PAGE_LICENSE "licenses\GPL.txt" +!insertmacro XPUI_PAGE_LICENSE "licenses\GPL.txt" ; Stack selection - automatic unless both stacks are installed !include "pages\StackSelect.nsi" ; Database credentials entry @@ -101,9 +113,9 @@ ; User credentials page !include "pages\Login.nsi" ; Components page -!insertmacro MUI_PAGE_COMPONENTS +!insertmacro XPUI_PAGE_COMPONENTS ; Instfiles page -!insertmacro MUI_PAGE_INSTFILES +!insertmacro XPUI_PAGE_INSTFILES ; Finish page !define XPUI_FINISHPAGE_RUN !define XPUI_FINISHPAGE_CHECKBOX_RUN "Go to my new $(^Name) website now" @@ -115,8 +127,14 @@ !insertmacro XPUI_PAGE_ABORT -; Uninstaller pages -!insertmacro MUI_UNPAGE_INSTFILES +; +; UNINSTALL PAGES +; + +!insertmacro XPUI_PAGEMODE_UNINST +!insertmacro XPUI_PAGE_WELCOME2 +!insertmacro XPUI_PAGE_INSTFILES +!insertmacro XPUI_PAGE_FINISH ; Language files !insertmacro MUI_LANGUAGE "English" @@ -139,6 +157,16 @@ Section "-pre" StrCpy $INSTDIR "$stack_instdir" + StrCpy $skip_install 0 + + StrCmp $db_needroot 0 0 SkipManualCheck + ; If we were given our own DB credentials and there's already a config, the installation needs to be skipped + IfFileExists "$INSTDIR\apps\${PRODUCT_SHORTNAME}\htdocs\config.php" 0 SkipManualCheck + StrCpy $skip_install 1 + Return + + SkipManualCheck: + IfFileExists "$INSTDIR\apps\${PRODUCT_SHORTNAME}\htdocs\config.php" 0 +2 Delete "$INSTDIR\apps\${PRODUCT_SHORTNAME}\htdocs\config.php" SectionEnd @@ -164,11 +192,18 @@ Section "Enano Core" SEC01 SectionIn RO + WriteUninstaller "$INSTDIR\apps\${PRODUCT_SHORTNAME}\uninstall.exe" !insertmacro Core_Install SectionEnd Section "Enable GMP in PHP" SecGMP ClearErrors + IfFileExists "$stack_instdir\php\ext\php_gmp.dll" +3 + + ; No GMP + MessageBox MB_OK|MB_ICONEXCLAMATION "The stack you selected does not contain the GMP extension, so it cannot be enabled. Logins will be several seconds slower. Please consider upgrading your stack." + Return + WriteINIStr "$stack_instdir\php\php.ini" "GMP" "extension" "php_gmp.dll" IfErrors 0 +2 MessageBox MB_OK|MB_ICONEXCLAMATION "GMP was not automatically enabled in PHP. Logins will be several seconds slower." @@ -201,14 +236,14 @@ DetailPrint "Restarting Apache" nsExec::Exec '"$SYSDIR\net.exe" stop "$stack_typestackApache"' nsExec::Exec '"$SYSDIR\net.exe" start "$stack_typestackApache"' -SectionEnd - -Section -WriteKickStart + StrCmp $skip_install 1 0 +2 + Return + Call enano_write_kickstart_script -SectionEnd - -Section -DoEnanoDBSetup Call enano_run_kickstart_script + + SetOutPath "$INSTDIR\apps\${PRODUCT_SHORTNAME}\scripts" + File "inst-resources\selfdestruct.php" SectionEnd Section -InsertApplistEntry @@ -223,13 +258,12 @@ WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" CreateDirectory "$SMPROGRAMS\Enano CMS" CreateShortCut "$SMPROGRAMS\Enano CMS\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" - CreateShortCut "$SMPROGRAMS\Enano CMS\Uninstall.lnk" "$INSTDIR\apps\${PRODUCT_SHORTNAME}\uninst.exe" + CreateShortCut "$SMPROGRAMS\Enano CMS\Uninstall.lnk" "$INSTDIR\apps\${PRODUCT_SHORTNAME}\uninstall.exe" SectionEnd Section -Post - WriteUninstaller "$INSTDIR\uninst.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\apps\${PRODUCT_SHORTNAME}\uninstall.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" @@ -249,20 +283,52 @@ !insertmacro MUI_FUNCTION_DESCRIPTION_END -Function un.onUninstSuccess - HideWindow - MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer." -FunctionEnd - Function un.onInit - MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2 - Abort + + StrCpy $stack_instdir "$INSTDIR\..\.." + ; this is probably a bad way to determine the stack type + ClearErrors + StrCpy $stack_type "wamp" + ReadINIStr $0 "$stack_instdir\properties.ini" "MySQL" "mysql_port" + IfErrors 0 +2 + StrCpy $stack_type "wapp" + FunctionEnd Section Uninstall + + ; Confirm uninstall + MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you really sure you want to uninstall ${PRODUCT_NAME}?$\r$\n\ + $\r$\n\ + Removing ${PRODUCT_NAME} will delete everything that it installed, including your database. If you do not want to \ + lose data, cancel this uninstaller and back up your database before uninstalling.$\r$\n\ + $\r$\n\ + The ${PRODUCT_NAME} uninstaller also deletes any uploaded files, plugins and themes that you may have installed." IDYES +2 + Abort + Delete "$INSTDIR\apps\${PRODUCT_SHORTNAME}\${PRODUCT_NAME}.url" + ; Remove from Apache config + DetailPrint "Removing ${PRODUCT_NAME} from Apache configuration" + Call un.disable_in_apache_config + + ; Remove from applications.html + ; SON OF A BITCH. BitNami, please, PLEASE make applications.html a PHP script that includes all files in a directory. + DetailPrint "Removing ${PRODUCT_NAME} from applications.html" + Call un.disable_in_applications_html + + ; Restart Apache + DetailPrint "Restarting Apache" + nsExec::Exec '"$SYSDIR\net.exe" stop "$stack_typestackApache"' + nsExec::Exec '"$SYSDIR\net.exe" start "$stack_typestackApache"' + + DetailPrint "Uninstalling database" + nsExec::ExecToLog '"$stack_instdir\php\php.exe" "$INSTDIR\scripts\selfdestruct.php"' + + DetailPrint "Deleting files..." + SetDetailsPrint listonly !insertmacro Core_Uninstall + SetDetailsPrint both DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" SetAutoClose true diff -r 0c0d5dadfca3 -r 0cce88c7cf7c inst-resources/apacheconfig.nsh --- a/inst-resources/apacheconfig.nsh Wed May 27 01:17:11 2009 -0400 +++ b/inst-resources/apacheconfig.nsh Sat Jul 11 10:07:32 2009 -0400 @@ -1,5 +1,5 @@ /** - * Search the Apache configuration for the Include line for this package's Apache settings. + * Search the Apache configuration for the Include line for Apache settings. * @return int 0 if successful (found line); 1 if not found */ @@ -44,7 +44,7 @@ FileSeek $0 0 END FileWrite $0 "$\r$\nInclude $\"../apps/${PRODUCT_SHORTNAME}/conf/httpd.conf$\"$\r$\n" - FileClose $0 +FileClose $0 WriteLocalConfig: @@ -71,4 +71,105 @@ FileWrite $0 "$\r$\n" FileClose $0 +FunctionEnd + +; Remove from Apache config upon uninstall +Function un.disable_in_apache_config + StrCpy $0 "$stack_instdir\apache2\conf\httpd.conf" + ClearErrors + FileOpen $1 $0 "r" + + ; input file + IfErrors 0 +3 + Push 1 + Return + + ; output file + FileOpen $2 $0.tmp "w" + IfErrors 0 +3 + Push 1 + Return + + ; read each line, if nothing to do with enano, pass through + loop: + ClearErrors + FileRead $1 $3 1024 + IfErrors done + Push $3 + Push "/apps/${PRODUCT_SHORTNAME}/" + Call un.StrStr + Pop $4 + StrCmp $4 "" 0 loop + ; no mention of Enano, ok to write it + FileWrite $2 $3 + Goto loop + + done: + + FileClose $1 + FileClose $2 + Delete "$0" + Rename "$0.tmp" "$0" + + Push 0 +FunctionEnd + +; Remove from applications.html upon uninstall +Function un.disable_in_applications_html + StrCpy $0 "$stack_instdir\apache2\htdocs\applications.html" + ClearErrors + FileOpen $1 $0 "r" + + ; State variable: are we in the Enano section or not? + StrCpy $5 0 + + ; input file + IfErrors 0 +3 + Push 1 + Return + + ; output file + FileOpen $2 $0.tmp "w" + IfErrors 0 +3 + Push 1 + Return + + ; read each line, if nothing to do with enano, pass through + loop: + ClearErrors + FileRead $1 $3 1024 + IfErrors done + Push $3 + StrCmp $5 1 0 outsideblock + ; inside of the block - don't write + StrCpy $6 0 + Push "END BitNami ${PRODUCT_NAME} Module ${PRODUCT_SHORTNAME}" + Call un.StrStr + Pop $4 + StrCmp $4 "" +2 + ; found it - don't write this line, but set $5 to 0 so we write the next one + StrCpy $5 0 + Goto loop + outsideblock: + Push "START BitNami ${PRODUCT_NAME} Module ${PRODUCT_SHORTNAME}" + Call un.StrStr + Pop $4 + StrCmp $4 "" +3 + ; found the start of the block - disable writes + StrCpy $5 1 + Goto loop + + FileWrite $2 $3 + Goto loop + + done: + + FileClose $1 + FileClose $2 + Delete "$0" + Rename "$0.tmp" "$0" + + Delete "$stack_instdir\apache2\htdocs\img\${PRODUCT_SHORTNAME}-module.png" + + Push 0 FunctionEnd \ No newline at end of file diff -r 0c0d5dadfca3 -r 0cce88c7cf7c inst-resources/core-files.nsh --- a/inst-resources/core-files.nsh Wed May 27 01:17:11 2009 -0400 +++ b/inst-resources/core-files.nsh Sat Jul 11 10:07:32 2009 -0400 @@ -6,10 +6,14 @@ !system 'hg -R "${ENANO_ROOT}" update' SetOutPath "$INSTDIR\apps\${PRODUCT_SHORTNAME}\htdocs" - File /r /x .hg /x .hgtags "${ENANO_ROOT}" + File /r /x .hg /x .hgtags "${ENANO_ROOT}\*" !macroend !macro Core_Uninstall ; I'm sorry, but 1,000 files don't deserve to be listed out. - RmDir /r "$INSTDIR\apps\${PRODUCT_SHORTNAME}\htdocs" + RmDir /r "$INSTDIR\htdocs" + RmDir /r "$INSTDIR\conf" + RmDir /r "$INSTDIR\scripts" + Delete "$INSTDIR\uninstall.exe" + RmDir "$INSTDIR" !macroend diff -r 0c0d5dadfca3 -r 0cce88c7cf7c inst-resources/kickstart.nsh --- a/inst-resources/kickstart.nsh Wed May 27 01:17:11 2009 -0400 +++ b/inst-resources/kickstart.nsh Sat Jul 11 10:07:32 2009 -0400 @@ -59,3 +59,4 @@ MessageBox MB_OK|MB_ICONEXCLAMATION "Setup failed to $0. You will need to install $(^Name) manually. To do this, navigate to:$\r$\n$\r$\n http://localhost/apps/${PRODUCT_SHORTNAME}/$\r$\n$\r$\nYou will be presented with a screen that will allow you to continue the $(^Name) installation.$\r$\n$\r$\nYour database information is:$\r$\n$\r$\n Server type: $db_dbmsname$\r$\n Hostname: localhost$\r$\n Port: $db_port$\r$\n Database name: $db_name$\r$\n Database user: $db_user$\r$\n Database password: $db_password" Abort "Could not $0!" FunctionEnd + diff -r 0c0d5dadfca3 -r 0cce88c7cf7c inst-resources/str_replace.nsh --- a/inst-resources/str_replace.nsh Wed May 27 01:17:11 2009 -0400 +++ b/inst-resources/str_replace.nsh Sat Jul 11 10:07:32 2009 -0400 @@ -105,4 +105,4 @@ !macroend !insertmacro StrStr "" -; !insertmacro StrStr "un." +!insertmacro StrStr "un." diff -r 0c0d5dadfca3 -r 0cce88c7cf7c pages/DatabaseConfig.nsi --- a/pages/DatabaseConfig.nsi Wed May 27 01:17:11 2009 -0400 +++ b/pages/DatabaseConfig.nsi Sat Jul 11 10:07:32 2009 -0400 @@ -21,13 +21,51 @@ WriteINIStr "$PLUGINSDIR\DatabaseConfig.ini" "Field 9" "Text" \ "$(^Name) needs database access to work properly. Setup can create a database for you if you provide \ $db_dbmsname's administration password, or you can choose to enter credentials for a database that already exists." - + + StrCpy $R2 0 ; Hide manual credential items + StrCpy $R3 0 ; Hide root password/set manual to disabled + + ; if the back button was clicked we might have use manual checked + ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 3" "State" + IntCmp $0 1 UseManualIsOn + + StrCpy $R2 1 + + UseManualIsOn: + + ; do we need to disable the checkbox? + ReadINIStr $0 "$PLUGINSDIR\DatabaseConfig.ini" "Field 2" "State" + IntCmp $0 1 0 ShowDialog ShowDialog + + StrCpy $R3 1 + + ShowDialog: + !insertmacro XPUI_INSTALLOPTIONS_INITDIALOG "DatabaseConfig.ini" Pop $XPUI_HWND + + IntCmp $R2 1 "" SkipHideManual + + ${ShowRange} $XPUI_HWND 1204 1207 ${SW_HIDE} + ${ShowRange} $XPUI_HWND 1210 1213 ${SW_HIDE} + + SkipHideManual: + + IntCmp $R3 1 "" SkipForceManual - ${ShowRange} $XPUI_HWND 1204 1207 ${SW_HIDE} - ${ShowRange} $XPUI_HWND 1210 1213 ${SW_HIDE} + ; check the box and disable + GetDlgItem $0 $XPUI_HWND 1202 + SendMessage $0 ${BM_SETCHECK} ${BST_CHECKED} 0 + EnableWindow $0 0 + + ; hide the root password, enter manually is selected + GetDlgItem $0 $XPUI_HWND 1203 + ShowWindow $0 ${SW_HIDE} + GetDlgItem $0 $XPUI_HWND 1209 + ShowWindow $0 ${SW_HIDE} + SkipForceManual: + !insertmacro XPUI_INSTALLOPTIONS_SHOW FunctionEnd diff -r 0c0d5dadfca3 -r 0cce88c7cf7c pages/StackSelect.nsi --- a/pages/StackSelect.nsi Wed May 27 01:17:11 2009 -0400 +++ b/pages/StackSelect.nsi Sat Jul 11 10:07:32 2009 -0400 @@ -22,7 +22,7 @@ !macro ConfigCheck IfFileExists "$stack_instdir\apps\${PRODUCT_SHORTNAME}\htdocs\config.php" 0 +3 - MessageBox MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2 "Setup has found that $(^Name) is already installed on this stack. If you continue, the existing installation's configuration file will be deleted and your existing website will be replaced with a fresh one.$\n$\nDo you want to delete your existing $(^Name) website?" IDYES +2 + MessageBox MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2 "Setup has found that $(^Name) is already installed on this stack. If you continue and you do not want to delete your existing site, you must provide the database information of the current installation on the next page. Otherwise, the existing installation's configuration file will be deleted and your existing website will be replaced with a fresh one.$\n$\nIf you are upgrading $(^Name), you can safely click Yes below, and enter the database information found in $stack_instdir\apps\${PRODUCT_SHORTNAME}\config.php on the next page.$\n$\nDo you want to continue?" IDYES +2 Abort !macroend