Creating QNAP NAS store packages

Introduction

In this article, we will be understand about how to create packages for QNAP NAS store. These are minimum required steps, which are required for package creation.

 Preparation

Below are the important points, which we need to remember and cover as we move on.

  • QDK
  • Generate Environment
  • Configure QPKG
  • Customize QPKG routines
  • Add files to QPKG
  • Generate QPKG files

QDK

QDK is used to build QPKG files/applications for QNAP Turbo NAS. You will use QDK to develop your own package for QNAP devices.

QDK itself is available in QPK format and to install it you need to go to App center of QNAP and install it in your QNAP device.

Alternatively, you can also download it from below link and then manually install in your device.

http://download.qnap.com/Storage/Utility/QDK_2.2.4.zip

If QDK is successfully installed you can find it in below location of your NAS device. First login to your NAS device through SSH and check below location.

ls /share/CACHEDEV1_DATA/.qpkg/QDK

Generate Environment

Now next step is to create environment for our package. Let us say our package name is MyQPKG.

Now connect to your device using SSH and execute below command.

[~] ln -s /bin/sh /bin/bash
[~] cd `getcfg QDK Install_Path -f /etc/config/qpkg.conf`
[~] cd  /share/CACHEDEV1_DATA/.qpkg/QDK
[/share/HDA_DATA/.qpkg/QDK] # qbuild --create-env MyQPKG
[/share/HDA_DATA/.qpkg/QDK] # qbuild --create-env MyQPKG

A folder named “MyQPKG” generated

[/share/HDA_DATA/.qpkg/QDK] # ls
MyQPKG/ bin/ qdk* scripts/ template/

[/share/HDA_DATA/.qpkg/QDK] # cd MyQPKG/

[/share/HDA_DATA/.qpkg/QDK/MyQPKG] # ls
arm-x09/ build/ icons/ qpkg.cfg x86/
arm-x19/ config/ package_routines shared/ x86_64/

Configure  Package

Next step is to configure the package details.

Qpkg.cfg is the file where package configuration details are provided.

For eg

# Name of the packaged application.
QPKG_NAME=”MyQPKG”

# Version of the packaged application.
QPKG_VER=”0.1″

# Author or maintainer of the package
QPKG_AUTHOR=”admin”

Customize QPKG routines

This file package_routines contains methods which will called during the application installation/uninstallation process. The names of function are self explanatory .

Content of file “package_routines”

  • pkg_pre_install() : routines before install
  • pkg_install() : routines during install
  • pkg_post_install() : routines after install
  • PKG_PRE_REMOVE : routines before uninstall
  • PKG_MAIN_REMOVE : routines during uninstall
  • PKG_POST_REMOVE : routines after uninstall

Content of file “shared/MyQPKG.sh”

  • Start : routines when starting the QPKG
  • Stop : routines when stoping the QPKG

Add files to package

Next step is to put already compiled (in case if you have compiled code) in their respective architecture folder.

Put files in below folders for different purposes:

  • shared/: Platform-independent files and folders
  • arm-x09/ arm-x19/ arm-x31/ arm-x41(TS-x31+)/ x86/x86_ce53xx/ x86_64/: Platform-dependent files and folders
  • icons/: icon files
  • config/: config files
[/share/HDA_DATA/.qpkg/QDK/MyQPKG] # ls
arm-x09/ build/ icons/ qpkg.cfg x86/
arm-x19/ config/ package_routines shared/ x86_64/

 

Generate QPKG file

Once all files are kept properly you can generate package. Package will saved in build location.

Use below command to build the QPKG file

The QPKG file will be generated in the build folder

[/share/HDA_DATA/.qpkg/QDK/MyQPKG] # qbuild
Creating archive with data files...
Creating archive with control files...
Creating QPKG package...

[/[/share/HDA_DATA/.qpkg/QDK/MyQPKG] # cd build/
[/share/HDA_DATA/.qpkg/QDK/MyQPKG/build] # ls
MyQPKG_0.1.qpkg

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s