# Pack the application

### Package Management Tool

Frequently used tools:

Check installed packages:  $opkg list-installed

Check the information of the installed package: $ opkg info packagename

Install or update the application package: $opkg install ./packagename.ipk

Remove the installed package: $opkg remove package

For more information about how to use opkg, we can run $opkg –help on the TIYcam.

\
Demo Package Project
--------------------

A demo package project has been provided. It can be downloaded from [here](https://linksprite.s3.amazonaws.com/TIYCam/sysroot.tgz).  Download and unzip into the home directory on the host development PC.&#x20;

### Description of Packing

Run $./pkg-build on host development PC  test to pack the application.

The description of test directory:

```
.
├── ipkg-build # Script used to pack
└── test       #Example application to illustrate packing
    ├── CONTROL  # Directory of the information of the application 
    │  ├── conffiles #config files, the files listed by absolute path in this file will not be overwritten during update
    │  ├── control # Information of the application, the ones will be displayed when using $opkg info. Especially, 
                   #1. Architecture: arm. This must be same as the TIYcam. Use to command $opkg print-architecture to check on TIYCam.
                   #2. Depends: bas means the dependent application packages. The installation process will check the dependency. If there is no depended packages, the installation will fail or if the source has it, it will automatically install it. 
    │  ├── postinst #The script to be executed after installation. Normally it is a start command.
    │  ├── postrm #The script to be executed after remove. Normally it is empty or delete some intermediate files that are generated by the application. 
    │  ├── preinst #The script to be executed before installation. Normally it is empty.
    │  ├──prerm #The script to be executed before remove. Normally it is stopping services.
    ├── etc
    │ └── init.d
    │    └── S80test # The start script. Refer to implement start/stop/restart. Note start needs to run in background.
    └── usr
       └── bin #The binaries of the application needs to stay here
          └── test
       ├── lib #The dynamic libraries need to stay here
       └── share #The dependent files need to stay here within a subdirectory with packgename
```

<figure><img src="/files/oi9DDFqTQvolI3VC9eZb" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/vx8HFKhZApJAYEsHTGUN" alt=""><figcaption></figcaption></figure>

Run packing command:

<figure><img src="/files/L5JsHEiF00ks4k3ticyQ" alt=""><figcaption></figcaption></figure>

Telnet into the TIYcam and do installation on TIYcam from the NFS mouting point:

<figure><img src="/files/57O3ws3m9xYgrCGllRfe" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://linksprite.gitbook.io/build-applications-for-tiycam/pack-the-application.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
