The classic-launch launcher: Strict confinement-like runtime environment for classic confinement snaps

This launcher sets up the runtime environment so that the snapped application can load the libraries and commands shipped in the snap.

This launcher is used in classic confinement snaps as by default Snapcraft didn’t set-up any environment for them(for a reason). You should patch your application to use a vanilla environment if your application will call external programs out-of-snap.

How to use

  1. Merge the following part definition to your Snapcraft recipe:

    parts:
      classic-launch:
        source: https://github.com/Lin-Buo-Ren/classic-launch.git
        source-tag: v1.0.0
        plugin: dump
        stage:
          - bin/classic-launch
    
  2. In the apps stanza, insert bin/classic-launch into the command chain:

    apps:
      _app_name_:
        # The command to run the application, the value should be a *relative path* to an executable file rooted from the `prime` directory
        command: bin/classic-launch "${SNAP}"/bin/_app_command_
    

    if you’re using the full adapter:

    apps:
      _app_name_:
        # The environment adapter style to use, `command-chain` is only supported
        adapter: full
    
        # The command to run the application, the value should be a *relative path* to an executable file rooted from the `prime` directory
        command: bin/_app_command_
        command-chain:
        - bin/classic-launch
    

The implementation

Snaps that use this stage snap

T.B.A.


Happy snapcrafting!

This seems like it could also be useful for snaps that attempt to support shipping executables via the content interface for strict snaps to use them. Granted, this is somewhat fraught in general because the called program will operate within the security sandbox of the calling program, but this could still be quite useful.

1 Like

Can this (and snap-arch-triplet-part) be used with core18/core20?
(I know it’s a very old post, but the repo seems to be still updated)

It should be usable.