Comments
Richard Davies wrote: The UK has a good crop of technology pioneers in cloud computing - for example ElasticHosts, FlexiScale, Flexiant, OnApp - and also some strong government initiatives such as G-Cloud. We will have to see whether this kind of technical leadership converts into swift mass-market adoption or not.
Cloud Expo on Google News


2008 West
DIAMOND SPONSOR:
Data Direct
SOA, WOA and Cloud Computing: The New Frontier for Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
GOLD SPONSORS:
Appsense
User Environment Management – The Third Layer of the Desktop
Cordys
Cloud Computing for Business Agility
EMC
CMIS: A Multi-Vendor Proposal for a Service-Based Content Management Interoperability Standard
Freedom OSS
Practical SOA” Max Yankelevich
Intel
Architecting an Enterprise Service Router (ESR) – A Cost-Effective Way to Scale SOA Across the Enterprise
Sensedia
Return on Assests: Bringing Visibility to your SOA Strategy
Symantec
Managing Hybrid Endpoint Environments
VMWare
Game-Changing Technology for Enterprise Clouds and Applications
Click For 2008 West
Event Webcasts

2008 West
PLATINUM SPONSORS:
Appcelerator
Get ‘Rich’ Quick: Rapid Prototyping for RIA with ZERO Server Code
Keynote Systems
Designing for and Managing Performance in the New Frontier of Rich Internet Applications
GOLD SPONSORS:
ICEsoft
How Can AJAX Improve Homeland Security?
Isomorphic
Beyond Widgets: What a RIA Platform Should Offer
Oracle
REAs: Rich Enterprise Applications
Click For 2008 Event Webcasts
SYS-CON.TV
Top Links You Must Click On


PBDJ Feature — Creating PocketBuilder Installs for SmartPhones Using NSIS
An open source alternative to EZSetup

Did you know you can make automated installs for your PocketPC and SmartPhone applications created with PocketBuilder? When you use a PocketBuilder project to compile your application, it automatically creates an <application_exe>_setup.ini file that can be fed to a third-party EZSetup program to create the installation executable (see Listing 1). It also creates a <application_exe>_makecab.bat file that is used to create the CAB file (see Listing 2). The project even automatically executes that file. That batch file includes a commented-out call to the EZSetup program.

There are a few steps you'll need to take before you can create the install file for a SmartPhone deploy:

1.  Obtain CabWizSP.exe: PocketBuilder doesn't provide the SmartPhone version of Microsoft's CabWiz utility (called CabWizSP.exe), which is used to create the CAB file that the install utilities use to create the install file. You'll need to download the Smartphone Software Development Kit from Microsoft's MSDN site and copy the CabWizSP.exe file from the Tools directory of that SDK into the \Support\cabwiz directory under the PocketBuilder install directory: http://msdn.microsoft.com/mobility/windowsmobile/downloads/default.aspx

2.  Obtain EZSetup.exe: EZSetup is a free third-party tool for creating install files for mobile devices based on CAB files. It's available from a number of sources, including: www.spbsoftwarehouse.com/products/ezsetup

By default, this is the utility that PocketBuilder uses to generate the install file. However, the purpose of this article is to explain how to use a different third-party tool to create that install file so you'll also need to:

3.  Obtain NSIS: The Nullsoft Installation System is an Open Source utility used to create installs for Windows as well as mobile devices. It can be obtained from: http://nsis.sourceforge.net

Fortunately, the INI file used for the install is the same regardless of which install utility you use. Sybase also provides a setup_sp.ini file (see Listing 3) and the appropriate CAB files that can be used with these utilities to install the PocketBuilder runtime. We could simply add the PocketBuilder CAB file to the list of CAB files in the INI file for our main install, but for this application I've decided to make it a separate part of the common install.

The <application_exe>_setup.ini file that the PocketBuilder project creates leaves the name of the CAB file to install as "**YOUR CAB FILES HERE***". Each time the PocketBuilder project is run, it recreates the <application_exe>_setup.ini file. So if you edit the file to include a reference to the CAB file it gets rewritten the next time you do a build/deploy using the project. Fortunately, we can change the value that PocketBuilder inserts there by default by editing the setup_template.ini file in the \Support\ezsetup directory under the PocketBuilder install directory. Replace "**YOUR CAB FILES HERE***" with "$CAB_APPNAME$.ARM.CAB" and the project will automatically include the CAB file name in the appropriate location.

What is a bit more problematic is that the PocketBuilder project also re-creates the <application_exe>_makecab.bat file each time it runs. What we'd like to be able to do is have a version where the call to EZSetup is not commented out or, as in this case, where we want to call a different utility (NSIS) after the CAB is generated. Perhaps the PocketBuilder development team would consider looking for a differing named file (i.e., my<application_exe>_makecab.bat) at the end of the generation process if it exists, and only run their default file if it isn't. Then we could make our modifications, rename the file, and be certain that it would run automatically for us.

In any event, let's go ahead and copy the <application_exe>_makecab.bat file and include the following in place of the commented-out call to EZSetup:

"C:\Program Files\NSIS\makensis.exe" /O"error.log" /V3 <application_exe>.nsi

The /O"error.log" entry indicates that we want messages from the utility logged out to an error.log file. The /V3 indicates that we want errors and warnings.

We also need to create an NSI file (the file that NSIS will process) along the lines of Listing 4. The sample is based on the NSIS for SmartPhone sample from the NSIS wiki site http://nsis.sourceforge.net/NSIS_for_Smartphone

