Radix cross Linux

The main Radix cross Linux repository contains the build scripts of packages, which have the most complete and common functionality for desktop machines

452 Commits   2 Branches   1 Tag
     5         kx #!/bin/sh
     5         kx #
     5         kx # $Id$
     5         kx #
     5         kx # this shell script is designed to add new SNMPv3 users
     5         kx # to Net-SNMP config file.
     5         kx 
     5         kx if @PSCMD@ | egrep ' snmpd *$' > /dev/null 2>&1 ; then
     5         kx     echo "Apparently at least one snmpd demon is already running."
     5         kx     echo "You must stop them in order to use this command."
     5         kx     exit 1
     5         kx fi
     5         kx 
     5         kx Aalgorithm="MD5"
     5         kx Xalgorithm="DES"
     5         kx token=rwuser
     5         kx 
     5         kx while test "x$done" = "x" -a "x$1" != "x" -a "x$usage" != "xyes"; do
     5         kx 
     5         kx unset shifted
     5         kx case $1 in
     5         kx     --version|--ver*)
     5         kx       echo @VERSION@
     5         kx       ;;
     5         kx     --help)
     5         kx       usage="yes"
     5         kx       ;;
     5         kx 
     5         kx     -A|-a)
     5         kx 	shift
     5         kx 	if test "x$1" = "x" ; then
     5         kx 	    echo "You must specify an authentication algorithm or pass phrase"
     5         kx 	    exit 1
     5         kx 	fi
     5         kx         case $1 in
     5         kx             MD5|SHA|SHA-512|SHA-384|SHA-256|SHA-224)
     5         kx 	    Aalgorithm=$1
     5         kx 	    shift
     5         kx 	    ;;
     5         kx             md5|sha)
     5         kx 	    Aalgorithm=`echo $1 | tr a-z A-Z`
     5         kx 	    shift
     5         kx 	    ;;
     5         kx             *)
     5         kx 	    apassphrase=$1
     5         kx 	    shift
     5         kx 	    ;;
     5         kx         esac
     5         kx         ;;
     5         kx     -X|-x)
     5         kx 	shift
     5         kx 	if test "x$1" = "x" ; then
     5         kx 	    echo "You must specify an encryption algorithm or pass phrase"
     5         kx 	    exit 1
     5         kx 	fi
     5         kx         case $1 in
     5         kx             DES|AES|AES128)
     5         kx 	    Xalgorithm=$1
     5         kx 	    shift
     5         kx 	    ;;
     5         kx             des|aes|aes128)
     5         kx 	    Xalgorithm=`echo $1 | tr a-z A-Z`
     5         kx 	    shift
     5         kx 	    ;;
     5         kx             *)
     5         kx 	    xpassphrase=$1
     5         kx 	    shift
     5         kx 	    ;;
     5         kx 	esac
     5         kx 	;;
     5         kx     -ro)
     5         kx         token="rouser"
     5         kx 	shift
     5         kx 	;;
     5         kx     -*)
     5         kx 	echo "unknown suboption to $0: $1"
     5         kx 	usage=yes
     5         kx 	done=1
     5         kx 	;;
     5         kx     *)
     5         kx         done=1
     5         kx         ;;
     5         kx     esac
     5         kx done
     5         kx 
     5         kx if test "x$usage" = "xyes"; then
     5         kx     echo ""
     5         kx     echo "Usage:"
     5         kx     echo "  net-snmp-create-v3-user [-ro] [-A authpass] [-X privpass]"
     5         kx     echo "                          [-a MD5|SHA|SHA-512|SHA-384|SHA-256|SHA-224] [-x DES|AES] [username]"
     5         kx     echo ""
     5         kx     exit
     5         kx fi
     5         kx 
     5         kx if test "x$1" = "x" ; then
     5         kx     prompt=yes
     5         kx     echo "Enter a SNMPv3 user name to create: "
     5         kx     read user
     5         kx else
     5         kx     user=$1
     5         kx     shift
     5         kx fi
     5         kx if test "x$user" = "x" ; then
     5         kx     echo "You must specify a user name"
     5         kx     exit 1
     5         kx fi
     5         kx if test "x$apassphrase" = "x" ; then
     5         kx     prompt=yes
     5         kx     echo "Enter authentication pass-phrase: "
     5         kx     read apassphrase
     5         kx fi
     5         kx if test "x$apassphrase" = "x" ; then
     5         kx     echo "You must specify an authentication pass-phrase"
     5         kx     exit 1
     5         kx fi
     5         kx     if test "x$prompt" = "xyes" -a "x$xpassphrase" = "x" ; then
     5         kx     echo "Enter encryption pass-phrase: "
     5         kx     echo "  [press return to reuse the authentication pass-phrase]"
     5         kx     read xpassphrase
     5         kx fi
     5         kx outdir="@PERSISTENT_DIRECTORY@"
     5         kx outfile="$outdir/snmpd.conf"
     5         kx line="createUser $user $Aalgorithm \"$apassphrase\" $Xalgorithm \"$xpassphrase\""
     5         kx echo "adding the following line to $outfile:"
     5         kx echo "  " $line
     5         kx # in case it hasn't ever been started yet, start it.
     5         kx if test ! -d $outdir ; then
     5         kx     mkdir $outdir
     5         kx fi
     5         kx if test ! -d $outfile ; then
     5         kx     touch $outfile
     5         kx fi
     5         kx echo $line >> $outfile
     5         kx prefix="@prefix@"
     5         kx # Avoid that configure complains that this script ignores @datarootdir@
     5         kx echo "@datarootdir@" >/dev/null
     5         kx outfile="/etc/snmp/snmpd.conf"
     5         kx line="$token $user"
     5         kx echo "adding the following line to $outfile:"
     5         kx echo "  " $line
     5         kx if test ! -d $outfile ; then
     5         kx     touch $outfile
     5         kx fi
     5         kx echo $line >> $outfile