From 0188d2047c95109c998533c101ceb6ad74cd1111 Mon Sep 17 00:00:00 2001 From: Michael Gallaspy Date: Wed, 8 Jul 2015 11:43:41 -0700 Subject: [PATCH] Copy blank db during setup; update README --- windows/README.md | 14 ++++++++++++++ windows/installer-source/KaliteSetupScript.iss | 7 ++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/windows/README.md b/windows/README.md index 6097db1..cf9643a 100644 --- a/windows/README.md +++ b/windows/README.md @@ -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 @@ -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 diff --git a/windows/installer-source/KaliteSetupScript.iss b/windows/installer-source/KaliteSetupScript.iss index e5d861e..bdbe3d1 100644 --- a/windows/installer-source/KaliteSetupScript.iss +++ b/windows/installer-source/KaliteSetupScript.iss @@ -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 @@ -486,12 +485,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