File: GenericCopy

package info (click to toggle)
lsof 4.99.4%2Bdfsg-2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,924 kB
  • sloc: ansic: 50,680; sh: 8,351; makefile: 1,194; perl: 940; awk: 214
file content (88 lines) | stat: -rwxr-xr-x 1,651 bytes parent folder | download
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/ksh
#
# GenericCopy -- generically copy lsof 4.x sources to a specified destination
#
# Usage: GenericCopy <destination> <login> <dialect> [<directory>]
#
#	 <destination>	destination host
#
#	 <login>	login name at destination host
#
#	 <dialect>	dialect subdirectory name
#
#	 [<directory>]	directory if other than src/lsof4

if test $# -lt 1 -o $? -gt 4
then
  echo "Usage: <destination> <login> <dialect> [<directory>]"
  exit
fi
D=$1
L=$2
DSDIR=$3
if test $# -eq 4
then
  DDIR=$4
else
  DDIR=src/lsof4
fi

# Set useful definitions.

SDIR=src/lsof4
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"

cd $HOME/$SDIR

# Make sure the destination directories exist.

rsh $D -l $L -n mkdir $DDIR $DDIR/dialects $DDIR/lib $DDIR/dialects/$DSDIR

# Copy new base directory files to destination.

rsh $D -l $L -n "(cd $DDIR; rm -f $F)"
for i in $F
do
  rcp $i ${L}@${D}:${DDIR}
  echo "$i \c"
done
echo ""

# Remove old files in lib/ and dialects/<dialect>/.

rsh $D -l $L -n "rm -rf $DDIR/lib/* $DDIR/dialects/$DSDIR/*"

# Copy lib/*.

cd lib
echo "lib: \c"
for i in *.c Makefile.skel
do
  if test ! -d $i
  then
    rcp $i ${L}@${D}:${DDIR}/lib
    echo "$i \c"
  fi
done
echo ""

# Copy dialects/<dialect>/*.

cd ../dialects/$DSDIR
echo "dialects/$DSDIR: \c"
for i in *
do
  if test -d $i
  then
    if test $i != OLD -a $i != NEW -a $i != RCS
    then
      rcp -r $i ${L}@${D}:${DDIR}/dialects/$DSDIR
      echo "$i \c"
    fi
  else
    rcp $i ${L}@${D}:${DDIR}/dialects/$DSDIR
    echo "$i \c"
  fi
done
echo ""
echo "done"