forked from lsof-org/lsof
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GenericSubdir
executable file
·100 lines (89 loc) · 2.61 KB
/
GenericSubdir
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
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/ksh
#
# GenericSubdir -- create generic lsof 4.x distribution subdirectory
#
# Usage: GenericSubdir <dialect> [<suffix>]
#
# <dialect> dialect's subdirectory name
#
# [<suffix>] optional suffix for version number
cd $HOME/src/lsof4
# Get version number.
V=`sed '/VN/s/.ds VN \(.*\)/\1/' version`
if test $? -ne 0
then
echo $V
exit 1
fi
# Handle arguments.
if test $# -lt 1 -o $# -gt 2
then
echo "Usage: <dialect> [<suffix>]"
exit 1
fi
DIALECT=$1
if test $# -eq 2
then
V=${V}$2
fi
# Set variable names.
DIR=lsof_${V}.${DIALECT}
F="00.README.FIRST 00CREDITS 00DCACHE 00DIALECTS 00DIST 00FAQ 00LSOF-L 00PORTING 00QUICKSTART 00README 00TEST 00XCONFIG AFSConfig ChangeLog Configure Customize Inventory arg.c lsof_fields.h lsof.h main.c misc.c node.c print.c proc.c proto.h regex.h store.c usage.c util.c version"
MS=Lsof.8
MD=lsof.8
MF=lsof.man
# Prepare for premature exit.
trap 'rm -rf $DIR; exit' 1 2 3 15
# Make a temporary directory and copy the relevant files to it.
rm -rf $DIR
mkdir $DIR
echo "Copying:\c"
for i in $F
do
echo " $i\c"
cp -r $i $DIR
done
echo " ... done"
echo "Copying lib ...\c"
cp -r lib $DIR/lib
echo " done"
echo "Removing extraneous stuff from lib ...\c"
rm -rf $DIR/lib/RCS $DIR/lib/OLD $DIR/lib/NEW
rm -rf $DIR/lib/Makefile $DIR/lib/*.[oa]
echo " done"
mkdir $DIR/dialects
echo "Copying dialects/${DIALECT} ...\c"
cp -r dialects/${DIALECT} $DIR/dialects
echo " done"
echo "Removing extraneous stuff from dialects/${DIALECT} ...\c"
rm -rf $DIR/dialects/${DIALECT}/distfile.kvm
rm -rf $DIR/dialects/${DIALECT}/Makefile.LOCAL
find ${DIR}/dialects -name OLD -exec rm -rf {} \; > /dev/null 2>&1
find ${DIR}/dialects -name NEW -exec rm -rf {} \; > /dev/null 2>&1
find ${DIR}/dialects -name support -exec rm -rf {} \; > /dev/null 2>&1
find ${DIR}/dialects -name RCS -exec rm -rf {} \; > /dev/null 2>&1
echo " done"
echo "Copying scripts ...\c"
cp -r scripts $DIR
echo " done"
echo "Removing extraneous stuff from scripts ...\c"
rm -rf $DIR/scripts/NEW $DIR/scripts/OLD $DIR/scripts/RCS
echo " done"
echo "Copying tests ...\c"
cp -r tests $DIR
echo " done"
echo "Removing extraneous stuff from tests ...\c"
rm -rf $DIR/tests/NEW $DIR/tests/OLD $DIR/tests/RCS $DIR/tests/*.o
rm -rf $DIR/tests/00README
rm -rf $DIR/tests/config.* $DIR/tests/LTbasic $DIR/tests/LTbigf
rm -rf $DIR/tests/LTdnlc $DIR/tests/LTlock $DIR/tests/LTnfs
rm -rf $DIR/tests/LTnlink $DIR/tests/LTsock $DIR/tests/LTszoff
rm -rf $DIR/tests/LTunix
echo " done"
echo "Producing $MD and $MF ...\c"
soelim < $MS > $DIR/$MD
nroff -man $MS | colcrt - | cat -s > $DIR/$MF
echo " done"
echo "Producing 00MANIFEST ...\c"
(cd $DIR; ls -FR > 00MANIFEST)
echo " done"