summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Müllner <fmuellner@gnome.org>2023-03-17 01:07:56 +0100
committerMarge Bot <marge-bot@gnome.org>2023-05-16 18:20:42 +0000
commit8ea4e089c6dbf907d1d6da8d165e586e76f76a3d (patch)
tree312197884a523288e0bfc2c27d8f65c8fa033191
parenta837285ae3d2fbede734c8c7119dc73f65c361ea (diff)
downloadgnome-shell-8ea4e089c6dbf907d1d6da8d165e586e76f76a3d.tar.gz
tools/create-toolbox: Add convenience script
The script is a thin wrapper around `toolbox create`, mainly to avoid the tedious image names. In addition, it allows us to ensure that the container includes a matching mutter version. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2713>
-rwxr-xr-xtools/toolbox/create-toolbox.sh80
1 files changed, 80 insertions, 0 deletions
diff --git a/tools/toolbox/create-toolbox.sh b/tools/toolbox/create-toolbox.sh
new file mode 100755
index 000000000..9f098a140
--- /dev/null
+++ b/tools/toolbox/create-toolbox.sh
@@ -0,0 +1,80 @@
+#!/bin/sh
+# vi: sw=2 ts=4
+
+set -e
+
+TOOLBOX_IMAGE=registry.gitlab.gnome.org/gnome/gnome-shell/toolbox
+DEFAULT_NAME=gnome-shell-devel
+
+usage() {
+ cat <<-EOF
+ Usage: $(basename $0) [OPTION…]
+
+ Create a toolbox for gnome-shell development
+
+ Options:
+ -n, --name=NAME Create container as NAME instead of the
+ default "$DEFAULT_NAME"
+ -v, --version=VERSION Create container for stable version VERSION
+ (like 44) instead of the main branch
+ -h, --help Display this help
+
+ EOF
+}
+
+die() {
+ echo "$@" >&2
+ exit 1
+}
+
+toolbox_run() {
+ toolbox run --container $NAME "$@"
+}
+
+TEMP=$(getopt \
+ --name $(basename $0) \
+ --options 'n:v:h' \
+ --longoptions 'name:' \
+ --longoptions 'version:' \
+ --longoptions 'help' \
+ -- "$@")
+
+eval set -- "$TEMP"
+unset TEMP
+
+NAME=$DEFAULT_NAME
+
+while true; do
+ case "$1" in
+ -n|--name)
+ NAME="$2"
+ shift 2
+ ;;
+
+ -v|--version)
+ VERSION="$2"
+ shift 2
+ ;;
+
+ -h|--help)
+ usage
+ exit 0
+ ;;
+
+ --)
+ shift
+ break
+ ;;
+ esac
+done
+
+TAG=${VERSION:-main}
+
+if podman container exists $NAME; then
+ die "Container $NAME" already exists
+fi
+
+podman pull $TOOLBOX_IMAGE:$TAG
+
+toolbox create --image $TOOLBOX_IMAGE:$TAG $NAME
+toolbox_run update-mutter