Module: check_mk
Branch: master
Commit: 5e1b1a1411de487975ea1b10501480aacaf534fb
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5e1b1a1411de48…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Jan 10 10:36:17 2012 +0100
Added NSIS based installer for the windows agent
---
agents/windows/Makefile | 9 +++-
agents/windows/check_mk_agent.exe | Bin 102912 -> 102912 bytes
agents/windows/crash.exe | Bin 20024 -> 20024 bytes
agents/windows/installer.ico | Bin 0 -> 1406 bytes
agents/windows/installer.nsi | 92 +++++++++++++++++++++++++++++++++++++
5 files changed, 100 insertions(+), 1 deletions(-)
diff --git a/agents/windows/Makefile b/agents/windows/Makefile
index c31f78f..036ac08 100755
--- a/agents/windows/Makefile
+++ b/agents/windows/Makefile
@@ -28,7 +28,14 @@ else
CXX = mingw32-g++
endif
-all: check_mk_agent.exe crash.exe
+all: check_mk_agent.exe crash.exe installer
+
+installer:
+ if ! which makensis; then \
+ echo "ERROR: makensis missing. Please install the nsis package." ; \
+ exit 1 ; \
+ fi
+ makensis installer.nsi
check_mk_agent.exe: check_mk_agent.cc Makefile
$(CXX) -s -O2 -Wall -Werror -o $@ $< -lwsock32
diff --git a/agents/windows/check_mk_agent.exe b/agents/windows/check_mk_agent.exe
index b4c6f45..08976c5 100755
Binary files a/agents/windows/check_mk_agent.exe and b/agents/windows/check_mk_agent.exe
differ
diff --git a/agents/windows/crash.exe b/agents/windows/crash.exe
index 7eaa34e..e3c5b3e 100755
Binary files a/agents/windows/crash.exe and b/agents/windows/crash.exe differ
diff --git a/agents/windows/installer.ico b/agents/windows/installer.ico
new file mode 100644
index 0000000..2e8c4ea
Binary files /dev/null and b/agents/windows/installer.ico differ
diff --git a/agents/windows/installer.nsi b/agents/windows/installer.nsi
new file mode 100644
index 0000000..715197d
--- /dev/null
+++ b/agents/windows/installer.nsi
@@ -0,0 +1,92 @@
+; This is the NSIS configuration file for the Check_MK windows agent. This is
+; the spec file how to build the installer
+;--------------------------------
+; Useful sources:
+;
http://nsis.sourceforge.net/Reusable_installer_script
+
+!define VERSION "1.1.13i3"
+!define NAME "Check_MK Agent ${VERSION}"
+
+XPStyle on
+Icon "installer.ico"
+
+; The name of the installer
+Name "${NAME}"
+
+; The file to write
+OutFile "check_mk_agent_install-${VERSION}.exe"
+
+SetDateSave on
+SetDatablockOptimize on
+CRCCheck on
+SilentInstall normal
+
+; The default installation directory
+InstallDir "$PROGRAMFILES\check_mk"
+
+; Registry key to check for directory (so if you install again, it will
+; overwrite the old one automatically)
+InstallDirRegKey HKLM "Software\check_mk_agent" "Install_Dir"
+
+; Request application privileges for Windows >Vista
+RequestExecutionLevel admin
+
+ShowInstDetails show
+
+;--------------------------------
+; Pages
+
+Page directory
+Page components
+Page instfiles
+
+UninstPage uninstConfirm
+UninstPage instfiles
+
+;--------------------------------
+
+Section "Check_MK_Agent"
+ ; Can not be disabled
+ SectionIn RO
+
+ SetOutPath "$INSTDIR"
+ File check_mk_agent.exe
+ File check_mk.ini
+ CreateDirectory "$INSTDIR\local"
+ CreateDirectory "$INSTDIR\plugins"
+
+ ; Write the installation path into the registry
+ WriteRegStr HKLM SOFTWARE\check_mk_agent "Install_Dir" "$INSTDIR"
+
+ ; Write the uninstall keys for Windows
+ WriteRegStr HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\check_mk_agent"
"DisplayName" "${NAME}"
+ WriteRegStr HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\check_mk_agent"
"UninstallString" '"$INSTDIR\uninstall.exe"'
+ WriteRegDWORD HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\check_mk_agent"
"NoModify" 1
+ WriteRegDWORD HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\check_mk_agent"
"NoRepair" 1
+ WriteUninstaller "uninstall.exe"
+SectionEnd
+
+Section "Install & start service"
+ ExecWait '"$INSTDIR\check_mk_agent.exe" install'
+ ExecWait 'net start check_mk_agent'
+SectionEnd
+
+Section "Uninstall"
+ ; Remove the service
+ ExecWait 'net stop check_mk_agent'
+ ExecWait '"$INSTDIR\check_mk_agent.exe" remove'
+
+ ; Remove registry keys
+ DeleteRegKey HKLM
"Software\Microsoft\Windows\CurrentVersion\Uninstall\check_mk_agent"
+ DeleteRegKey HKLM SOFTWARE\check_mk_agent
+
+ ; Remove files and uninstaller
+ Delete "$INSTDIR\check_mk_agent.exe"
+ Delete "$INSTDIR\check_mk.ini"
+ Delete "$INSTDIR\uninstall.exe"
+ RMDir "$INSTDIR\local"
+ RMDir "$INSTDIR\plugins"
+
+ ; Remove directories used
+ RMDir "$INSTDIR"
+SectionEnd