Coda File System

what about adding such cfs subcommand?

From: <u+codalist-p4pg_at_chalmers.se>
Date: Thu, 28 Feb 2008 09:52:07 +0100
Hello!

As I needed the functionality, I wrote a small script around "cfs fr"
and then thought that it might be useful for someone else.

The most convenient and reliable solution would be to have
a cfs subcommand like

cfs rr <dir> [<max-retries>/<max-time?>]            (rr - reallyreintegrate)

While it is not (yet?) there, the following script fills the "gap":

--------------------------------------------------------------------------
#!/bin/sh
# This script loops until no CML entries remain.
# In case of an unexpected error it produces a message and returns 1.
# In case of a conflict it produces a message and returns 2.
#
# If the extra numeric arguiment is given and exceeded by the number
# of retries, the script produces an appropriate message and returns 3.
#
# Needs [, cfs, echo, expr.
#
# (c) Rune L, 2008-02-28
# No warranty. Use, distribute and modify at will, but do not omit
# the copyright, disclaimer and this permission.
#

really_reintegrate_coda(){
  [ "$#" = 1 ] || [ "$#" = 2 ] || {
    echo "use: really_reintegrate_coda <dir> [<count-limit>]" >&2
    return 1
  }
  r_r_iterations=""
  [ "$#" = 2 ] && r_r_iterations="$2"
  while :; do
    [ "$r_r_iterations" != "" ] && {
      [ "$r_r_iterations" -lt 1 ] && {
        echo "retry limit exceeded" >&2
        return 3
      }
      r_r_iterations=`expr "$r_r_iterations" - 1`
    }
    r_r_status=`cfs fr "$1"`
    case "$r_r_status" in
    *"conflict"*) echo "$r_r_status" >&2; return 2 ;;
    *"reintegrated to server") return 0 ;;
    *"CML entries remaining for volume"*) ;;
    *) echo "unexpected cfs output '$r_r_status'" >&2; return 1 ;;
    esac
  done
}

really_reintegrate_coda "$@"

exit
--------------------------------------------------------------------------

Feel free to add, say, '-v' flag to display
the number of remaining CMLs [and remaining iterations] :)

Regards,
Rune
Received on 2008-02-28 03:54:04