Generate a SimpleSwitch™ package#

The simpleswitch-generate-package script helps to create SimpleSwitch™ packages from existing templates, without requiring to use Yocto. It will merge the template files and your own file to generate a SimpleSwitch™ package and its manifest fragment.

SimpleSwitch™ Package Creation Example#

Copying your own files over the SimpleSwitch™ template can be done using the following command

$ simpleswitch-generate-package --name simpleswitch-example --copy-dir deploy_dir \
     --template c --startup-command /usr/bin/c_test_prog
This will generate two files:
  • simpleswitch-example.ext4: A filesystem containing the merge of the template and your files. It needs to be deployed in the /apps folder of the target.

  • simpleswitch-example.simpleswitchpackage: A fragment of SimpleSwitch™ manifest. It needs to be concatenated to the /apps/simpleswitch-manifest.yaml file on the target.

Directory deploy_dir must contain all files to copy in the package, in a structure reflecting its hierarchy in the package

$ find deploy_dir -printf "%y %p\n"
d deploy_dir
d deploy_dir/usr
d deploy_dir/usr/bin
f deploy_dir/usr/bin/c_test_prog

template can be changed according to the desired template, run simpleswitch-generate-package --help to list all supported templates.

Finally, the startup command is specified using the --startup-command parameter.

Advanced usage#

Detailed usage of simpleswitch-generate-package#

$ simpleswitch-generate-package --help
Usage: simpleswitch-generate-package
Options:
        -n|--name package                       # Set the output package name.
        -S|--size size                          # Set the output filesystem size in kilobytes (default: automatic).
        --size-factor                           # Set the factor used to compute automatic filesystem size (default: 1.2).
        -c|--copy-dir directory[:destination_prefix]            # Add a directory to recursively copy in package.
        -m|--makefile-dir directory             # Add a directory in which to run 'make install'.
        -s|--startup-command command            # Set the command to run on application start.
        -I|--install-command command            # Set the command to run on package installation.
        -U|--uninstall-command command          # Set the command to run on package removal.
        -t|--template                           # Set the template package to use (possible values: python,qt,c,flutter).
        -d|--debug                              # Start the container in debug mode.
        -D|--depends-on                         # Set the package dependencies.
        -u|--allow-update                       # Allow to reuse files from the previous build.
        -w|--work-dir                           # Set the output directory.
        -p|--storage-size                       # Set the size of the persistent container storage in bytes.
        -a|--bind-src-path                      # Add a source path for a bind mount. This option can be repeated.
        -b|--bind-dst-path                      # Add a destination path for a bind mount. This option can be repeated.
        -N|--no-autostart                       # Disable the autostart of the app.