summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Müllner <fmuellner@gnome.org>2023-03-20 21:21:36 +0100
committerFlorian Müllner <fmuellner@gnome.org>2023-05-10 21:34:13 +0200
commit96bb0355ca88500b47f3cfe23cd99205f809ba3a (patch)
tree028fa58583e0632023d5cf1a828e09d179ad5e7e
parent83b80abc86a66d9420233efac6273b61774ead34 (diff)
downloadgnome-shell-96bb0355ca88500b47f3cfe23cd99205f809ba3a.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.
-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