tools/toolbox: Allow to set new toolbox as default for other tools

When specified, write out a small config file that can be sourced
by other scripts to pick the default toolbox container.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2935>
This commit is contained in:
Florian Müllner 2023-09-01 03:40:10 +02:00 committed by Marge Bot
parent 98654e5446
commit 5998036dc2

View File

@ -5,6 +5,7 @@ set -e
TOOLBOX_IMAGE=registry.gitlab.gnome.org/gnome/gnome-shell/toolbox
DEFAULT_NAME=gnome-shell-devel
CONFIG_FILE=${XDG_CONFIG_HOME:-$HOME/.config}/gnome-shell-toolbox-tools.conf
usage() {
cat <<-EOF
@ -22,6 +23,8 @@ usage() {
-b, --builder Set up GNOME Builder configuration
--locales=LOCALES Enable support for additional locales LOCALES
--skip-mutter Do not build mutter
--set-default Set as default for other gnome-shell
toolbox tools
-h, --help Display this help
EOF
@ -76,6 +79,11 @@ setup_classic() {
https://gitlab.gnome.org/GNOME/gnome-shell-extensions.git $branch
}
set_default() {
mkdir -p $(dirname $CONFIG_FILE)
echo DEFAULT_TOOLBOX=$NAME > $CONFIG_FILE
}
TEMP=$(getopt \
--name $(basename $0) \
--options 'n:v:rcbh' \
@ -86,6 +94,7 @@ TEMP=$(getopt \
--longoptions 'builder' \
--longoptions 'locales:' \
--longoptions 'skip-mutter' \
--longoptions 'set-default' \
--longoptions 'help' \
-- "$@")
@ -127,6 +136,11 @@ while true; do
shift
;;
--set-default)
SET_DEFAULT=1
shift
;;
--locales)
IFS=" ," LOCALES+=($2)
shift 2
@ -161,3 +175,4 @@ install_extra_packages
[[ $SETUP_CLASSIC ]] && setup_classic
[[ $SETUP_BUILDER ]] && create_builder_config
[[ $SET_DEFAULT ]] && set_default