/usr/bin/rebuild-pysnmp-mibs is in python-pysnmp4-mibs 0.0.5a-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 | #!/bin/bash
#
# Re-build PySNMP MIB/managed objects from MIB text files.
# See http://pysnmp.sf.net for more information.
#
build_pysnmp_mib=build-pysnmp-mib # part of pysnmp distro
while getopts s:d: o
do case "$o" in
s) sourceDirs="$OPTARG $sourceDirs"; export SMIPATH=":$SMIPATH:$OPTARG";;
d) destDir="$OPTARG";;
[?]) echo >&2 "\
Re-build PySNMP MIB/managed objects from MIB text files, http://pysnmp.sf.net.
Usage: $0 [ -s mib-text-dir ] -d pysnmp-mib-rebuild-dir\
"
exit 1;;
esac
done
shift $((OPTIND-1))
[ -z $destDir ] && {
echo >&2 "Re-build directory not specified";
exit 1;
}
[ $# -gt 0 ] && { echo >&2 "Extra arguments given"; exit 1; }
[ -z $sourceDirs ] && {
sourceDirs="/usr/local/share/snmp /usr/local/share/mibs /usr/share/snmp /usr/share/mibs";
}
brokenIndices=""
for origFile in $destDir/*.py; do
[ ! -f $origFile ] && {
continue;
}
mibName=$(echo $origFile | sed -e 's/.*\/\(.*\)\.py/\1/g') || {
echo >&2 "cant get MIB name from $origFile";
continue;
}
mibPath=$(find $sourceDirs -name "$mibName" -o -name "$mibName.txt" 2>/dev/null | head -1)
[ -z $mibPath ] && {
echo >&2 "Missing MIB source for $origFile";
continue;
}
pyMibPath=$destDir/$mibName.py
$build_pysnmp_mib -o $pyMibPath $mibPath || {
echo >&2 "$build_pysnmp_mib failed";
exit 1;
}
echo "$mibPath --> $pyMibPath"
grep -qw IMPLIED $mibPath 2> /dev/null && {
brokenIndices="$mibPath $pyMibPath $brokenIndices";
}
done
[ -n "$brokenIndices" ] && {
echo "The following files might need fixing IMPLIED INDEX'es";
echo $brokenIndices;
}
|