pages/StackSelect.nsi
author Dan
Wed, 27 May 2009 01:17:11 -0400
changeset 2 0c0d5dadfca3
parent 0 67e1cc6cd929
child 3 0cce88c7cf7c
permissions -rw-r--r--
Added LockWindow calls to all custom page exit paths to smooth transitions
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     1
Page custom StackSelectCreate StackSelectLeave " - Select stack"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     2
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     3
Function StackSelectCreate
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     4
  ; Only show this page if both WAMPStack and WAPPStack are installed.
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     5
  StrCmp $wampstack_installed 0 "" +3
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     6
    Call StackSelectLeave
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     7
    Return
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     8
  StrCmp $wappstack_installed 0 "" +3
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     9
    Call StackSelectLeave
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    10
    Return
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    11
  StrCmp $XPUI_ABORTED 1 "" +2
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    12
    Abort
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    13
    
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    14
  !insertmacro XPUI_INSTALLOPTIONS_EXTRACT_AS "pages\StackSelect.ini" "StackSelect.ini"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    15
  !insertmacro XPUI_HEADER_TEXT "Select server stack" "Choose which BitNami stack installation you want to use to run $(^Name)."
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    16
  !insertmacro XPUI_INSTALLOPTIONS_DISPLAY "StackSelect.ini"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    17
FunctionEnd
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    18
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    19
Function StackSelectLeave
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    20
  ; Here is where we make the final decision on which stack will be used.
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    21
  IfFileExists "$PLUGINSDIR\StackSelect.ini" "" OnlyOneStackInstalled
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    22
  
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    23
    !macro ConfigCheck
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    24
      IfFileExists "$stack_instdir\apps\${PRODUCT_SHORTNAME}\htdocs\config.php" 0 +3
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    25
        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
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    26
          Abort
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    27
    !macroend
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    28
  
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    29
    ; Both stacks are installed; decide based on user selection
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    30
    ReadINIStr $0 "$PLUGINSDIR\StackSelect.ini" "Field 1" "State"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    31
    StrCmp $0 1 "" UserSelectedWAPP
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    32
      ; User selected WAMP
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    33
      Call BNSetVarsForWAMP
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    34
      !insertmacro ConfigCheck
2
0c0d5dadfca3 Added LockWindow calls to all custom page exit paths to smooth transitions
Dan
parents: 0
diff changeset
    35
      LockWindow on
0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    36
      Return
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    37
      
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    38
    UserSelectedWAPP:
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    39
      ; User selected WAPP
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    40
      Call BNSetVarsForWAPP
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    41
      !insertmacro ConfigCheck
2
0c0d5dadfca3 Added LockWindow calls to all custom page exit paths to smooth transitions
Dan
parents: 0
diff changeset
    42
      LockWindow on
0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    43
      Return
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    44
  
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    45
  OnlyOneStackInstalled:
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    46
  StrCmp $wampstack_installed 0 +3
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    47
    ; MySQL
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    48
    Call BNSetVarsForWAMP
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    49
    !insertmacro ConfigCheck
2
0c0d5dadfca3 Added LockWindow calls to all custom page exit paths to smooth transitions
Dan
parents: 0
diff changeset
    50
    LockWindow on
0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    51
    Return
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    52
    
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    53
    ; PostgreSQL
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    54
    Call BNSetVarsForWAPP
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    55
    !insertmacro ConfigCheck
2
0c0d5dadfca3 Added LockWindow calls to all custom page exit paths to smooth transitions
Dan
parents: 0
diff changeset
    56
    LockWindow on
0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    57
    Return
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    58
FunctionEnd
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    59
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    60
Function BNSetVarsForWAMP
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    61
  StrCpy $stack_type "WAMP"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    62
  StrCpy $stack_instdir "$wampstack_installed"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    63
  StrCpy $db_driver "mysql"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    64
  StrCpy $db_dbmsname "MySQL"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    65
  StrCpy $db_rootuser "root"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    66
  ReadINIStr $db_port "$stack_instdir\properties.ini" "MySQL" "mysql_port"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    67
  
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    68
  StrCpy $stack_portbit ""
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    69
  ReadINIStr $0 "$stack_instdir\properties.ini" "Apache" "apache_server_port"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    70
  StrCmp $0 "80" +2
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    71
    StrCpy $stack_portbit ":$0"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    72
FunctionEnd
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    73
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    74
Function BNSetVarsForWAPP
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    75
  StrCpy $stack_type "WAPP"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    76
  StrCpy $stack_instdir "$wappstack_installed"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    77
  StrCpy $db_driver "postgresql"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    78
  StrCpy $db_dbmsname "PostgreSQL"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    79
  StrCpy $db_rootuser "postgres"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    80
  ; NOTE: WAPPStack doesn't record the port of PostgreSQL - we have to assume the default
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    81
  StrCpy $db_port 5432
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    82
  
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    83
  StrCpy $stack_portbit ""
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    84
  ReadINIStr $0 "$stack_instdir\properties.ini" "Apache" "apache_server_port"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    85
  StrCmp $0 "80" +2
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    86
    StrCpy $stack_portbit ":$0"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    87
FunctionEnd