Install Script

Install Script Details

A template Install script is provided in the custom app template tarball. The Install script is responsible for installing any app dependencies.

  • Required to exist at the top level of the application tarball
  • It must accept the following command line arguments: installpostinstall, and remove.
  • The provided template is configured to install IPK files listed in p_manifest.json, but this script can be fully customized to your needs including removing the IPK installing code.
  • This script is the place to download files from the internet or perform actions like npm install
  • The install and postinstall functions must be written in such a way that they can be successfully executed multiple times
  • This script is always run as root. Don’t forget to make the permissions on the Install script executable by the appropriate user.

The below process flows show exactly when and how the Install script is executed.

Install Process

  1. app-manager launched to install a custom app either from a DeviceHQ® command or manually from the command line
  2. If a version of the app is already installed, app-manager stops it via the Start script
  3. app-manager either downloads the app tarball from DeviceHQ or if manually installing, checks it’s existence at the given path.
  4. app-manager creates a directory in /media/card/ with the app name from manifest.json.
  5. app-manager extracts the contents of the app tarball into that directory
  6. If a config file was selected when queuing the Install command from DeviceHQ, app-manager downloads the config file and places it in the config/ directory, overwriting any existing files.
  7. app-manager executes the Install script with the install argument
  8. app-manager saves the meta data for the newly installed app
  9. app-manager executes the Install script with the postinstall argument
  10. app-manager starts the app via the Start script.
  11. The Conduit® checks into DeviceHQ to report new Installed Apps information

Uninstall Process

  1. app-manager launched to uninstall a custom app
  2. app-manager stops the app via the Start script.
  3. app-manager executes the Install script with the remove argument
  4. app-manager deletes the entire app directory from /media/card/
  5. The Conduit checks into DeviceHQ to report new Installed Apps information

Conduit Firmware Upgrade Process

  1. Conduit firmware upgrade initiated
  2. Conduit reboots and upgrades firmware
  3. On first boot after upgrade, the /etc/init.d/customapp script does the following for each installed app:
    1. Launches app-manager to install dependencies
      1. app-manager executes the Install script with the install argument
      2. app-manager executes the Install script with the postinstall argument
    2. Launches app-manager to start the app
      1. app-manager starts the app via the Start script.

Warning for Updating Base Packages

The default Install script will both install and remove any opkg dependencies in p_manifest.json using opkg with the –force-depends argument.  If you are updating a system library removing a package in this manner may have unintended consequences.  If you are upgrading these packages, the opkg commands defined by OPKG_CMD_PREFIX and OPKG_CMD_PREFIX_R should be modified to remove –force-depends

Installed Application Structure

media-card