inst-resources/kickstart.nsh
author Dan
Tue, 08 Dec 2009 02:25:33 -0500
changeset 6 6016fd9e848f
parent 3 0cce88c7cf7c
permissions -rw-r--r--
A couple minor fixes: more flexible version numbering; added a CreateDirectory before uninstaller generation (whoops)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     1
; Now we're going to put the kickstart code into a separate file and try to keep it
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     2
; as clean and human-readable as possible.
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     3
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     4
!macro kickstart_var Var Value
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     5
  ${str_replace} $1 "$$" "\$$" "${Value}"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     6
  FileWrite $0 "$$${Var} = <<<EOF$\r$\n$1$\r$\nEOF;$\r$\n$\r$\n"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     7
!macroend
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     8
!macro kickstart_int Var Value
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
     9
  FileWrite $0 "$$${Var} = ${Value};$\r$\n"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    10
!macroend
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    11
!define "kickstart_var" "!insertmacro kickstart_var"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    12
!define "kickstart_int" "!insertmacro kickstart_int"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    13
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    14
Function enano_write_kickstart_script
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    15
  CreateDirectory "$INSTDIR\apps\enanocms\scripts"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    16
  ClearErrors
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    17
  FileOpen $0 "$INSTDIR\apps\enanocms\scripts\kickstart.php" "w"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    18
  IfErrors 0 +4
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    19
    Push "open the kickstart file"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    20
    Call ks_error
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    21
    Return
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    22
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    23
  FileWrite $0 "<?php$\r$\n// Automatically generated kickstart script.$\r$\n$\r$\n"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    24
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    25
  ${kickstart_int} "silent" "true"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    26
  ${kickstart_var} "lang_id" "eng"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    27
  ${kickstart_var} "scriptpath" "/${PRODUCT_SHORTNAME}"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    28
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    29
  ${kickstart_var} "driver" "$db_driver"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    30
  ${kickstart_var} "dbhost" "localhost"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    31
  ${kickstart_int} "dbport" "$db_port"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    32
  ${kickstart_var} "dbuser" "$db_user"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    33
  ${kickstart_var} "dbpasswd" "$db_password"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    34
  ${kickstart_var} "dbname" "$db_name"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    35
  ${kickstart_var} "db_prefix" "enano_"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    36
  ${kickstart_var} "user" "$enano_user"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    37
  ${kickstart_var} "pass" "$enano_password"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    38
  ${kickstart_var} "email" "$admin_email"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    39
  ${kickstart_var} "sitename" "$site_name"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    40
  ${kickstart_var} "sitedesc" "$site_desc"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    41
  ${kickstart_var} "copyright" "$site_copyright"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    42
  ${kickstart_var} "urlscheme" "$url_scheme"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    43
  ${kickstart_var} "start_with" "$start_with"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    44
  
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    45
  FileWrite $0 "$\r$\nrequire(dirname(__FILE__) . '/../htdocs/install/includes/cli-core.php');"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    46
  FileClose $0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    47
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    48
FunctionEnd
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    49
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    50
Function enano_run_kickstart_script
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    51
  ; Debug :)
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    52
  ; ExecWait '"$SYSDIR\notepad.exe" "$INSTDIR\apps\enanocms\scripts\kickstart.php"'
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    53
  DetailPrint "Installing $(^Name) database"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    54
  nsExec::ExecToLog '"$INSTDIR\php\php.exe" "$INSTDIR\apps\enanocms\scripts\kickstart.php"'
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    55
FunctionEnd
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    56
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    57
Function ks_error
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    58
  Pop $0
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    59
  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"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    60
  Abort "Could not $0!"
67e1cc6cd929 First commit. It's working!
Dan
parents:
diff changeset
    61
FunctionEnd
3
0cce88c7cf7c Added Makefile
Dan
parents: 0
diff changeset
    62