| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# install-lsof <revision> -- install lsof <revision> |
| 4 |
|
| 5 |
DD=/var/ftpd/pub/tools/unix/lsof |
| 6 |
# DEBUG DD=/tmp/lsof # DEBUG |
| 7 |
SD=$HOME/src/lsof4/support |
| 8 |
|
| 9 |
# Check for version specification. |
| 10 |
|
| 11 |
if test $# -ne 1 |
| 12 |
then |
| 13 |
echo "Usage: install-lsof <version>" |
| 14 |
exit 1 |
| 15 |
fi |
| 16 |
R=$1 |
| 17 |
echo $R | grep '^4\.[0-9]*$' > /dev/null 2>&1 |
| 18 |
if test $? -ne 0 |
| 19 |
then |
| 20 |
echo "<revision> must be 4.nn" |
| 21 |
exit 1 |
| 22 |
fi |
| 23 |
SR=`echo $R | sed 's/^4\.\([0-9]*\)$/\1/'` |
| 24 |
if test $SR -lt 73 |
| 25 |
then |
| 26 |
echo "Sub-revision must be 73 or greater." |
| 27 |
exit 1 |
| 28 |
fi |
| 29 |
PR=4.`expr $SR - 1` |
| 30 |
PPR=4.`expr $SR - 2` |
| 31 |
|
| 32 |
# Check for the presence of files for the new revision. |
| 33 |
|
| 34 |
err=0 |
| 35 |
if test ! -f ${SD}/lsof_${R}.man |
| 36 |
then |
| 37 |
echo "Creating lsof_${R}.man" |
| 38 |
(cd $SD; ./makeman) > /dev/null |
| 39 |
fi |
| 40 |
for i in CHECKSUMS_$R ../00FAQ ../00DIST lsof_${R}.man lsof.00INDEX \ |
| 41 |
lsof.README \ |
| 42 |
lsof_${R}.tar.bz2 lsof_${R}.tar.bz2.sig \ |
| 43 |
lsof_${R}.tar.gz lsof_${R}.tar.gz.sig \ |
| 44 |
lsof_${R}.tar.Z lsof_${R}.tar.Z.sig |
| 45 |
do |
| 46 |
if test ! -f ${SD}/$i |
| 47 |
then |
| 48 |
echo "${SD}/$i not found" |
| 49 |
err=1 |
| 50 |
fi |
| 51 |
done |
| 52 |
|
| 53 |
# Check for the presence of files for the previous revision. |
| 54 |
|
| 55 |
for i in lsof_${PR}.man \ |
| 56 |
lsof_${PR}.tar.bz2 \ |
| 57 |
lsof_${PR}.tar.bz2.sig \ |
| 58 |
lsof_${PR}.tar.gz \ |
| 59 |
lsof_${PR}.tar.gz.sig \ |
| 60 |
lsof_${PR}.tar.Z \ |
| 61 |
lsof_${PR}.tar.Z.sig |
| 62 |
do |
| 63 |
if test ! -f ${DD}/$i |
| 64 |
then |
| 65 |
echo "${DD}/$i not found" |
| 66 |
err=1 |
| 67 |
fi |
| 68 |
done |
| 69 |
|
| 70 |
# Quit if there are missing files. |
| 71 |
|
| 72 |
if test $err -ne 0 |
| 73 |
then |
| 74 |
echo "Quitting because of missing files" |
| 75 |
exit 1 |
| 76 |
fi |
| 77 |
|
| 78 |
# Archive previous revision files. |
| 79 |
|
| 80 |
for i in CHECKSUMS_$PR lsof_${PR}.man \ |
| 81 |
lsof_${PR}.tar.bz2 lsof_${PR}.tar.bz2.sig \ |
| 82 |
lsof_${PR}.tar.gz lsof_${PR}.tar.gz.sig \ |
| 83 |
lsof_${PR}.tar.Z lsof_${PR}.tar.Z.sig |
| 84 |
do |
| 85 |
if test -f ${DD}/$i |
| 86 |
then |
| 87 |
mv ${DD}/$i ${DD}/OLD |
| 88 |
else |
| 89 |
echo "No ${DD}/$i to archive" |
| 90 |
fi |
| 91 |
done |
| 92 |
|
| 93 |
# Remove some previously archived files. Save the gz archive and signature. |
| 94 |
|
| 95 |
for i in CHECKSUMS_$PPR lsof_${PPR}.man \ |
| 96 |
lsof_${PPR}.tar.bz2 lsof_${PPR}.tar.bz2.sig \ |
| 97 |
lsof_${PPR}.tar.Z lsof_${PPR}.tar.Z.sig |
| 98 |
do |
| 99 |
if test -f ${DD}/OLD/$i |
| 100 |
then |
| 101 |
echo "Removing ${DD}/OLD/$i" |
| 102 |
rm -f ${DD}/OLD/$i |
| 103 |
fi |
| 104 |
done |
| 105 |
|
| 106 |
# Install new files. |
| 107 |
|
| 108 |
for i in lsof.00INDEX lsof.README |
| 109 |
do |
| 110 |
echo "Installing $i" |
| 111 |
rm -f $DD/$i |
| 112 |
cp ${SD}/$i $DD |
| 113 |
chmod 444 $DD/$i |
| 114 |
done |
| 115 |
rm -f ${DD}/00INDEX; mv ${DD}/lsof.00INDEX ${DD}/00INDEX |
| 116 |
rm -f ${DD}/README; mv ${DD}/lsof.README ${DD}/README |
| 117 |
for i in CHECKSUMS_$R lsof_${R}.man \ |
| 118 |
lsof_${R}.tar.bz2 lsof_${R}.tar.bz2.sig \ |
| 119 |
lsof_${R}.tar.gz lsof_${R}.tar.gz.sig \ |
| 120 |
lsof_${R}.tar.Z lsof_${R}.tar.Z.sig |
| 121 |
do |
| 122 |
echo "Installing $i" |
| 123 |
rm -f $DD/$i |
| 124 |
mv ${SD}/$i $DD |
| 125 |
chmod 444 $DD/$i |
| 126 |
done |
| 127 |
(cd $DD; rm -f CHECKSUMS; ln -s CHECKSUMS_$R CHECKSUMS; ls -lL CHECKSUMS) |
| 128 |
(cd $DD; rm -f lsof_man; ln -s lsof_${R}.man lsof_man; ls -lL lsof_man) |
| 129 |
echo "Installing FAQ" |
| 130 |
rm -f ${DD}/FAQ; cp ${SD}/../00FAQ ${DD}/FAQ; chmod 644 ${DD}/FAQ |
| 131 |
rm -f ${DD}/ChangeLog; cp ${SD}/../00DIST ${DD}/ChangeLog; chmod 644 ${DD}/ChangeLog |
| 132 |
for i in bz2 gz Z |
| 133 |
do |
| 134 |
rm -f ${DD}/lsof.tar.$i ${DD}/lsof.tar.${i}.sig |
| 135 |
(cd $DD; ln -s lsof_${R}.tar.$i lsof.tar.$i) |
| 136 |
(cd $DD; ln -s lsof_${R}.tar.${i}.sig lsof.tar.${i}.sig) |
| 137 |
(cd $DD; ls -lL lsof.tar.$i lsof.tar.${i}.sig) |
| 138 |
done |
| 139 |
|
| 140 |
# Install binaries. (Disabled April 15, 2008.) |
| 141 |
|
| 142 |
#(cd $SD; rdist -f distfile.binaries) |
| 143 |
exit 0 |