File: install-lsof

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 (143 lines) | stat: -rwxr-xr-x 3,229 bytes parent folder | download | duplicates (2)
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/bin/sh
#
# install-lsof <revision> -- install lsof <revision>

DD=/var/ftpd/pub/tools/unix/lsof
# DEBUG DD=/tmp/lsof	# DEBUG
SD=$HOME/src/lsof4/support

# Check for version specification.

if test $# -ne 1
then
  echo "Usage: install-lsof <version>"
  exit 1
fi
R=$1
echo $R | grep '^4\.[0-9]*$' > /dev/null 2>&1
if test $? -ne 0
then
  echo "<revision> must be 4.nn"
  exit 1
fi
SR=`echo $R | sed 's/^4\.\([0-9]*\)$/\1/'`
if test $SR -lt 73
then
  echo "Sub-revision must be 73 or greater."
  exit 1
fi
PR=4.`expr $SR - 1`
PPR=4.`expr $SR - 2`

# Check for the presence of files for the new revision.

err=0
if test ! -f ${SD}/lsof_${R}.man
then
  echo "Creating lsof_${R}.man"
  (cd $SD; ./makeman) > /dev/null
fi
for i in CHECKSUMS_$R ../00FAQ ../00DIST lsof_${R}.man lsof.00INDEX \
	 lsof.README \
	 lsof_${R}.tar.bz2 lsof_${R}.tar.bz2.sig \
	 lsof_${R}.tar.gz lsof_${R}.tar.gz.sig \
	 lsof_${R}.tar.Z  lsof_${R}.tar.Z.sig 
do
  if test ! -f ${SD}/$i
  then
    echo "${SD}/$i not found"
    err=1
  fi
done

# Check for the presence of files for the previous revision.

for i in lsof_${PR}.man \
	 lsof_${PR}.tar.bz2 \
	 lsof_${PR}.tar.bz2.sig \
	 lsof_${PR}.tar.gz \
	 lsof_${PR}.tar.gz.sig \
	 lsof_${PR}.tar.Z \
	 lsof_${PR}.tar.Z.sig 
do
  if test ! -f ${DD}/$i
  then
    echo "${DD}/$i not found"
    err=1
  fi
done

# Quit if there are missing files.

if test $err -ne 0
then
  echo "Quitting because of missing files"
  exit 1
fi

# Archive previous revision files.

for i in CHECKSUMS_$PR lsof_${PR}.man \
	 lsof_${PR}.tar.bz2 lsof_${PR}.tar.bz2.sig \
	 lsof_${PR}.tar.gz  lsof_${PR}.tar.gz.sig  \
	 lsof_${PR}.tar.Z   lsof_${PR}.tar.Z.sig 
do
  if test -f ${DD}/$i
  then
    mv ${DD}/$i ${DD}/OLD
  else
    echo "No ${DD}/$i to archive"
  fi
done

# Remove some previously archived files.  Save the gz archive and signature.

for i in CHECKSUMS_$PPR lsof_${PPR}.man \
	 lsof_${PPR}.tar.bz2  lsof_${PPR}.tar.bz2.sig  \
	 lsof_${PPR}.tar.Z   lsof_${PPR}.tar.Z.sig 
do
  if test -f ${DD}/OLD/$i
  then
    echo "Removing ${DD}/OLD/$i"
    rm -f ${DD}/OLD/$i
  fi
done

# Install new files.

for i in lsof.00INDEX lsof.README 
do
  echo "Installing $i"
  rm -f $DD/$i
  cp ${SD}/$i $DD
  chmod 444 $DD/$i
done
rm -f ${DD}/00INDEX; mv ${DD}/lsof.00INDEX ${DD}/00INDEX
rm -f ${DD}/README; mv ${DD}/lsof.README ${DD}/README
for i in CHECKSUMS_$R lsof_${R}.man \
	 lsof_${R}.tar.bz2 lsof_${R}.tar.bz2.sig \
	 lsof_${R}.tar.gz lsof_${R}.tar.gz.sig \
	 lsof_${R}.tar.Z  lsof_${R}.tar.Z.sig 
do
  echo "Installing $i"
  rm -f $DD/$i
  mv ${SD}/$i $DD
  chmod 444 $DD/$i
done
(cd $DD; rm -f CHECKSUMS; ln -s CHECKSUMS_$R CHECKSUMS; ls -lL CHECKSUMS)
(cd $DD; rm -f lsof_man; ln -s lsof_${R}.man lsof_man; ls -lL lsof_man)
echo "Installing FAQ"
rm -f ${DD}/FAQ; cp ${SD}/../00FAQ ${DD}/FAQ; chmod 644 ${DD}/FAQ
rm -f ${DD}/ChangeLog; cp ${SD}/../00DIST ${DD}/ChangeLog; chmod 644 ${DD}/ChangeLog
for i in bz2 gz Z
do
  rm -f ${DD}/lsof.tar.$i ${DD}/lsof.tar.${i}.sig
  (cd $DD; ln -s lsof_${R}.tar.$i lsof.tar.$i)
  (cd $DD; ln -s lsof_${R}.tar.${i}.sig lsof.tar.${i}.sig)
  (cd $DD; ls -lL lsof.tar.$i lsof.tar.${i}.sig)
done

# Install binaries. (Disabled April 15, 2008.)

#(cd $SD; rdist -f distfile.binaries)
exit 0