~ubuntu-branches/ubuntu/gutsy/net-snmp/gutsy-security

« back to all changes in this revision

Viewing changes to mibs/mibfetch

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2004-09-13 12:06:21 UTC
  • Revision ID: james.westby@ubuntu.com-20040913120621-g952ntonlleihcvm
Tags: upstream-5.1.1
ImportĀ upstreamĀ versionĀ 5.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
# Usage: mibfetch [ -d outdir ] host directory rfc [mibs]
 
4
#
 
5
# If "rfc" contains a "." it is expected to be a complete file name,
 
6
# otherwise it is assumed to be just the rfc number.
 
7
# If "mibs" is specified, it is a ":" separated list of mibs to extract,
 
8
# otherwise all mibs are extracted.
 
9
#
 
10
# The script fetches the file from the givn directory on the given
 
11
# host, and then runs the file through smistrip to extract the mibs.
 
12
 
 
13
set -e
 
14
 
 
15
if [ "$1" = "-d" ]; then
 
16
  mdir="-d $2"; shift 2
 
17
else
 
18
  mdir=
 
19
fi
 
20
 
 
21
if [ "$1" = "-x" ]; then
 
22
    exact=1; shift
 
23
else
 
24
    exact=0
 
25
fi
 
26
 
 
27
host=$1
 
28
dir=$2
 
29
rfc=$3
 
30
 
 
31
if [ $exact = 0 -a `echo $rfc | sed 's/\.//'` = $rfc ]; then
 
32
  file=rfc$rfc.txt
 
33
else
 
34
  file=$rfc
 
35
fi
 
36
 
 
37
if [ -n "$4" ]; then
 
38
  mibs="-m $4"
 
39
fi
 
40
 
 
41
# ncftpget -FV ftp://$host/$dir/$file
 
42
wget -O - -nv $host/$dir/$file | tr -d \\r > $file
 
43
 
 
44
./smistrip -x .txt $mdir $mibs $file
 
45
 
 
46
rm $file