Skip to content

Commit

Permalink
Merge pull request #87 from MCGallaspy/blank-db-bundle-80
Browse files Browse the repository at this point in the history
Bundle blank db in windows installer
  • Loading branch information
aronasorman committed Jul 10, 2015
2 parents c4f36b8 + 0188d20 commit eef96cf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
14 changes: 14 additions & 0 deletions windows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ To build in Linux, first install `wine`.
* Copy `ka-lite` folder from KA Lite's repository, to the root of this repository;
* Ensure the assessment items have been unpacked in the `ka-lite` directory.
* Follow the _Instructions to download pip dependency zip files_ above
* Create an empty db for distribution as per the section _Creating an Empty DB_
* In Windows, run the following command from this directory:
```
> make.vbs
Expand All @@ -49,6 +50,19 @@ To build in Linux, first install `wine`.
```
* The output file named "KALiteSetup-X.X.X.exe" will appear within this project folder.

---
#### Creating an Empty DB
After installing `ka-lite`:
* Ensure the file `ka-lite/kalite/database/data.sqlite` doesn't already exist.
* Run the command `kalite manage syncdb`. You will see this prompt:

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no):

* Choose "no".
* Run the command `kalite manage migrate`.
* This should create the file `ka-lite/kalite/database/data.sqlite`, which will be copied to the target system by the installer.

---
#### To clone ka-lite and this repository, run the following lines:
* git clone https://github.com/learningequality/ka-lite.git
Expand Down
7 changes: 4 additions & 3 deletions windows/installer-source/KaliteSetupScript.iss
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "..\ka-lite\*"; DestDir: "{app}\ka-lite"; Excludes: "data.sqlite,.KALITE_SOURCE_DIR"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "..\ka-lite\*"; DestDir: "{app}\ka-lite"; Excludes: ".KALITE_SOURCE_DIR"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "..\ka-lite\content\*"; DestDir: "{app}\ka-lite\content"; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "..\ka-lite\kalite\database\*"; DestDir: "{app}\ka-lite\kalite\database"; Excludes: "data.sqlite"; Flags: ignoreversion recursesubdirs createallsubdirs uninsneveruninstall
Source: "..\gui-packed\KA Lite.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\gui-packed\guitools.vbs"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\gui-packed\images\logo48.ico"; DestDir: "{app}\images"; Flags: ignoreversion
Expand Down Expand Up @@ -489,12 +488,14 @@ begin
end;
end;
{ Create a brand new database using the setup management command }
{ Completes the setup with bundled empty database file. }
procedure DoSetup;
var
setupCommand: string;
retCode: integer;
begin
{ Copy the bundled empty db to the proper location. }
Exec(ExpandConstant('{cmd}'), '/S /C "xcopy "' + ExpandConstant('{app}') + '\ka-lite\kalite\database" "%USERPROFILE%\.kalite\database\" /E /Y"', '', SW_HIDE, ewWaitUntilTerminated, retCode);
MsgBox('Setup will now configure the database. This operation may take a few minutes. Please be patient.', mbInformation, MB_OK);
setupCommand := 'kalite manage setup --noinput --hostname="'+ServerInformationPage.Values[0]+'" --description="'+ServerInformationPage.Values[1]+'" --username="'+UserInformationPage.Values[0]+'" --password="'+UserInformationPage.Values[1]+'"';
if Not ShellExec('open', 'python.exe', setupCommand, ExpandConstant('{app}')+'\ka-lite\bin', SW_HIDE, ewWaitUntilTerminated, retCode) then
Expand Down

0 comments on commit eef96cf

Please sign in to comment.