feat: Copy icons if they exist & add better checks for gschema

This commit is contained in:
fiftydinar 2024-04-09 13:58:53 +02:00
parent 1ed844fd85
commit 6f8cef496c

View file

@ -31,39 +31,58 @@ if [[ ${#GETTEXT_DOMAIN[@]} -gt 0 ]]; then
# If extension does not have the important key in metadata.json, # If extension does not have the important key in metadata.json,
# inform the user & fail the build # inform the user & fail the build
if [[ "${UUID}" == "null" ]]; then if [[ "${UUID}" == "null" ]]; then
echo "ERROR: Extension ${EXTENSION_NAME} doesn't have 'uuid' key inside metadata.json" echo "ERROR: Extension '${EXTENSION_NAME}' doesn't have 'uuid' key inside metadata.json"
echo "You may inform the extension developer about this error, as he can fix it" echo "You may inform the extension developer about this error, as he can fix it"
exit 1 exit 1
fi fi
if [[ "${EXT_GNOME_VER}" == "null" ]]; then if [[ "${EXT_GNOME_VER}" == "null" ]]; then
echo "ERROR: Extension ${EXTENSION_NAME} doesn't have 'shell-version' key inside metadata.json" echo "ERROR: Extension '${EXTENSION_NAME}' doesn't have 'shell-version' key inside metadata.json"
echo "You may inform the extension developer about this error, as he can fix it" echo "You may inform the extension developer about this error, as he can fix it"
exit 1 exit 1
fi fi
# Compare if extension is compatible with current Gnome version # Compare if extension is compatible with current Gnome version
# If extension is not compatible, inform the user & fail the build # If extension is not compatible, inform the user & fail the build
if ! [[ "${EXT_GNOME_VER}" =~ "${GNOME_VER}" ]]; then if ! [[ "${EXT_GNOME_VER}" =~ "${GNOME_VER}" ]]; then
echo "ERROR: Extension ${EXTENSION_NAME} is not compatible with current Gnome v${GNOME_VER}!" echo "ERROR: Extension '${EXTENSION_NAME}' is not compatible with current Gnome v${GNOME_VER}!"
exit 1 exit 1
fi fi
# Install main extension files # Install main extension files
echo "Installing main extension files" echo "Installing main extension files"
install -d -m 0755 "/usr/share/gnome-shell/extensions/${UUID}/" install -d -m 0755 "/usr/share/gnome-shell/extensions/${UUID}/"
find "${TMP_DIR}" -mindepth 1 -maxdepth 1 ! -path "*locale*" ! -path "*schemas*" -exec cp -r {} "/usr/share/gnome-shell/extensions/${UUID}/" \; find "${TMP_DIR}" -mindepth 1 -maxdepth 1 ! -path "*locale*" ! -path "*schemas*" ! -path "*icons*" -exec cp -r {} "/usr/share/gnome-shell/extensions/${UUID}/" \;
find "/usr/share/gnome-shell/extensions/${UUID}" -type d -exec chmod 0755 {} + find "/usr/share/gnome-shell/extensions/${UUID}" -type d -exec chmod 0755 {} +
find "/usr/share/gnome-shell/extensions/${UUID}" -type f -exec chmod 0644 {} + find "/usr/share/gnome-shell/extensions/${UUID}" -type f -exec chmod 0644 {} +
# Install schema # Install schema
echo "Installing schema extension file" if [[ -d "${TMP_DIR}/schemas" ]]; then
install -d -m 0755 "/usr/share/glib-2.0/schemas/" echo "Installing schema extension file"
install -D -p -m 0644 "${TMP_DIR}/schemas/"*.gschema.xml "/usr/share/glib-2.0/schemas/" install -d -m 0755 "/usr/share/glib-2.0/schemas/"
install -D -p -m 0644 "${TMP_DIR}/schemas/"*.gschema.xml "/usr/share/glib-2.0/schemas/"
else
echo "ERROR: Extension '${EXTENSION_NAME}' doesn't supply crucial gschema.xml file."
echo " Please contact extension developer about this issue."
exit 1
fi
# Install languages # Install languages
echo "Installing language extension files" # Locale is not crucial for extensions to work, as they will fallback to gschema.xml
install -d -m 0755 "/usr/share/locale/" # Some of them might not have any locale at the moment
cp -r "${TMP_DIR}/locale"/* "/usr/share/locale/" # So that's why I made a check for directory
if [[ -d "${TMP_DIR}/locale" ]]; then
echo "Installing language extension files"
install -d -m 0755 "/usr/share/locale/"
cp -r "${TMP_DIR}/locale"/* "/usr/share/locale/"
fi
# Install icons if extension uses them
# This is only for extensions which respect XDG icon standard
# Some extensions simply supply icons in the extension folder & they work
if [[ -d "${TMP_DIR}/icons" ]]; then
echo "Installing extension icons"
install -d -m 0755 "/usr/share/icons/"
cp -r "${TMP_DIR}/icons"/* "/usr/share/icons/"
fi
# Delete the temporary directory # Delete the temporary directory
echo "Cleaning up the temporary directory" echo "Cleaning up the temporary directory"
rm -r "${TMP_DIR}" rm -r "${TMP_DIR}"
echo "Extension ${EXTENSION_NAME} is successfully installed" echo "Extension '${EXTENSION_NAME}' is successfully installed"
echo "------------------------------DONE----------------------------------" echo "------------------------------DONE----------------------------------"
done done
else else