summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Müllner <fmuellner@gnome.org>2023-03-20 21:21:36 +0100
committerMarge Bot <marge-bot@gnome.org>2023-05-16 18:20:42 +0000
commit3ab8c5d272bde3eba62f9929bb2bb7fa3b406b6c (patch)
tree730bea4bae873660947bde46bfa52858ec82bc27
parentd9c627cf277eb6ad7ada7112027ce13c80a68c18 (diff)
downloadgnome-shell-3ab8c5d272bde3eba62f9929bb2bb7fa3b406b6c.tar.gz
tools/create-toolbox: Allow enabling additional locales
Out of the box, the container images only support US English. It can sometimes be necessary to use a different locale, so add a convenience flag to enable support for additional locales. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2713>
-rwxr-xr-xtools/toolbox/create-toolbox.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/toolbox/create-toolbox.sh b/tools/toolbox/create-toolbox.sh
index 400290103..c63c49e56 100755
--- a/tools/toolbox/create-toolbox.sh
+++ b/tools/toolbox/create-toolbox.sh
@@ -19,6 +19,7 @@ usage() {
(like 44) instead of the main branch
-r, --replace Replace an existing container
-b, --builder Set up GNOME Builder configuration
+ --locales=LOCALES Enable support for additional locales LOCALES
--skip-mutter Do not build mutter
-h, --help Display this help
@@ -34,6 +35,16 @@ toolbox_run() {
toolbox run --container $NAME "$@"
}
+install_extra_packages() {
+ local -a pkgs
+
+ pkgs+=( ${LOCALES[@]/#/glibc-langpack-} )
+
+ [[ ${#pkgs[@]} > 0 ]] &&
+ toolbox_run su -c "dnf install -y ${pkgs[*]}"
+ true
+}
+
create_builder_config() {
local container_id=$(podman container inspect --format='{{.Id}}' $NAME)
local top_srcdir=$(realpath $(dirname $0)/../..)
@@ -61,6 +72,7 @@ TEMP=$(getopt \
--longoptions 'version:' \
--longoptions 'replace' \
--longoptions 'builder' \
+ --longoptions 'locales:' \
--longoptions 'skip-mutter' \
--longoptions 'help' \
-- "$@")
@@ -69,6 +81,7 @@ eval set -- "$TEMP"
unset TEMP
NAME=$DEFAULT_NAME
+LOCALES=()
while true; do
case "$1" in
@@ -97,6 +110,11 @@ while true; do
shift
;;
+ --locales)
+ IFS=" ," LOCALES+=($2)
+ shift 2
+ ;;
+
-h|--help)
usage
exit 0
@@ -120,6 +138,8 @@ fi
podman pull $TOOLBOX_IMAGE:$TAG
toolbox create --image $TOOLBOX_IMAGE:$TAG $NAME
+install_extra_packages
+
[[ $SKIP_MUTTER ]] || toolbox_run update-mutter
[[ $SETUP_BUILDER ]] && create_builder_config