The name entry indicates the name of the application that will appear in the Add/Remove programs listing and the various dialogs in the install. The OutFile indicates the single EXE file that will be created that the user can install from. The Installdir indicates the default location that the program will be installed on the user's computer (not his SmartPhone). The LicenseData is optional. If it's provided then the license dialog is shown, otherwise it's not displayed. If provided, it has to be a standard text file.

The Section entries indicate the items that the user will be allowed to choose to install. The SectionIn value indicates which Install Type entry will be available (e.g., Normal, Complete, and Custom). In this particular example, we've only defined one install type (Full) and have made both sections part of the full install. The File entries in a section indicate what files are to be copied to the destination directory indicated by the SetOutPath entry (which normally just points to the install directory).

The next items in the install script are the first of the instructions specifically used to handle a SmartPhone install. The script determines the location of ActiveSync by checking the system AppPath registry entry for the ActiveSync executable name. If it's not found, it exists indicating that ActiveSync isn't installed. Otherwise, it passes the name of each INI file created above to the ActiveSync program, which in turn installs it on the SmartPhone (or schedules it for install if the SmartPhone isn't currently connected).

The install script makes a few registry entries of its own to the host computer, noting the install of the application and providing the uninstall information. Finally, it prompts the user to determine if he wants to review the help file for the application. Once again, like the license file, this step is optional (Figure 1).

The NSI file also contains scripting for handling the application's uninstall. The primary thing we have to do is remove the registry entries that we made as the last step of the install and the directory we created to install the application on the host machine.

If all works well, you should see something like the following in the error.log file when you run the <application_exe>_makecab.bat file: Processed 1 file, writing output:

And an <application_exe>.install.exe file will be created (or whatever you defined the output file to be).

When the user executes that file, he will first see the license agreement (if provided). Note how a URL that was included in the text file has automatically been formatted as a hyperlink. Also note how the icon(s) provided have been included in the dialogs. That is followed by the installation type dialog (see Figure 2), which lists the components we defined earlier. That in turn is followed by the installation directory dialog (see Figure 3) after which ActiveSync attempts to install the program (see Figure 4). The last thing (at least in this sample) is the Help file viewing prompt (see Figure 5).

Conclusion
The Nullsoft Installation System (NSIS) offers an alternative to the EZSetup utility for creating installation files for your PocketBuilder applications. Because it can use most of the same files that PocketBuilder creates for the EZSetup install, NSIS can be easily integrated into the build process. In addition, NSIS lets you script the install, which provides more flexibility.

About Bruce Armstrong
Bruce Armstrong is a development lead with Integrated Data Services (www.get-integrated.com). A charter member of TeamSybase, he has been using PowerBuilder since version 1.0.B. He was a contributing author to SYS-CON's PowerBuilder 4.0 Secrets of the Masters and the editor of SAMs' PowerBuilder 9: Advanced Client/Server Development.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

Did you know you can make automated installs for your PocketPC and SmartPhone applications created with PocketBuilder? When you use a PocketBuilder project to compile your application, it automatically creates an _setup.ini file that can be fed to a third-party EZSetup program to create the installation executable (see Listing 1). It also creates a _makecab.bat file that is used to create the CAB file (see Listing 2). The project even automatically executes that file. That batch file includes a commented-out call to the EZSetup program


Your Feedback
Sys-Con Italy News Desk wrote: Did you know you can make automated installs for your PocketPC and SmartPhone applications created with PocketBuilder? When you use a PocketBuilder project to compile your application, it automatically creates an _setup.ini file that can be fed to a third-party EZSetup program to create the installation executable (see Listing 1). It also creates a _makecab.bat file that is used to create the CAB file (see Listing 2). The project even automatically executes that file. That batch file includes a commented-out call to the EZSetup program
Enterprise Open Source Magazine Latest Stories . . .
Apache Deltacloud, the Red Hat-contributed ReSTful API that abstracts differences between clouds so services on any cloud can be managed – provided of course there’s a driver – has graduated from the Apache Foundation’s incubator and is now a full-fledged Top-Level Project (TLP). The...
With Cloud Expo 2012 New York (10th Cloud Expo) just four months away, what better time to start introducing you in greater detail to the distinguished individuals in our incredible Speaker Faculty for the technical and strategy sessions at the conference... We have technical and st...
AMD said late Tuesday that its chief sales officer Emilio Ghilardi had left the company and that CEO and president Rory Read is going to do his job while a replacement is sought. AMD didn’t say why Ghilardi left but it’s assumed Read wants his own people. Read is relatively new to th...
During the lifespan of M3 (Monitis Monitor Manager) there has always been something lacking – timers. M3 execution procedure was outlined in this previous article. The execution mentioned in the latter was a one-time-execution, whereas server monitoring requires periodic invocati...
Red Hat is putting its bought-in Gluster scale-out NAS storage technology, acquired in October, on the Amazon cloud. It’s styled Red Hat Virtual Storage Appliance for Amazon Web Services and other clouds are supposed to follow in short order.
A new episode of the screencast series is now available at the OpenNebula YouTube Channel. This screencast demonstrates the new easily-customizable self-service portal for cloud consumers. Its aim is to offer a simplified access to shared infrastructure for non-IT end users. The scree...
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


SYS-CON Featured Whitepapers
ADS BY GOOGLE