feat: Fail the module if some crucial metadata.json info is missing

This commit is contained in:
fiftydinar 2024-04-08 20:40:07 +02:00
parent e8c72c87b4
commit c8634b9787
2 changed files with 26 additions and 2 deletions

View file

@ -4,8 +4,8 @@ The `gnome-extensions` module can be used to install Gnome extensions inside sys
This module is universally compatible with all distributions which ship Gnome, as it's not tied to specific distribution packaging format for installing extensions.
Every Gnome extension is compatible for installation.
Only rare intervention that might be needed is for extensions which require some additional system dependencies, like Pano.
Almost every Gnome extension is compatible for installation.
Only rare intervention that might be needed is for extensions which require some additional system dependencies, like Pano.
Thanks to https://extensions.gnome.org which provides end-releases of extensions as zips, it is very easy to maintain this module configuration.
The only maintenance is to bump the extension version when new Fedora/Gnome releases (around every 6 months).
@ -25,3 +25,8 @@ or by simply downloading the zip file from https://extensions.gnome.org & than l
You must assure that version of the extension is compatible with current Gnome version that your image is using.
You can easily see this information when downloading extension from https://extensions.gnome.org
# Known Issues
Some extensions like GSConnect may lack information in metadata.json, like lack of `uuid`, `settings-schema` or `shell-version` key,
which is necessary for the module to automatically install extension. Developer can easily fix this issue, so it's advised to inform him if this issue occured.

View file

@ -28,6 +28,25 @@ if [[ ${#GETTEXT_DOMAIN[@]} -gt 0 ]]; then
UUID=$(yq '.uuid' < "${TMP_DIR}/metadata.json")
SCHEMA_ID=$(yq '.settings-schema' < "${TMP_DIR}/metadata.json")
EXT_GNOME_VER=$(yq '.shell-version[]' < "${TMP_DIR}/metadata.json")
# Some extensions like GSConnect don't have schema_id information for some reason
# So if that's the case, fail the build & notify the user about it
# I will try to find the workaround for this,
# maybe as manual input inside the recipe
if [[ "${UUID}" == "null" ]]; then
echo "ERROR: Extension ${EXTENSION} doesn't have UUID inside metadata.json"
echo "You may inform the extension developer about this error, as he can fix it"
exit 1
fi
if [[ "${SCHEMA_ID}" == "null" ]]; then
echo "ERROR: Extension ${EXTENSION} doesn't have Schema ID inside metadata.json"
echo "You may inform the extension developer about this error, as he can fix it"
exit 1
fi
if [[ "${EXT_GNOME_VER}" == "null" ]]; then
echo "ERROR: Extension ${EXTENSION} doesn't have Gnome Version inside metadata.json"
echo "You may inform the extension developer about this error, as he can fix it"
exit 1
fi
# Compare if extension is compatible with current Gnome version
if ! [[ "${EXT_GNOME_VER}" =~ "${GNOME_VER}" ]]; then
echo "ERROR: Extension is not compatible with current Gnome v${GNOME_VER}!"