-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUP
executable file
·64 lines (62 loc) · 1.24 KB
/
UP
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env mksh
# $Id: UP,v 1.17 2014/04/25 20:49:22 root Exp $
# sync MirOS CVS repo from primary anoncvs mirror
# (or other mirrors)
what=/cvs
nani=miros-cvs
for rsync in rsync rsync-static false; do
$rsync --version >/dev/null 2>&1 && break
done
if [[ $rsync = false ]]; then
echo >&2 Error: cannot find rsync
exit 1
fi
if wd=$(realpath .); then
vd=$(realpath $(dirname $0))
else
wd=$(pwd)
cd $(dirname $0)
vd=$(pwd)
fi
cd $vd
p=
a=0
sshx="--rsh=ssh -T"
while :; do
if [[ $1 = -H ]]; then
: ${CVSROOT:[email protected]:$what}
shift
elif [[ $1 = -J ]]; then
: ${CVSROOT:=rsync://rsync.allbsd.org/$nani}
shift
elif [[ $1 = -W ]]; then
: ${CVSROOT:[email protected]:$what}
shift
elif [[ $1 = -4 ]]; then
sshx="$sshx -4"
shift
else
break
fi
done
case $1 {
(q) p= ;;
(c) p=-cPv ;;
(C) p=-c ;;
(v) p=-v ;;
(*) p=-Pv ;;
}
[[ -n $1 || -n $2 ]] && shift
[[ -e $HOME/.etc/anonkey.mirbsd ]] && sshx="$sshx -i $HOME/.etc/anonkey.mirbsd"
[[ $CVSROOT = rsync://* ]] && sshx=
set -x
nice $rsync -rxlztpgaHS --delete --stats --exclude=/ign/ \
--numeric-ids ${sshx:+"$sshx"} $p "$@" \
${CVSROOT:[email protected]:$what}/ $vd/
rv=$?
cd $wd
if [[ $a = 1 ]]; then
umount $vd || rv=1
mount $vd || rv=1
fi
exit $rv