From d9c627cf277eb6ad7ada7112027ce13c80a68c18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 17 Mar 2023 10:32:33 +0100 Subject: [PATCH] tools/create-toolbox: Optionally create Builder config It is possible to run gnome-shell nested from gnome-builder, but the setup is fairly tedious. Add another option to the script to generate a suitable .buildconfig file. Part-of: --- tools/toolbox/create-toolbox.sh | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/tools/toolbox/create-toolbox.sh b/tools/toolbox/create-toolbox.sh index 9f9eee070..400290103 100755 --- a/tools/toolbox/create-toolbox.sh +++ b/tools/toolbox/create-toolbox.sh @@ -18,6 +18,7 @@ usage() { -v, --version=VERSION Create container for stable version VERSION (like 44) instead of the main branch -r, --replace Replace an existing container + -b, --builder Set up GNOME Builder configuration --skip-mutter Do not build mutter -h, --help Display this help @@ -33,12 +34,33 @@ toolbox_run() { toolbox run --container $NAME "$@" } +create_builder_config() { + local container_id=$(podman container inspect --format='{{.Id}}' $NAME) + local top_srcdir=$(realpath $(dirname $0)/../..) + local wayland_display=builder-wayland-0 + + cat >> $top_srcdir/.buildconfig <<-EOF + + [toolbox-$NAME] + name=$NAME Toolbox + runtime=podman:$container_id + prefix=/usr + run-command=dbus-run-session gnome-shell --nested --wayland-display=$wayland_display + + [toolbox-$NAME.runtime_environment] + WAYLAND_DISPLAY=$wayland_display + G_MESSAGES_DEBUG=GNOME Shell + XDG_DATA_DIRS=${XDG_DATA_DIRS:-/usr/local/share:/usr/share} + EOF +} + TEMP=$(getopt \ --name $(basename $0) \ - --options 'n:v:rh' \ + --options 'n:v:rbh' \ --longoptions 'name:' \ --longoptions 'version:' \ --longoptions 'replace' \ + --longoptions 'builder' \ --longoptions 'skip-mutter' \ --longoptions 'help' \ -- "$@") @@ -65,6 +87,11 @@ while true; do shift ;; + -b|--builder) + SETUP_BUILDER=1 + shift + ;; + --skip-mutter) SKIP_MUTTER=1 shift @@ -94,3 +121,5 @@ podman pull $TOOLBOX_IMAGE:$TAG toolbox create --image $TOOLBOX_IMAGE:$TAG $NAME [[ $SKIP_MUTTER ]] || toolbox_run update-mutter + +[[ $SETUP_BUILDER ]] && create_builder_config