* feat: Add `gschema-overrides` module * chore: Clarify "including prefix" section better * chore: Some formatting fix * chore: Don't mention higher prefix, as it can confuse users * fix: Add partial troubleshooting of most preferred gschema-overide It does not support aborting on fail currently, as I have to think on how to implement it when multiple gschema-override files are included in the module. * Revert "fix: Add partial troubleshooting of most preferred gschema-overide" This reverts commit 1dde51938e45648c7f53b696e61249339a2eb277. * fix: Use `z1-` prefix for to avoid future conflict with Universal Blue images * chore: Fix some README remarks from xynydev * chore: Note that GTK DEs other than Gnome are also supported * chore: Be more specific about GTK-based DEs * chore: Clarify using module section a tiny bit better * chore: Add editing gschema.overrides section & make README formatting cleaner * chore: Reword some sentences better * fix: don't use multiple toplevel headings, replace <br> tags with spammed spaces --------- Co-authored-by: xyny <60004820+xynydev@users.noreply.github.com>
49 lines
1.6 KiB
Bash
49 lines
1.6 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
get_yaml_array INCLUDE '.include[]' "$1"
|
|
|
|
schema_test_location="/tmp/bluebuild-schema-test"
|
|
schema_location="/usr/share/glib-2.0/schemas"
|
|
gschema_extension=false
|
|
|
|
echo "Installing gschema-overrides module"
|
|
|
|
# Abort build if file in module is not included
|
|
if [[ ${#INCLUDE[@]} == 0 ]]; then
|
|
echo "Module failed because gschema-overrides aren't included into the module."
|
|
exit 1
|
|
fi
|
|
|
|
# Abort build if included file does not have .gschema.override extension
|
|
if [[ ${#INCLUDE[@]} -gt 0 ]]; then
|
|
for file in "${INCLUDE[@]}"; do
|
|
file="${file//$'\n'/}"
|
|
if [[ $file == *.gschema.override ]]; then
|
|
gschema_extension=true
|
|
else
|
|
echo "Module failed because included files in module don't have .gschema.override extension."
|
|
exit 1
|
|
fi
|
|
done
|
|
fi
|
|
|
|
# Apply gschema-override when all conditions above are satisfied
|
|
if [[ ${#INCLUDE[@]} -gt 0 ]] && $gschema_extension; then
|
|
printf "Applying the following gschema-overrides:\n"
|
|
for file in "${INCLUDE[@]}"; do
|
|
file="${file//$'\n'/}"
|
|
printf "%s\n" "$file"
|
|
done
|
|
mkdir -p "$schema_test_location" "$schema_location"
|
|
find "$schema_location" -type f ! -name "*.gschema.override" -exec cp {} "$schema_test_location" \;
|
|
for file in "${INCLUDE[@]}"; do
|
|
file_path="${schema_location}/${file//$'\n'/}"
|
|
cp "$file_path" "$schema_test_location"
|
|
done
|
|
echo "Running error-checking test for your gschema-overrides. If test fails, build also fails."
|
|
glib-compile-schemas --strict "$schema_test_location"
|
|
echo "Compiling gschema to include your changes with gschema-override"
|
|
glib-compile-schemas "$schema_location" &>/dev/null
|
|
fi
|