Difference between revisions of "InkBox GUI user apps"

From InkBox
Jump to navigation Jump to search
Line 9: Line 9:
│  └── SampleApp.bin
│  └── SampleApp.bin
├── app-data
├── app-data
├── app.json
├── app-lib
├── app-lib
│   └── libzip.so
│   └── libzip.so
Line 21: Line 20:
├── system-bin
├── system-bin
└── system-lib</pre>
└── system-lib</pre>
==== <code>app.json</code> ====
==== <code>app-bin</code> ====
This file contains a description of the application in the JSON format that will be parsed by the GUI. A sample <code>app.json</code> may look like this:<pre>{
This directory contains the application's binaries.<br>Applications can access this location at <code>/app-bin</code>
  "app": {
    "Author": "John Doe",
    "AuthorContact": "johndoe@johndoe.com",
    "Enabled": true,
    "ExecPath": "/app-bin/SampleApp",
    "IconPath": "/app-misc/SampleApp.png",
    "Name": "SampleApp",
    "SupportedDevices": "all",
    "RequiredFeatures": [ 1 ],
    "Version": "0.1-testing"
  }
}</pre>For more details on this file and its contents, please consult the [[#JSON app descriptor file|related section below]].
==== <code>app-data</code> ====
==== <code>app-data</code> ====
This directory contains the only read-write part of the extension package. It is actually a bind mount of the related path <code>.apps-data/<app-name></code> in the exported USB mass storage. Applications can store their user data, such as preferences, files and statistics, there.<br>Applications can access this location at <code>/app-data</code>.
This directory contains the only read-write part of the extension package. It is actually a bind mount of the related path <code>.apps-data/<app-name></code> in the exported USB mass storage. Applications can store their user data, such as preferences, files and statistics, there.<br>Applications can access this location at <code>/app-data</code>.
==== <code>app-bin</code> ====
This directory contains the application's binaries.<br>Applications can access this location at <code>/app-bin</code>
==== <code>app-lib</code> ====
==== <code>app-lib</code> ====
This directory contains the libraries the application needs to have to function properly. If it is based on Qt, there is no need to bundle it in there, as it will be provided in the <b>system-lib</b> directory. In this example, the application requires <code>libzip.so</code>, so it has been put there. <code>LD_LIBRARY_PATH</code> environment variable is automatically adjusted by the main launch script.<br>Applications can access this location at <code>/app-lib</code>.
This directory contains the libraries the application needs to have to function properly. If it is based on Qt, there is no need to bundle it in there, as it will be provided in the <b>system-lib</b> directory. In this example, the application requires <code>libzip.so</code>, so it has been put there. <code>LD_LIBRARY_PATH</code> environment variable is automatically adjusted by the main launch script.<br>Applications can access this location at <code>/app-lib</code>.
Line 57: Line 42:
=== GUI launch process ===
=== GUI launch process ===
The main Qt GUI will launch the application in the chroot jail as an unpriviledged user, based on its JSON file's <code>ExecPath</code> property. Once the program has finished running, the GUI will restart itself.
The main Qt GUI will launch the application in the chroot jail as an unpriviledged user, based on its JSON file's <code>ExecPath</code> property. Once the program has finished running, the GUI will restart itself.
== JSON app descriptor ==
== JSON app descriptor file ==
The <code>app.json</code> file contains information about the application, how to run it and what system features it requires.
The <code>app.json</code> file, located outside of the main application package but extracted in the same folder, contains information about the application, how to run it and what system features it requires that will be parsed by the GUI. A sample <code>app.json</code> may look like this:<pre>{
  "app": {
    "Author": "John Doe",
    "AuthorContact": "johndoe@johndoe.com",
    "Enabled": true,
    "ExecPath": "/app-bin/SampleApp",
    "IconPath": "/app-misc/SampleApp.png",
    "Name": "SampleApp",
    "SupportedDevices": "all",
    "RequiredFeatures": [ 1 ],
    "Version": "0.1-testing"
  }
}</pre>For more details on this file and its contents, please consult the [[#JSON app descriptor file|related section below]].
=== Properties ===
=== Properties ===
==== <code>Author</code> ====
==== <code>Author</code> ====
Line 65: Line 62:
Property containing the application author's contact e-mail address.
Property containing the application author's contact e-mail address.
==== <code>Enabled</code> ====
==== <code>Enabled</code> ====
TODO
Property containing the application's current status in the main GUI.
==== <code>ExecPath</code> ====
==== <code>ExecPath</code> ====
Property containing the path to the main application's executable. The recommended location is at <code>/app-bin/SampleApp</code>.
Property containing the path to the main application's executable. The recommended location is at <code>/app-bin/SampleApp</code>.

Revision as of 17:44, 11 June 2022

This page describes the internals of InkBox GUI's user applications feature.

Description

This GUI feature permits the user to run digitally signed external Qt/FB applications available at https://23.163.0.39/bundles/inkbox/apps.
User applications in are executed in their own chroot jail as an unpriviledged user, to prevent external access to parts of the filesystem and increase security. They are also mounted read-only, with some exceptions.

Application package

Contents

App packages have the .isa extension. Signature files (digests) have the .isa.dgst extension. A standard application package layout will look like this:

.
├── app-bin
│   └── SampleApp
│   └── SampleApp.bin
├── app-data
├── app-lib
│   └── libzip.so
├── app-misc
│   └── SampleApp.png
├── dev
├── etc
│   └── passwd
├── proc
├── sys
├── system-bin
└── system-lib

app-bin

This directory contains the application's binaries.
Applications can access this location at /app-bin

app-data

This directory contains the only read-write part of the extension package. It is actually a bind mount of the related path .apps-data/<app-name> in the exported USB mass storage. Applications can store their user data, such as preferences, files and statistics, there.
Applications can access this location at /app-data.

app-lib

This directory contains the libraries the application needs to have to function properly. If it is based on Qt, there is no need to bundle it in there, as it will be provided in the system-lib directory. In this example, the application requires libzip.so, so it has been put there. LD_LIBRARY_PATH environment variable is automatically adjusted by the main launch script.
Applications can access this location at /app-lib.

sys

This directory contains a mounted sysfs filesystem used by the chroot.

dev

This directory contains a mounted devtmpfs filesystem used by the chroot.

proc

This directory contains a mounted proc filesystem used by the chroot.

etc

This directory contains a mounted tmpfs filesystem used by the chroot.

system-lib

This directory contains the system's Qt libs and are made available so that the application can launch.
Applications can access this location at /system-lib.

system-bin

This directory contains the system's binaries made available to the application (e.g. BusyBox).
Applications can access this location at /system-bin.

Other files

Those may include an application icon that will be read by the GUI.

GUI launch process

The main Qt GUI will launch the application in the chroot jail as an unpriviledged user, based on its JSON file's ExecPath property. Once the program has finished running, the GUI will restart itself.

JSON app descriptor file

The app.json file, located outside of the main application package but extracted in the same folder, contains information about the application, how to run it and what system features it requires that will be parsed by the GUI. A sample app.json may look like this:

{
  "app": {
    "Author": "John Doe",
    "AuthorContact": "johndoe@johndoe.com",
    "Enabled": true,
    "ExecPath": "/app-bin/SampleApp",
    "IconPath": "/app-misc/SampleApp.png",
    "Name": "SampleApp",
    "SupportedDevices": "all",
    "RequiredFeatures": [ 1 ],
    "Version": "0.1-testing"
  }
}

For more details on this file and its contents, please consult the related section below.

Properties

Author

Property containing the application author's name.

AuthorContact

Property containing the application author's contact e-mail address.

Enabled

Property containing the application's current status in the main GUI.

ExecPath

Property containing the path to the main application's executable. The recommended location is at /app-bin/SampleApp.

IconPath

Property containing the path to the main application's icon.

Name

Property containing the name of the main application. It can be a full string with spaces.

SupportedDevices

Property containing an array of the application's supported devices. This can be, for example, [ "n236", "n437", "n306" ]. If the application aims to support every device, this property must contain the "all" string instead.

RequiredFeatures

Property containing an array of the application's required features. Features are functions of InkBox OS that are not always available based on user interaction (e.g. Wi-Fi connection). Below is a list of features that this property supports.

Feature identifier Description
0 Wi-Fi connection required
1 Rooted kernel required

A simple array for this property may be, for example, [ 0, 1 ].

Backend setup

The service gui_apps in the main root filesystem manages the setup of user applications.