Enterprise Provisioning - Appendix


[edit] Appendix 1: Content Type headers

Content Type headers direct the web browser behaviour. Headers must be the first output of the web application.

  • HTML content: Directs the web browser to display a web page.
Content-Type: text/html
<empty line>
<html content here>
  • "Save as" file: Directs the web browser to open a "Save As..." dialog
Content-Type: application/x-unknown
Content-Disposition: attachment; filename="EnterpriseConfig.xml"
<empty line>
<file content here>
  • Install file: Directs web browser to open Application Manager.
Content-Type: application/x-install-instructions
Content-Disposition: inline; filename="temp.install"
<empty line>
<install file content here>
  • Multipart: A web server reply may contain multiple content types. Following example directs the web browser to display a web page and open a "Save As" dialog simultaneously:
MIME-version: 1.0
Content-Type: multipart/mixed; boundary=xAAAAAx
<empty line>
Content-Type: text/html
<empty line>
<html content here>
Content-Type: application/x-unknown
Content-Disposition: attachment; filename="EnterpriseConfig.xml"
<empty line>
<file content here>

[edit] Appendix 2: Creating a package on-the-fly

The following section gives an example how to create an application package. In the example, a package containing the EUF is created. The file will be first created in /etc/EnterpriseConfig.xml and then copied to its final place by a post-install script. The reasons to do it this are:

  • To demonstrate the creation of a post-install script
  • Package managers might not always like to create files under the user's home directory.

This approach enables building packages also in a limited or "alien environment". (For example in RPM based distribution)

The "dpkg-deb" command is needed. Usually, it is available in package called dpkg or dpkg-dev, depending on the distribution (available also in RPM based distributions)

Setup the "buildroot":

mkdir -p user-info-1.2345/DEBIAN

Create the package content: In this case, the file /etc/EnterpriseConfig.xml.

mkdir -p user-info-1.2345/etc
cp /path/to/EnterpriseConfig.xml user-info-1.2345/etc/EnterpriseConfig.xml

Create the post-install script:

cat <<@EOF > user-info-1.2345/DEBIAN/postinst
if [ "\$1" = "configure" -o "\$1" = "install" -o "\$1" = "triggered" ]; then
   mkdir -p /home/user/MyDocs/.documents
   su user -c "cp -f /etc/EnterpriseConfig.xml /home/user/MyDocs/.documents/EnterpriseConfig.xml"

exit 0
chmod 755 user-info-1.2345/DEBIAN/postinst

Note, the if clause, "#DEBHELPER#" text and exit command must be present in the script as in the example.

Create metadata:

cat <<@EOF > user-info-1.2345/DEBIAN/control
Package: user-info
Version: 1.2345
Section: user/Enterprise
Priority: extra
Maintainer: John Smith <john.smith@example.com>
Architecture: all
Description: Package for Enterprise User Configuration File
 On-the-fly created package containing user personal data

Note about the version number: In a package like this, it might be a good idea to use an automatically increasing number such as a timestamp. That would cause subsequent provisionings behave as upgrades, which is in most cases the desired behaviour. As an example, in a Python script, a suitable timestamp (minutes since Epoch) can be created by


Build the package:

dpkg-deb --build user-info-1.2345

This command will create a package called user-info-1.2345.deb.

[edit] Appendix 3: Creating a repository on-the-fly

The following section gives an example of how to create a temporary repository. The sample procedure creates a temporary repository named tmprepo123 which contains the user-info package created earlier. Inside the repository, "distribution" is fremantle and "component" is userinfo.

The dpkg-scanpackages command is needed. It is usually available in the dpkg or dpkg-dev packages, depending on the distribution (available also in RPM based distributions)

Create "bindir" environment variable:

arch=`dpkg -I /path/to/user-info-1.2345.deb | grep Architecture: | awk '{print $NF}'`

Create directory structure and go in the top level:

mkdir -p tmprepo123/${bindir}/
cd tmprepo123

Symlink (or copy) the package into repository:

ln -sf /path/to/user-info-1.2345.deb  ${bindir}/

