From 66785e5dcef209c1b0890c169a11dc0a9e241728 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Fri, 8 Jul 2005 19:37:25 +0000 Subject: [PATCH 1/1] New tool to get/update/switch (as appropriate) subdirectories in a tree built with an arch config. --- baz-update-config | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 baz-update-config diff --git a/baz-update-config b/baz-update-config new file mode 100755 index 0000000..e992cf9 --- /dev/null +++ b/baz-update-config @@ -0,0 +1,31 @@ +#! /bin/sh +set -e + +CONFIG="$1" +if [ -z "$CONFIG" ]; then + echo "Usage: $0 CONFIG" >&2 + exit 1 +fi + +NEWLINE=' +' + +IFS_SAVE="$IFS" +IFS="$NEWLINE" +for line in $(baz cat-config "$1"); do + IFS="$IFS_SAVE" + set -- $line + DIR="$1" + VERSION="$2" + + if [ -d "$DIR" ]; then + OLDVERSION="$(baz tree-version -d "$DIR")" + if [ "$VERSION" != "$OLDVERSION" ]; then + baz switch -d "$DIR" "$VERSION" + else + baz update -d "$DIR" "$VERSION" + fi + else + baz get "$VERSION" "$DIR" + fi +done -- 2.30.2