[PATCH 1/2][kteam-tools] cranky: chroot: add subcommand to update chroots.

Zachary Tahenakos zachary.tahenakos at canonical.com
Mon Jan 10 14:56:26 UTC 2022


Convenience command for what create-base and create-session already do if the chroot/session already exists.

Signed-off-by: Zachary Tahenakos <zachary.tahenakos at canonical.com>
---
 cranky/cmds.d/chroot | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/cranky/cmds.d/chroot b/cranky/cmds.d/chroot
index 7cf5d9f1..dfea331e 100755
--- a/cranky/cmds.d/chroot
+++ b/cranky/cmds.d/chroot
@@ -163,6 +163,8 @@ commands:
       Create a base sbuilder chroot for the series of the handle package.
   create-session configs|sources [<handle>]
       Create a session for the requested purpose.
+  update [<handle>]
+      Updates the requested handle's packages.
   map-session configs|sources [<handle>]
       Emit the name of the required session if available.
   run [<handle>] -- command
@@ -202,7 +204,7 @@ EOF
 cmd="$1"
 shift
 case "$cmd" in
-create-base)
+create-base|update)
 	if [ "$#" -eq 0 ]; then
 		set - "$@" "$PWD"
 	elif [ "$#" -ne 1 ]; then
@@ -290,6 +292,15 @@ create-session)
 		session_chroot_create "$series" "amd64" "$src" "$session"
 	fi
 	;;
+update)
+	if base_chroot_available "$series" "amd64"; then
+		chroot_update "$RET"
+	else
+		echo "$P: Chroot does not exist to update" 1>&2
+		echo "Use \"$p create-base\" to create it" 1>&2
+		exit 1
+	fi
+	;;
 map-session)
 	if session_chroot_available "$series" "amd64" "$src" "$session"; then
 		echo "$RET"
-- 
2.25.1




More information about the kernel-team mailing list