Packaging and Installation
About 460 wordsAbout 2 min
2025-07-17
Prepare Project Files
The app packaging interface standardizes application bundling. Configure app metadata (name, developer contact, company/organization) and required runtime files (executables, resources, libraries) via direct API calls, or use a predefined JSON config to set parameters and invoke a one-click packaging API.
Package the Application
Package with JSON Config
Use the tpAppDopack utility to package the app; ensure app info is configured beforehand.
tpAppDopack package;
package.getAllConfig("dopack.json");
package.setPackageName("mytestapp");
package.creatPackage("./");The JSON file contains the app configuration, for example:
{
"appID": "f03c8f8c-dd9b-453f-b2d4-d049c073e252",
"appName": "MyApp",
"organization": "MyCompany",
"version": "1.0.0",
"appexecName": "/path/mytestapp",
"architecture": "amd64",
"section": "free",
"priority": "optional",
"essential": "no",
"diskspace": "102400",
"description": "this is tinyPiXOS test APP",
"signature": "",
"icon": "/path/icon.jpeg",
"author": {
"name": "Name",
"email": "123456789@email.com"
},
"fileExtension": [
".jpeg",
".jpg",
".png",
],
"startupParameters": [
"--fullscreen",
"--server"
],
"libraries": [
"/path/libmytest.so"
],
"dependencies": [
{
"name": "libdependency1",
"version": "1.2"
},
{
"name": "libdependency2",
"version": "3.1"
}
],
"assertFiles": [
"/path/assert/mysrc",
"/path/assert/picture"
],
"binFiles": [
"/path/bin_1",
"/path/bin_2"
],
"otherFiles": [
"/path/otherfile"
]
}Modify the JSON template to configure your app. Parameter descriptions:
- appID: App UUID
- appName: App name
- organization: Company/organization
- version: App version
- appexecName: Path to the app executable
- architecture: Supported hardware architecture
- section: App category, e.g., utils, graphics, games
- priority: Install priority; optional, standard, required
- essential: Core system component; yes or no
- diskspace: Disk space usage
- description: App description
- signature: Digital signature (not supported yet)
- icon: App icon path
- author: Author info
- fileExtension: Supported file extensions
- startupParameters: Startup args (optional)
- libraries: App libraries
- dependencies: Open-source dependencies
- assertFiles: Static assets
- binFiles: Other app executables
- otherFiles: Other app filesPackage via Custom API
Instead of using a JSON file, you can configure parameters directly via tpAppDopack APIs.
tpAppDopack package;
printf("set package type\n");
package.setPackageType(tpAppDopack::TP_PACKAGE_TYPE_APP);
package.setAppID("f03c8f8c-dd9b-453f-b2d4-d049c073e252");
package.setAppName("apptest");
package.setVersion(1,0,0);
package.setAppPath("/home/pix/AppManage/mytestapp/mytestapp");
package.setArchitecture("amd64");
package.setAuthor("Chingan");
package.setContact("2111956539@qq.com");
package.setProvides("tinyPiX");
package.addDepend("libalsa",1,5,1);
package.addDepend("libssl",1,0,0);
package.addAssert("/home/pix/AppManage/mytestapp/assert/mysrc");
package.addAssert("/home/pix/AppManage/mytestapp/assert/picture");
package.addLib("/home/pix/AppManage/mytestapp/lib/libmysum.so");
package.setIcon("/home/pix/AppManage/mytestapp/icon.jpeg");
package.addExtension(".png");
package.addExtension(".jpg");
package.addExtension(".jpeg");
package.addExtension(".bmp");
package.addFile("/home/pix/AppManage/mytestapp/jiyc");
//设置应用的启动参数
package.addStartArg("--fullscreen");
package.addStartArg("--server");
package.setExecPath("mytestapp");
//设置安装包名字并打包
package.setPackageName("mytestappPackage");
package.creatPackage("/home/pix/AppManage/");Install the Application
The installation API validates the environment automatically. Example:
tpString package_path(pack_path);
tpAppInstall appmanage(package_path);
appmanage.install();
while(1)
{
if(appmanage.getInstallSchedule()==100)
break;
usleep(50000);
}Uninstall the Application
tpString uuid="0756e187-6f59-4b24-82f6-d4020029c9b8";
tpAppInstall::remove(uuid);Run
Use tpAppConfigIO to get app config, then start the app with tpProcess.
tpAppConfigIO configIO(uuid);
tpString runnerPath = configIO.runnerPath();
tpFileInfo runnerFileInfo(runnerPath);
if (!runnerFileInfo.exists())
{
std::cout << "App " << configIO.appName() << " executable does not exist!" << std::endl;
return;
}
tpProcess exeProcess;
exeProcess.start(runnerPath, argList);
int32_t processPID = exeProcess.launchProcessID();
std::cout << "processPID " << processPID << std::endl;Copyright
Copyright Ownership:TinyPiXOS
License under:Attribution-ShareAlike 4.0 International (CC-BY-SA-4.0)
