0

First of all, I am sorry If this is not the rite place to ask.

Recently, I tried to upload the extension https://extensions.gnome.org/extension/2935/control-blur-effect-on-lock-screen/ to the extensions.gnome.org website.

this link says to make zip -j https://extensions.gnome.org/upload/ to create the zip file. Then to upload.

when I make the zip file with zip -r and try to upload.. It returns error that metadata.json file is not loaded and fails to upload though this file exists.

I must do zip -r to have the compatibility to work the shell extension installed with the command gnome-extensions install nameOfTheExtension

Where as I have seen some gnome-shell-extensions downloaded from the same website are having this.. I mean when you create a zip file with zip -r.

How can I achieve this?

PRATAP
  • 127
  • 3
  • 17

2 Answers2

1

These files must be in the top-level of the Zip:

  • metadata.json
  • extension.js
  • prefs.js (Optional file)
  • stylesheet.css (Optional file)

That is the only requirement. The -r and -j functions are explained by zip --help:

-j junk (don't record) directory names

-r recurse into directories

If all your extension files are in one, top-level directory then -j will work, otherwise it will probably break your directory hierarchy. You can check the layout of a zip with unzip -l.

Typically you will zip with zip -r extension@domain.zip [path with metadata.json]:

$ ls
extensions.js  metadata.json

$ zip -r extension@domain.zip .
  adding: metadata.json (deflated 33%)
  adding: extension.js (deflated 55%)

$ unzip -l extension@domain.zip 
Archive:  extension@domain.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
      194  04-25-2020 17:47   metadata.json
      864  04-25-2020 17:47   extension.js
---------                     -------
     1058                     2 files
andy.holmes
  • 3,383
  • 17
  • 28
0

To complement what andy.holmes suggested, the easiest way to package the extension (which might have a directory inside) is to zip it from inside the extension directory. In my case the directory was the schemas.

Directory structure:

└── my-extension@domain.com
    ├── extension.js
    ├── metadata.json
    └── schemas
        ├── gschemas.compiled
        └── org.gnome.shell.extensions.my-extension.gschema.xml

Zipping:

cd my-extension@domain.com
zip -r my-extension@domain.com.zip *

Short bash script for building the zip:

#!/bin/bash
set -e

TMP_EXTENSION=/tmp/my-extension

# Cleanup previous build
rm -rf $TMP_EXTENSION
rm -f my-extension@domain.com.zip

cp -r my-extension@domain.com $TMP_EXTENSION

# Remove redundant content
rm -rf $TMP_EXTENSION/.git/

cd $TMP_EXTENSION
zip -r my-extension@domain.zip *
sireliah
  • 256
  • 2
  • 7