NSIS for Smartphone

From NSIS Wiki

You can compile a setup launcher which will install multiple CAB files to Windows Mobile-based Smartphone using the Nullsoft Scriptable Install System (NSIS).
Snap1553.gif


Our objective is to make a desktop installer which will install several CAB files to a Smartphone by passing CAB files to the ActiveSync program. Launchers.gif


Very Important Notice
It will facilitate understanding of this article if you already have a background knowledge on how INI files are written and how CAB files for Smartphone are created.


Requirements
1. NSIS version 2.09
2. This ZIP File NSIS.for.SP.zip (4 KB) - contains NSIS sample script, sample CAB, sample INI and other required files
3. Microsoft Active Sync program installed on your PC


Instructions
1. Download then install NSIS version 2.09. Once installed, it will create necessary registry changes on your PC so that all *.NSI files will be associated with Nullsoft Scriptable Install System.


2. Download then unzip contents of the ZIP file. You should have the following files:
Snap1547.gif


3. Highlight ‘SCRIPT.nsi’ then right click mouse. Click on ‘Compile NSIS Script’.
Snap1548.gif


4. Wait for the confirmation window.
Snap1549.gif


5. Verify that your file was compiled.
Snap1550.gif


6. Test your file.

The EULA screen.
Eulasp.gif


The Options screen. You can choose from Custom or Full Installation type.
Snap1552.gif


The Installation Directory dialog. This is where your files will be dumped.
Snap1555.gif


Finally, once the last CAB file is being installed on the phone, you will see this on your computer’s monitor.
Snap1554.gif


Tips
- Open the NSI file then make necessary changes (change app name, change icon, change component names etc)
- Provide your own CAB and INI files, provide a custom icon.
- Change content of the sample eula
- Open the html file then change the contents.


To add another CAB file (File 4, etc)
Code in green should be inserted between the 2 red lines. Before you recompile the script, ensure that you have the new files (4.CAB and 4.ini) inside the folder.
Snap1556.gif


Try this sample setup launcher Multi.Cab.Install.zip (23 KB)

---ADDENDUM---

Cleaner Method.

While the above method works just fine, I would like to point out that the same result can be achieved without having the 'Add / Remove Programs' dialog pop up three times, which can be confusing and unfriendly to stupi...errr...Less Experienced users - it can be done much more cleanly in one dialog. This is also a better solution when you are installing dependencies (i.e: If you need to have the .Net compact framework installed before your main app).

To do this, take the above installscript, and modify it thusly:

StrCpy $0 "$INSTDIR\1.ini"
;Call InstallCAB <-- Comment out this line
SectionEnd ;
 
Section "File 2"
SectionIn 1
SetOutPath "$INSTDIR"
 
File 2.ini
File 2.CAB
 
StrCpy $2 "$INSTDIR\2.ini" ;<-- $2 instead of $0
;Call InstallCAB <-- Comment out this line
SectionEnd ;
 
Section "File 3"
SectionIn 1
SetOutPath "$INSTDIR"
 
File 3.ini
File 3.CAB
 
StrCpy $3 "$INSTDIR\3.ini" ;<-- $3 instead of $0
Call InstallCAB
 
<SNIP!>
 
Function InstallCAB
  ExecWait '"$1" "$0" "$2" "$3"' ;<-- Extra parameters '$2' and '$3' Here
FunctionEnd

What This Achieves:

The PDA CAB Files are installed by calling CEAppMgr.exe with the cab files as command-line parameters. In the main article, this is accomplished by calling CEAppMgr three times to install Three Cab Files. With my changes, instead of calling ceappmgr three times:

CeAppMgr 1.cab
CeAppMgr 2.cab
CeAppMgr 3.cab

it calls it once:

CeAppMgr 1.cab 2.cab 3.cab

CEAppMgr can handle multiple cab files in one go, thus is installs all three CAB files through one dialog.

If you want to change the order in which they get installed, i.e if 2.cab required that 3.cab was already installed, just change the order. e.g:

Function InstallCAB
  ExecWait '"$1" "$0" "$3" "$2"'
FunctionEnd

Thanks to the Original poster of this tutorial, it helped me out greatly. I hope that my little addendum is of use to someone. apologies if it's messy / incomprehensible, but I'm typing this in a hurry.

Personal tools
donate