File: cvs-adjustroot

package info (click to toggle)
chiark-utils 4.1.28
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 820 kB
  • ctags: 519
  • sloc: perl: 3,045; ansic: 2,176; sh: 820; makefile: 276; tcl: 228
file content (44 lines) | stat: -rwxr-xr-x 1,326 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash

set -e

usage () { echo >&2 'usage: cvs-adjustroot OLD NEW'; exit 1; }

case "$#.$1" in
4.--reinvoke)	reinvoke=true; shift	;;
*.-*)		usage			;;
2.*)		reinvoke=false		;;
1.*)		usage			;;
0.*)		usage			;;
*)		usage			;;
esac

# Copyright 2004 Ian Jackson <ian@chiark.greenend.org.uk>
#
# This script and its documentation (if any) are free software; you
# can redistribute it and/or modify them under the terms of the GNU
# General Public License as published by the Free Software Foundation;
# either version 3, or (at your option) any later version.
# 
# chiark-named-conf and its manpage are distributed in the hope that
# it will be useful, but WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE.  See the GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License along
# with this program; if not, consult the Free Software Foundation's
# website at www.fsf.org, or the GNU Project website at www.gnu.org.


old="$1"; shift
new="$1"; shift

if $reinvoke; then
	filename="$1";
	cmp -- "$filename" <(printf "%s\n" "$old")
	printf "%s\n" "$new" >"$filename".new
	mv -f -- "$filename".new "$filename"
	exit 0
fi

find -path '*/CVS/Root' -exec cvs-adjustroot --reinvoke "$old" "$new" '{}' ';'