You are not logged in.

#1 2019-02-11 19:30:29

beaker21
Member
Registered: 2019-01-10
Posts: 5

PKGBUILD for Chromium Extensions (keepassxc-browser)

Looking at creating a PKGBUILD to build keepassxc-browser from the sources on git, and curious to get some assistance in making the PKGBUILD.

Looking at the source, there appear to be a lot of .js files and a couple .css.

What would be the right procedure to build the resulting .crx chrome extension from the sources?

I'm anticipating having to install it manually into chromium, but would like to be able to build the .crx myself.

Is there a general way to go about this? I looked through the AUR for examples, but didn't really find anything that looked close to what I want to do.

Source is here:

https://github.com/keepassxreboot/keepa … xc-browser

https://github.com/keepassxreboot/keepa … r/releases

Last edited by beaker21 (2019-02-11 19:31:43)

Offline

#2 2019-02-11 19:56:08

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: PKGBUILD for Chromium Extensions (keepassxc-browser)

It's possible you just treat the entire git repository as the unzipped contents of the crx. There does not appear to be any instructions for building it, so perhaps there is no build step?


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#3 2019-02-14 19:57:01

beaker21
Member
Registered: 2019-01-10
Posts: 5

Re: PKGBUILD for Chromium Extensions (keepassxc-browser)

I figured it out after reading quite a bit.

So all you have to do is go to chrome://extensions and turn on developer options and you can pack it directly from chromium by using the options on the extensions page to select the directory where the extension resides.

It outputs a .pem file and the .crx file, the .crx file can then be loaded manually into chromium by drag-and-drop onto the extensions page. The .pem is used to sign the .crx, and needed to update the .crx if you're developing your own extension.

Alternatively there are options to use the command line with the chrome / chromium / vivaldi (whatever the binary name is) to pack the extension from the command line.

I did run into a small problem with creating my own keepassxc-browser extension from the git though, when you go to enable the extension in keepassxc then keepassxc itself creates a json in the directory at:

~/.config/{chrome,chromium,vivaldi}/NativeMessagingHosts/org.keepassxc.keepassxc_browser.json

This json contains the plugin ID for keepassxc-browser as provided in the chrome webstore, and if you pack the extension yourself it will have a different plugin ID.  So in order to get the extension to work you have to change the plugin ID that is in the json file that keepassxc creates to enable the browser interface.

Once this is done it works as normal.

Making a PKGBUILD for this would be a bit backwards, unless a different method is used to use the extension.  There is an extension for chromium in the AUR that is packaged so that you enable the extension every time you launch chromium/chrome/vivaldi or whatever by using the command line to start the web browser.

There's no way to load a .crx that I could find from the command line, so while a PKGBUILD for a .crx could be made it would just output the file and allow a user to load into the browser by launching the browser using a command from a shell. Alternatively it takes manual interaction to enable developer options and install the .crx into chromium.

The latter method works for options like ungoogled-chromium, or for those that want to package their own extensions from source.

Extensions loaded this way (with your own extension ID) also won't update from the chrome-web store, and show as being from a source outside the chrome web store.  For chrome to be able to update the extension the extension ID needs to match that of the chrome web store.

Think thats pretty much it, this is resolved.

Offline

#4 2019-02-14 20:57:29

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: PKGBUILD for Chromium Extensions (keepassxc-browser)

It's fully possible to package a *policy* that says a Chromium extension should be installed and updated by the browser. See for example https://aur.archlinux.org/cgit/aur.git/ … stpass#n83

But it just makes the browser download it from the webstore as needed, unlike Firefox where there is a directory in /usr/lib which you can use to store "system" installed extensions which are automatically picked up.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#5 2019-02-16 02:28:12

beaker21
Member
Registered: 2019-01-10
Posts: 5

Re: PKGBUILD for Chromium Extensions (keepassxc-browser)

Thanks for this, I'll take a look at it.

Offline

Board footer

Powered by FluxBB