Bundling ubuntu-core with local snap files


#1

I am bundling ubuntu-core following the steps from https://tutorials.ubuntu.com/tutorial/create-your-own-core-image#4. Is there a way to pre install a local snap file at the image. I have customized snaps that I don’t want to publish.

Thanks! :pray:


#2

You can pass local snaps using --extra-snaps with ubuntu-image.

Eg.

ubuntu-image --image-size 4G \
  --extra-snaps localhack*.snap \
  model

#3

Thanks @chihchun, that works smooth! Is there a way to fetch the keys from a snap account or import/export keys locally? I have an ephemeral build machine and don’t want to create and register a new key on each build.


#4

Let me answer this one myself :). There is a way to import/export keys:

# import
gpg --homedir=.snap/gnupg --passphrase mypassword --allow-secret-key-import --import /tmp/my.key 

# export
gpg --homedir=.snap/gnupg --export-secret-keys