diff --git a/modules/gschema-overrides/README.md b/modules/gschema-overrides/README.md index e0c9ed6..2e72da8 100644 --- a/modules/gschema-overrides/README.md +++ b/modules/gschema-overrides/README.md @@ -7,9 +7,10 @@ This module is similar to using `dconf` configuration, but is better because it What does this module do? - It copies all content from `/usr/share/glib-2.0/schemas`, except existing gschema.overrides to avoid conflicts, into temporary test location. -- It copies your gschema.overrides you provided in this module from `/usr/share/glib-2.0/schemas` into temporary test location. +- It copies your gschema.overrides you provided in this module from `config/gschema-overrides` into temporary test location. - It tests them for errors in temporary test location by using `glib-compile-schemas` with `--strict` flag. If errors are found, build will fail. -- If test is passed successfully, compile gschema using `glib-compile-schemas` in `/usr/share/glib-2.0/schemas` to include your changes. +- If test is passed successfully, it copies your gschema.overrides to `/usr/share/glib-2.0/schemas`. +- It compiles gschema using `glib-compile-schemas` in `/usr/share/glib-2.0/schemas` location to include your changes. Temporary test location is: @@ -17,15 +18,15 @@ Temporary test location is: ## Usage -To use this module, you need to include your gschema.override file(s) in this location: +To use this module, you need to include your gschema.override file(s) in this location (make folder if it doesn't exist): -`/usr/share/glib-2.0/schemas` +`config/gschema-overrides` Then you need to include those file(s) in recipe file, like in example configuration. -It is highly recommended to use `z1-` prefix before your gschema.override name, to ensure that your changes are going to be applied. +It is highly recommended to use `zz1-` prefix before your gschema.override name, to ensure that your changes are going to be applied. -Also don't forget to rename your file(s) too with this prefix in `/usr/share/glib-2.0/schemas`. +Also don't forget to rename your file(s) too with this prefix in `config/gschema-overrides`. ## Creating gschema.override files @@ -82,4 +83,4 @@ dconf format: ``` [org/gnome/desktop/app-folders/folders/Utilities] [org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0] -``` \ No newline at end of file +``` diff --git a/modules/gschema-overrides/gschema-overrides.sh b/modules/gschema-overrides/gschema-overrides.sh index 9dcad1f..9342dca 100644 --- a/modules/gschema-overrides/gschema-overrides.sh +++ b/modules/gschema-overrides/gschema-overrides.sh @@ -4,6 +4,7 @@ set -euo pipefail get_yaml_array INCLUDE '.include[]' "$1" +schema_include_location="/tmp/config/gschema-overrides" schema_test_location="/tmp/bluebuild-schema-test" schema_location="/usr/share/glib-2.0/schemas" gschema_extension=false @@ -39,11 +40,15 @@ if [[ ${#INCLUDE[@]} -gt 0 ]] && $gschema_extension; then 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'/}" + file_path="${schema_include_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" + for file in "${INCLUDE[@]}"; do + file_path="${schema_test_location}/${file//$'\n'/}" + cp "$file_path" "$schema_location" + done glib-compile-schemas "$schema_location" &>/dev/null fi diff --git a/modules/gschema-overrides/module.yml b/modules/gschema-overrides/module.yml index bdb7e20..ea513c5 100644 --- a/modules/gschema-overrides/module.yml +++ b/modules/gschema-overrides/module.yml @@ -4,4 +4,4 @@ readme: https://raw.githubusercontent.com/ublue-os/bling/main/modules/gschema-ov example: | type: gschema-overrides include: - - z1-myoverride.gschema.override # test & compile the override file /usr/share/glib-2.0/schemas/z1-myoverride.gschema.override \ No newline at end of file + - zz1-myoverride.gschema.override # test & compile the override file included in config/gschema-overrides/zz1-myoverride.gschema.override