diff options
author | Florian Müllner <fmuellner@gnome.org> | 2023-03-20 15:09:25 +0100 |
---|---|---|
committer | Marge Bot <marge-bot@gnome.org> | 2023-05-16 18:20:42 +0000 |
commit | 36e9db4fb7a18d1e16a8e6d2398ada60a85b9a86 (patch) | |
tree | 386364d636a95f597184e25f15a849ec8e46fc19 | |
parent | 8ea4e089c6dbf907d1d6da8d165e586e76f76a3d (diff) | |
download | gnome-shell-36e9db4fb7a18d1e16a8e6d2398ada60a85b9a86.tar.gz |
tools/create-toolbox: Allow replacing existing toolbox
A toolbox created by the script can be used as the base of a pet
container that is manually updated with new dependencies over time
and accumalates additional packages; or it can be used as a deposable
container that is recreated each time the dependencies change.
To make the latter case more convenient, add a --replace option
that deletes an existing toolbox before creating the new one.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2713>
-rwxr-xr-x | tools/toolbox/create-toolbox.sh | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/toolbox/create-toolbox.sh b/tools/toolbox/create-toolbox.sh index 9f098a140..d7ea27b9c 100755 --- a/tools/toolbox/create-toolbox.sh +++ b/tools/toolbox/create-toolbox.sh @@ -17,6 +17,7 @@ usage() { default "$DEFAULT_NAME" -v, --version=VERSION Create container for stable version VERSION (like 44) instead of the main branch + -r, --replace Replace an existing container -h, --help Display this help EOF @@ -33,9 +34,10 @@ toolbox_run() { TEMP=$(getopt \ --name $(basename $0) \ - --options 'n:v:h' \ + --options 'n:v:rh' \ --longoptions 'name:' \ --longoptions 'version:' \ + --longoptions 'replace' \ --longoptions 'help' \ -- "$@") @@ -56,6 +58,11 @@ while true; do shift 2 ;; + -r|--replace) + REPLACE=1 + shift + ;; + -h|--help) usage exit 0 @@ -71,7 +78,9 @@ done TAG=${VERSION:-main} if podman container exists $NAME; then - die "Container $NAME" already exists + [[ $REPLACE ]] || + die "Container $NAME already exists and --replace was not specified" + toolbox rm --force $NAME fi podman pull $TOOLBOX_IMAGE:$TAG |