Create and compress the repository metadata:

dpkg-scanpackages ${bindir} /dev/null > ${bindir}/Packages
gzip -f -9 ${bindir}/Packages

Creating the install file: The following install file, when served with the correct Content-type header, would cause the device web browser to open the Application Manager and initiate the installation of the user-info package. This example contains also an Enterprise repository, which contains the packages that user-info depends on.

package =  user-info
catalogues = Temporary; Enterprise

name = Personal Info (temporary)
uri = https://server.example.com/tmprepos/tmprepo123/
components = userinfo

name = Enterprise Package Repository
uri = https://server.example.com/repository/enterprise/
components = sample1 sample2

[edit] Appendix 4a: Creating an offline repository on-the-fly

The following section gives an example how to create an "offline repository" (i.e., a local repository on the device). The offline repository presented here does need an Internet connection, but it does not need a connection to the Enterprise Intranet or VPN.

You can create the repository the same way as in Appendix 3 (or use some other repository). You might consider merging the "enterprise repository" and "personal repository" into one for "offline usage".

Once you have the repository, continue with the installation file. You don't need the install-file shown in Appendix 3. In this example, the repository is called "Maemolocal" and we expect it to have a "userinfo" component (same as in Appendix 3 example).

If you leave out the "package = user-info" it will just install the repository, but won't install any actual packages. You may replace the "user-info" with some other package you want to get installed when this repository is configured.

cd ..
cat << @EOF > Maemolocal.install
package =  user-info
catalogues = Maemolocal

name = Enterprise Repository - Local copy
uri = file:/media/mmc1/Maemolocal
components = userinfo



  • If you really need a self contained offline (ie no network connection available) repository, then see the Appendix 4b.

Create the zip:

rm -f maemolocal.zip
zip -9 -r maemolocal.zip  *install Maemolocal/

Connect the device to the desktop computer with a usb-cable and unpack the contents of this zip file (with directories) to the top directory of the memorycard (MMC1). Unplug the usb-cable when it is ready.

To install the repository on the device:

  • Open the Filemanager,
  • Go to the top directory of the memory card,
  • Tap the "Maemolocal"-install file to start the repository configuration and installation.

[edit] Appendix 4b - Selfcontained Offline repository

If you need a repository which can be used completely offline, it needs to be self-contained (i.e., no dependencies for any other repositories)

  1. Create a repository directory and copy some packages there:
$ mkdir MaemoOffline
$ cp somewhere/*.deb MaemoOffline/
$ (cd MaemoOffline && apt-ftparchive packages . >Packages)
  1. Create a matching MaemoOffline.install file:
card_catalogues = MaemoOffline
packages = app-1; app-2

file_uri = MaemoOffline
dist = ./

Create the zip file:

rm -f maemooffline.zip
zip -9 -r maemooffline.zip  MaemoOffline.install MaemoOffline/

Then you can continue as in Appendix 4a.

Automatic triggering of memory card installs (TO_BE_VERIFIED): Whenever a memory card is inserted that contains a file called .auto.install, that file is processed by the Application Manager. If you copy this MaemoOffline.install into .auto.install then the repository should get installed when user inserts the memory card.

[edit] Appendix 5: Application Manager repository configuration commands

The Application Manager repository configuration may need to be changed manually as a prerequisite for the Enterprise Package installation.

One good place to set repository configuration into sensible values is in the post-install script of the user-info package.

Reset to factory defaults: Following commands reset the repository configuration to the factory defaults:

hildon-application-manager-util restore-catalogues
hildon-application-manager-util clear-user-catalogues

You might want to add the Enterprise Package repository or some other repository to the device repository configuration. This requires the following two steps:

First, create an XML file containing the desired repository configuration. In this example, we define two repositories, the second one being disabled.

      <name>Enterprise Repository</name>
      <components>base extras</components>
      <name>Test Repository</name>
      <components>base extras</components>

Second, run the following command (assuming the XML file is at /etc/repoconf.xml)

hildon-application-manager-config add /etc/repoconf.xml