Debian Codegraph @

support/GenericCopy

raw
1 #!/bin/ksh
2 #
3 # GenericCopy -- generically copy lsof 4.x sources to a specified destination
4 #
5 # Usage: GenericCopy <destination> <login> <dialect> [<directory>]
6 #
7 # <destination> destination host
8 #
9 # <login> login name at destination host
10 #
11 # <dialect> dialect subdirectory name
12 #
13 # [<directory>] directory if other than src/lsof4
14
15 if test $# -lt 1 -o $? -gt 4
16 then
17 echo "Usage: <destination> <login> <dialect> [<directory>]"
18 exit
19 fi
20 D=$1
21 L=$2
22 DSDIR=$3
23 if test $# -eq 4
24 then
25 DDIR=$4
26 else
27 DDIR=src/lsof4
28 fi
29
30 # Set useful definitions.
31
32 SDIR=src/lsof4
33 F="00DIALECTS AFSConfig Configure Customize Inventory arg.c lsof_fields.h common.h main.c misc.c node.c print.c proc.c proto.h regex.h store.c usage.c util.c version"
34
35 cd $HOME/$SDIR
36
37 # Make sure the destination directories exist.
38
39 rsh $D -l $L -n mkdir $DDIR $DDIR/dialects $DDIR/lib $DDIR/dialects/$DSDIR
40
41 # Copy new base directory files to destination.
42
43 rsh $D -l $L -n "(cd $DDIR; rm -f $F)"
44 for i in $F
45 do
46 rcp $i ${L}@${D}:${DDIR}
47 echo "$i \c"
48 done
49 echo ""
50
51 # Remove old files in lib/ and dialects/<dialect>/.
52
53 rsh $D -l $L -n "rm -rf $DDIR/lib/* $DDIR/dialects/$DSDIR/*"
54
55 # Copy lib/*.
56
57 cd lib
58 echo "lib: \c"
59 for i in *.c Makefile.skel
60 do
61 if test ! -d $i
62 then
63 rcp $i ${L}@${D}:${DDIR}/lib
64 echo "$i \c"
65 fi
66 done
67 echo ""
68
69 # Copy dialects/<dialect>/*.
70
71 cd ../dialects/$DSDIR
72 echo "dialects/$DSDIR: \c"
73 for i in *
74 do
75 if test -d $i
76 then
77 if test $i != OLD -a $i != NEW -a $i != RCS
78 then
79 rcp -r $i ${L}@${D}:${DDIR}/dialects/$DSDIR
80 echo "$i \c"
81 fi
82 else
83 rcp $i ${L}@${D}:${DDIR}/dialects/$DSDIR
84 echo "$i \c"
85 fi
86 done
87 echo ""
88 echo "done"