chiark / gitweb /
* summer has new -B option for suppressing times of unusual node types.
[chiark-utils.git] / scripts / cvs-adjustroot
1 #!/bin/bash
2
3 set -e
4
5 usage () { echo >&2 'usage: cvs-adjustroot OLD NEW'; exit 1; }
6
7 case "$#.$1" in
8 4.--reinvoke)   reinvoke=true; shift    ;;
9 *.-*)           usage                   ;;
10 2.*)            reinvoke=false          ;;
11 1.*)            usage                   ;;
12 0.*)            usage                   ;;
13 *)              usage                   ;;
14 esac
15
16 # Copyright 2004 Ian Jackson <ian@chiark.greenend.org.uk>
17 #
18 # This script and its documentation (if any) are free software; you
19 # can redistribute it and/or modify them under the terms of the GNU
20 # General Public License as published by the Free Software Foundation;
21 # either version 3, or (at your option) any later version.
22
23 # chiark-named-conf and its manpage are distributed in the hope that
24 # it will be useful, but WITHOUT ANY WARRANTY; without even the
25 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
26 # PURPOSE.  See the GNU General Public License for more details.
27
28 # You should have received a copy of the GNU General Public License along
29 # with this program; if not, consult the Free Software Foundation's
30 # website at www.fsf.org, or the GNU Project website at www.gnu.org.
31
32
33 old="$1"; shift
34 new="$1"; shift
35
36 if $reinvoke; then
37         filename="$1";
38         cmp -- "$filename" <(printf "%s\n" "$old")
39         printf "%s\n" "$new" >"$filename".new
40         mv -f -- "$filename".new "$filename"
41         exit 0
42 fi
43
44 find -path '*/CVS/Root' -exec cvs-adjustroot --reinvoke "$old" "$new" '{}' ';'