2

I'm a bit confused, but I can't create a .crx package from the CLI in Linux. In Windows 7 the script worked fine, but in Linux it seems that nothing happens. The popup window that occurs after the packaging process doesn't appear and the .crx is not created at all.

Here's the script.

#!/bin/sh

google-chrome --pack-extension=~/Web/client/ --pack-extension-key=~/Web/client.pem
exit 0

Maybe I'm missing something?

2 Answers 2

0

In Linux, (at least Ubuntu 10.04) google-chrome is a bash script wrapper of the chrome executable.

First, You should find where the chrome executable is. In my case: /opt/google/chrome/chrome

Then, replace it in your script:

#!/bin/sh

/opt/google/chrome/chrome --no-message-box --pack-extension=/extfolder/Web/client/ --pack-extension-key=/extfolder/Web/client.pem
exit 0

It is really important that in the script to specify the full path. For instance, /home/me/Web/client.pem rather than ~/Web/client.pem because as it is a parameter bash does not resolve it.

A better alternative would be defining a bash variable called $CHROME_PATH so it can be easily changed among different *nix platforms.

5
  • well, nothing has changed :( script is still calm and doesn't output/create anything. sp@staypositiveru:~$ /opt/google/chrome/google-chrome --pack-extension=~/Web/client/ --pack-extension-key=~/Web/client.pem sp@staypositiveru:~$ /opt/google/chrome/chrome --pack-extension=~/Web/client/ --pack-extension-key=~/Web/client.pem sp@staypositiveru:~$ Feb 25, 2011 at 6:28
  • @1999 I added the parameter '--no-message-box' (as I have done in my PC but I forgot to add). It works by no opening a new Google Chrome window (like an exclusively CLI mode). Does it works adding that parameter?
    – apose
    Feb 25, 2011 at 19:59
  • well... still the same.. seems strange. i'll try to think about it tomorrow :( Feb 25, 2011 at 20:48
  • 1
    I got it, the issue is the ~, try using instead /home/yourhomefolder
    – apose
    Feb 25, 2011 at 20:55
  • Using the chrome executable directly didn't work for me. (And it's unclear to me why the fact that google-chrome is a wrapper script is even relevant - presumably it passes on its arguments to chrome, so why does it matter that it's a wrapper?) A tentative -1.
    – Mark Amery
    Feb 19, 2017 at 21:03
0

I don't know why packaging with google-chrome on Linux doesn't work, but can at least propose a workaround - use one of the officially-blessed packaging scripts listed at https://developer.chrome.com/extensions/crx#scripts. There is currently one for Bash and one for Ruby.

3
  • 1
    this answer looks more like a comment to the question, maybe adding the content from the URL can improve the answer
    – Avinash R
    Jun 8, 2017 at 17:56
  • 1
    @AvinashR I've rolled back your edit. Not including the script's source code was a deliberate choice; I recognize that some folks will view this as being a link-only answer (and therefore not allowed) in its current form, and they might even be right per the letter of the rules, but I just don't think it helps anybody for me to copy and paste the entire source of a third-party tool (which Google are responsible for hosting and maintaining) into my answer. Doing that will just guarantee that if Google need to update their script, future readers will get an obsolete version of it.
    – Mark Amery
    Jun 9, 2017 at 18:54
  • I added the content as google can remove the same and let the community manage it any other way. I understand that the script can be gone out of sync, but given the URL of the source of the script, it is implied that the script needs be revalidated by the person copy-pasting it in the future (that is why it's told not to copy-paste from SO blindly). So if that time comes when the script is changed by google, any other SO users can choose to edit your answer to keep it updated. If that makes sense, consider adding the edit.
    – Avinash R
    Jun 12, 2017 at 10:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.