aboutsummaryrefslogtreecommitdiff
path: root/lib/moveplan9.sh
blob: b22801958a685d5ce3946aea26ea9dbe74974fbd (plain)
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
#!/bin/sh

case $# in
0)
	old=/usr/local/plan9
	;;
1)
	old=`cleanname $1`
	;;
*)
	echo 'usage: moveplan9.sh [oldpath]' 1>&2
	exit 1
esac

[ -z "$PLAN9_TARGET" ] && PLAN9_TARGET="$PLAN9"
new=`cleanname $PLAN9_TARGET`

if [ X"$new" = X"" ]
then
	echo cleanname failed 1>&2
	exit 2
fi

cd $PLAN9
# Avoid broken builtin echo in dash that turns \1 into ^A
`which echo` '
	X ,s;'$old'($|/|});'$new'\1;g
	X/'"'"'/w
	q
' | sam -d `cat lib/moveplan9.files` >/dev/null 2>&1