From 8127daa29ea08f357ad9d7ac2afb39207297da14 Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Tue, 26 Mar 2019 18:59:32 +0100 Subject: [PATCH] Add c.gh.debarshiray.toolbox to containers and images from 'create' Commit 0ab6eb7401fb3964 introduced the com.github.debarshiray.toolbox label as a better way to identify toolbox containers and images. It might be necessary to support creating toolbox containers from base toolbox images that are not appropriately labeled. eg., this would allow users to use newer versions of the toolbox script with older base images to debug problems that are only seen in those versions of the images. While no change has been made, yet, to either enforce the presence or override the absence of the com.github.debarshiray.toolbox label it is prudent [1] to ensure that artifacts produced by 'toolbox create' are adequately labeled regardless of what labels the input base image had. [1] https://en.wikipedia.org/wiki/Robustness_principle https://github.com/debarshiray/toolbox/pull/91 --- toolbox | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/toolbox b/toolbox index 75c65f9..156c2a9 100755 --- a/toolbox +++ b/toolbox @@ -262,6 +262,13 @@ configure_working_container() return 1 fi + if ! $prefix_sudo buildah config \ + --label "com.github.debarshiray.toolbox=true" \ + "$working_container_name" >/dev/null 2>&3; then + echo "$base_toolbox_command: failed to add com.github.debarshiray.toolbox=true" >&2 + return 1 + fi + if ! $prefix_sudo buildah config --user "$USER" "$working_container_name" >/dev/null 2>&3; then echo "$base_toolbox_command: failed to configure the default user as $USER" >&2 return 1