Using a later 5.2.pre2- win32 binary, these un-install issues were tested All files installed from Net-SNMP package were removed
If snmpd agent was registered and running, it was stopped, unregistered, then removed.
All references to "snmpd.log" no longer exist in the Registry after un-install
Install, register service, Uninstall, followed by Install, register service is now working
I did not try running the agent without registering to see if un-install would try to stop the agent.
I think this is good enough.
Oh, one more nit : Please create the <BASE>\log subdirectory, so that the log files have a home.
The attached patch includes the creation of <BASE>\log.
While testing the agent running as a service, I noticed that my snmpd.log file contained:
No log handling enabled - turning on stderr logging Cannot find module (IP-MIB): At line 0 in (none) Cannot find module (IF-MIB): At line 0 in (none) (snip) Cannot find module (SNMP-NOTIFICATION-MIB): At line 0 in (none) Cannot find module (SNMPv2-TM): At line 0 in (none)
The errors appear because the service is run with the -C switch to disable loading other config files. The options we have in the .bat file for registering is:
-C -c "d:/Program Files/Net-SNMP/etc/snmp/snmpd.conf" -Lf "d:/Program Files/Net-SNMP/log/snmpd.log"
Isn't this wrong? The -C tells it not to load the default config files, which would include snmp.conf which tells the system where to find the MIB files etc..
If I am correct, then we should remove the -c switch also as the agent can find it itself by using the SNMPCONFPATH environment variable.
Now that brings up another problem. The whole reason for putting the -c switch was to prevent the user from having to reboot before the service would work because the Windows SCM only loads the environment variables at boot-up (see: http://sourceforge.net/mailarchive/message.php?msg_id=9560137). If we need to tell it where to find snmpd.conf, then we also need to tell it where to find snmp.conf if we use the -C switch, but I don't think we can..
So to sum it all up, telling it where snmpd.conf is but not snmp.conf does not work.
This may mean that if we remove the -C and -c switches, the options for the user are:
1) Install to c:/usr and don't reboot as the service will find everything due to the default compiled in paths
2) Install somewhere else and reboot so the new environment variables are used by the service
Alex
--- win32/dist/installer/net-snmp.nsi.org 2004-10-03 16:43:18.000000000 -0400 +++ win32/dist/installer/net-snmp.nsi 2004-10-03 16:48:56.000000000 -0400 @@ -3,9 +3,9 @@ ; HM NIS Edit Wizard helper defines !define PRODUCT_NAME "Net-SNMP" !define PRODUCT_MAJ_VERSION "5" -!define PRODUCT_MIN_VERSION "1" -!define PRODUCT_REVISION "2" -!define PRODUCT_EXE_VERSION "pre1" +!define PRODUCT_MIN_VERSION "2" +!define PRODUCT_REVISION "0" +!define PRODUCT_EXE_VERSION "1" !define PRODUCT_WEB_SITE "http://www.net-snmp.com" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\encode_keychange.exe" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" @@ -106,8 +106,12 @@ SetOutPath "$INSTDIR\share\snmp\mibs" File "share\snmp\mibs\AGENTX-MIB.txt" File "share\snmp\mibs\DISMAN-EVENT-MIB.txt" + File "share\snmp\mibs\DISMAN-EXPRESSION-MIB.txt" + File "share\snmp\mibs\DISMAN-NSLOOKUP-MIB.txt" + File "share\snmp\mibs\DISMAN-PING-MIB.txt" File "share\snmp\mibs\DISMAN-SCHEDULE-MIB.txt" File "share\snmp\mibs\DISMAN-SCRIPT-MIB.txt" + File "share\snmp\mibs\DISMAN-TRACEROUTE-MIB.txt" File "share\snmp\mibs\EtherLike-MIB.txt" File "share\snmp\mibs\HCNUM-TC.txt" File "share\snmp\mibs\HOST-RESOURCES-MIB.txt" @@ -129,6 +133,7 @@ File "share\snmp\mibs\MTA-MIB.txt" File "share\snmp\mibs\NET-SNMP-AGENT-MIB.txt" File "share\snmp\mibs\NET-SNMP-EXAMPLES-MIB.txt" + File "share\snmp\mibs\NET-SNMP-EXTEND-MIB.txt" File "share\snmp\mibs\NET-SNMP-MIB.txt" File "share\snmp\mibs\NET-SNMP-MONITOR-MIB.txt" File "share\snmp\mibs\NET-SNMP-SYSTEM-MIB.txt" @@ -147,6 +152,8 @@ File "share\snmp\mibs\SNMP-PROXY-MIB.txt" File "share\snmp\mibs\SNMP-TARGET-MIB.txt" File "share\snmp\mibs\SNMP-USER-BASED-SM-MIB.txt" + File "share\snmp\mibs\SNMP-USM-AES-MIB.txt" + File "share\snmp\mibs\SNMP-USM-DH-OBJECTS-MIB.txt" File "share\snmp\mibs\SNMPv2-CONF.txt" File "share\snmp\mibs\SNMPv2-MIB.txt" File "share\snmp\mibs\SNMPv2-SMI.txt" @@ -154,6 +161,7 @@ File "share\snmp\mibs\SNMPv2-TM.txt" File "share\snmp\mibs\SNMP-VIEW-BASED-ACM-MIB.txt" File "share\snmp\mibs\TCP-MIB.txt" + File "share\snmp\mibs\TRANSPORT-ADDRESS-MIB.txt" File "share\snmp\mibs\TUNNEL-MIB.txt" File "share\snmp\mibs\UCD-DEMO-MIB.txt" File "share\snmp\mibs\UCD-DISKIO-MIB.txt" @@ -163,6 +171,27 @@ File "share\snmp\mibs\UCD-SNMP-MIB.txt" File "share\snmp\mibs\UCD-SNMP-MIB-OLD.txt" File "share\snmp\mibs\UDP-MIB.txt" + SetOutPath "$INSTDIR\share\snmp" + File "share\snmp\mib2c.access_functions.conf" + File "share\snmp\mib2c.array-user.conf" + File "share\snmp\mib2c.check_values.conf" + File "share\snmp\mib2c.check_values_local.conf" + File "share\snmp\mib2c.column_defines.conf" + File "share\snmp\mib2c.column_enums.conf" + File "share\snmp\mib2c.column_storage.conf" + File "share\snmp\mib2c.conf" + File "share\snmp\mib2c.container.conf" + File "share\snmp\mib2c.create-dataset.conf" + File "share\snmp\mib2c.genhtml.conf" + File "share\snmp\mib2c.int_watch.conf" + File "share\snmp\mib2c.iterate.conf" + File "share\snmp\mib2c.iterate_access.conf" + File "share\snmp\mib2c.iterate2.conf" + File "share\snmp\mib2c.mfd.conf" + File "share\snmp\mib2c.notify.conf" + File "share\snmp\mib2c.old-api.conf" + File "share\snmp\mib2c.scalar.conf" + File "share\snmp\mib2c.table_data.conf" SetOutPath "$INSTDIR\docs" File "docs\COPYING" File "docs\Net-SNMP.chm" @@ -177,10 +206,12 @@ SetOutPath "$INSTDIR\include\net-snmp" File "include\net-snmp\net-snmp-config.h" SetOutPath "$INSTDIR\include\net-snmp\agent" + File "include\net-snmp\agent\agent_module_config.h" File "include\net-snmp\agent\mib_module_config.h" CreateDirectory "$INSTDIR\temp" CreateDirectory "$INSTDIR\snmp" CreateDirectory "$INSTDIR\snmp\persist" + CreateDirectory "$INSTDIR\log" ; Add bin directory to the search path Push "$INSTDIR\bin" @@ -540,6 +571,17 @@ Section Uninstall ReadRegStr $ICONS_GROUP ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "${PRODUCT_STARTMENU_REGVAL}" + + ReadRegStr $1 "HKLM" "SYSTEM\CurrentControlSet\Services\Net-SNMP Agent" "DisplayName" + IfErrors SkipAgentUninstall + ExecWait "$\"$INSTDIR\bin\snmpd.exe$\" -unregister -quiet 2>nul$\r$\n" + SkipAgentUninstall: + + ReadRegStr $1 "HKLM" "SYSTEM\CurrentControlSet\Services\Net-SNMP Trap Handler" "DisplayName" + IfErrors SkipTrapDUninstall + ExecWait "$\"$INSTDIR\bin\snmptrapd.exe$\" -unregister -quiet 2>nul$\r$\n" + SkipTrapDUninstall: + Delete "$INSTDIR\uninst.exe" Delete "$INSTDIR\README.txt" Delete "$INSTDIR\registeragent.bat" @@ -549,6 +591,7 @@ Delete "$INSTDIR\perl\Net-SNMP.ppd" Delete "$INSTDIR\perl\x86\Net-SNMP.tar.gz" Delete "$INSTDIR\include\net-snmp\net-snmp-config.h" + Delete "$INSTDIR\include\net-snmp\agent\agent_module_config.h" Delete "$INSTDIR\include\net-snmp\agent\mib_module_config.h" Delete "$INSTDIR\docs\COPYING" Delete "$INSTDIR\docs\Net-SNMP.chm" @@ -599,11 +642,14 @@ Delete "$INSTDIR\share\snmp\snmpconf-data\snmptrapd-data\authentication" Delete "$INSTDIR\share\snmp\snmpconf-data\snmptrapd-data\logging" Delete "$INSTDIR\share\snmp\snmpconf-data\snmptrapd-data\runtime" - ;Delete "$INSTDIR\share\snmp\snmp.conf" Delete "$INSTDIR\share\snmp\mibs\AGENTX-MIB.txt" Delete "$INSTDIR\share\snmp\mibs\DISMAN-EVENT-MIB.txt" + Delete "$INSTDIR\share\snmp\mibs\DISMAN-EXPRESSION-MIB.txt" + Delete "$INSTDIR\share\snmp\mibs\DISMAN-NSLOOKUP-MIB.txt" + Delete "$INSTDIR\share\snmp\mibs\DISMAN-PING-MIB.txt" Delete "$INSTDIR\share\snmp\mibs\DISMAN-SCHEDULE-MIB.txt" Delete "$INSTDIR\share\snmp\mibs\DISMAN-SCRIPT-MIB.txt" + Delete "$INSTDIR\share\snmp\mibs\DISMAN-TRACEROUTE-MIB.txt" Delete "$INSTDIR\share\snmp\mibs\EtherLike-MIB.txt" Delete "$INSTDIR\share\snmp\mibs\HCNUM-TC.txt" Delete "$INSTDIR\share\snmp\mibs\HOST-RESOURCES-MIB.txt" @@ -625,6 +671,7 @@ Delete "$INSTDIR\share\snmp\mibs\MTA-MIB.txt" Delete "$INSTDIR\share\snmp\mibs\NET-SNMP-AGENT-MIB.txt" Delete "$INSTDIR\share\snmp\mibs\NET-SNMP-EXAMPLES-MIB.txt" + Delete "$INSTDIR\share\snmp\mibs\NET-SNMP-EXTEND-MIB.txt" Delete "$INSTDIR\share\snmp\mibs\NET-SNMP-MIB.txt" Delete "$INSTDIR\share\snmp\mibs\NET-SNMP-MONITOR-MIB.txt" Delete "$INSTDIR\share\snmp\mibs\NET-SNMP-SYSTEM-MIB.txt" @@ -643,6 +690,8 @@ Delete "$INSTDIR\share\snmp\mibs\SNMP-PROXY-MIB.txt" Delete "$INSTDIR\share\snmp\mibs\SNMP-TARGET-MIB.txt" Delete "$INSTDIR\share\snmp\mibs\SNMP-USER-BASED-SM-MIB.txt" + Delete "$INSTDIR\share\snmp\mibs\SNMP-USM-AES-MIB.txt" + Delete "$INSTDIR\share\snmp\mibs\SNMP-USM-DH-OBJECTS-MIB.txt" Delete "$INSTDIR\share\snmp\mibs\SNMPv2-CONF.txt" Delete "$INSTDIR\share\snmp\mibs\SNMPv2-MIB.txt" Delete "$INSTDIR\share\snmp\mibs\SNMPv2-SMI.txt" @@ -650,6 +699,7 @@ Delete "$INSTDIR\share\snmp\mibs\SNMPv2-TM.txt" Delete "$INSTDIR\share\snmp\mibs\SNMP-VIEW-BASED-ACM-MIB.txt" Delete "$INSTDIR\share\snmp\mibs\TCP-MIB.txt" + Delete "$INSTDIR\share\snmp\mibs\TRANSPORT-ADDRESS-MIB.txt" Delete "$INSTDIR\share\snmp\mibs\TUNNEL-MIB.txt" Delete "$INSTDIR\share\snmp\mibs\UCD-DEMO-MIB.txt" Delete "$INSTDIR\share\snmp\mibs\UCD-DISKIO-MIB.txt" @@ -660,8 +710,27 @@ Delete "$INSTDIR\share\snmp\mibs\UCD-SNMP-MIB-OLD.txt" Delete "$INSTDIR\share\snmp\mibs\UDP-MIB.txt" Delete "$INSTDIR\share\snmp\mibs\.index" - ;Delete "$INSTDIR\share\snmp\snmpd.conf" - ;Delete "$INSTDIR\etc\snmp\snmp.conf" + SetOutPath "$INSTDIR\share\snmp" + Delete "$INSTDIR\share\snmp\mib2c.access_functions.conf" + Delete "$INSTDIR\share\snmp\mib2c.array-user.conf" + Delete "$INSTDIR\share\snmp\mib2c.check_values.conf" + Delete "$INSTDIR\share\snmp\mib2c.check_values_local.conf" + Delete "$INSTDIR\share\snmp\mib2c.column_defines.conf" + Delete "$INSTDIR\share\snmp\mib2c.column_enums.conf" + Delete "$INSTDIR\share\snmp\mib2c.column_storage.conf" + Delete "$INSTDIR\share\snmp\mib2c.conf" + Delete "$INSTDIR\share\snmp\mib2c.container.conf" + Delete "$INSTDIR\share\snmp\mib2c.create-dataset.conf" + Delete "$INSTDIR\share\snmp\mib2c.genhtml.conf" + Delete "$INSTDIR\share\snmp\mib2c.int_watch.conf" + Delete "$INSTDIR\share\snmp\mib2c.iterate.conf" + Delete "$INSTDIR\share\snmp\mib2c.iterate_access.conf" + Delete "$INSTDIR\share\snmp\mib2c.iterate2.conf" + Delete "$INSTDIR\share\snmp\mib2c.mfd.conf" + Delete "$INSTDIR\share\snmp\mib2c.notify.conf" + Delete "$INSTDIR\share\snmp\mib2c.old-api.conf" + Delete "$INSTDIR\share\snmp\mib2c.scalar.conf" + Delete "$INSTDIR\share\snmp\mib2c.table_data.conf" Delete "$SMPROGRAMS\$ICONS_GROUP\Net-SNMP Help.lnk" Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" Delete "$SMPROGRAMS\$ICONS_GROUP\README.lnk"
