| 1 |
Description: Fix paths for net-snmp-create-v3-user |
| 2 |
Use the pidof program instead of ps and grep |
| 3 |
Fix the path for configuration file |
| 4 |
Author: Craig Small <[email protected]> |
| 5 |
Origin: Debian |
| 6 |
Bug-Debian: https://bugs.debian.org/997895 |
| 7 |
Reviewed-by: Craig Small <[email protected]> |
| 8 |
Last-Update: 2023-08-19 |
| 9 |
--- a/net-snmp-create-v3-user.in |
| 10 |
+++ b/net-snmp-create-v3-user.in |
| 11 |
@@ -3,7 +3,7 @@ |
| 12 |
# this shell script is designed to add new SNMPv3 users |
| 13 |
# to Net-SNMP config file. |
| 14 |
|
| 15 |
-if @PSCMD@ | @EGREP@ ' snmpd *$' > /dev/null 2>&1 ; then |
| 16 |
+if /bin/pidof -q snmpd > /dev/null 2>&1 ; then |
| 17 |
echo "Apparently at least one snmpd daemon is already running." |
| 18 |
echo "You must stop them in order to use this command." |
| 19 |
exit 1 |
| 20 |
@@ -138,7 +138,7 @@ |
| 21 |
datarootdir=@datarootdir@ |
| 22 |
# To suppress shellcheck complaints about $prefix and $datarootdir. |
| 23 |
: "$prefix" "$datarootdir" |
| 24 |
-outfile="@datadir@/snmp/snmpd.conf" |
| 25 |
+outfile="@SNMPCONFPATH@/snmpd.conf" |
| 26 |
line="$token $user" |
| 27 |
echo "adding the following line to $outfile:" |
| 28 |
echo " $line" |