ACK
On 10/24/2011 05:02 PM, Adam Stokes wrote:
Rather than relying on the correct comments/spaces etc in
previous
versions go ahead and put everything in a separate uninstall batch
file. Make sure we force terminate any lingering matahari process and
finally continue on with the removal of matahari.
Some other minor fixes as a result (updated project page in cpack
setting, etc)
Signed-off-by: Adam Stokes<astokes(a)fedoraproject.org>
---
CMakeLists.txt | 16 +++-------------
src/windows/install.bat | 14 ++++++++------
src/windows/uninstall.bat | 21 +++++++++++++++++++++
3 files changed, 32 insertions(+), 19 deletions(-)
create mode 100644 src/windows/uninstall.bat
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 256ceba..4a00c47 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -49,7 +49,7 @@ if(WIN32)
set (CPACK_NSIS_MUI_ICON
"${CMAKE_CURRENT_SOURCE_DIR}/src/windows/matahari-icon.ico")
set (CPACK_NSIS_MUI_UNIICON
"${CMAKE_CURRENT_SOURCE_DIR}/src/windows/matahari-icon.ico")
set (CPACK_PACKAGE_ICON
"${CMAKE_CURRENT_SOURCE_DIR}/src/windows/matahari-install-banner.bmp")
- set (CPACK_NSIS_URL_INFO_ABOUT "http://fedorahosted.org/matahari")
+ set (CPACK_NSIS_URL_INFO_ABOUT "http://matahariproject.org")
# Needs this to correctly set up Start menu links later.
set (CPACK_PACKAGE_EXECUTABLES "")
@@ -72,18 +72,7 @@ if(WIN32)
set( CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "\\n")
set( CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS ${CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS}
" Some comment\\n DetailPrint \\\"Stopping Matahari
services\\\"\\n"
- " Some comment\\n ExecWait '\\\"$SYSDIR\\\\sc.exe stop
mh_hostd\\\"'\\n"
- " Some comment\\n ExecWait '\\\"$SYSDIR\\\\sc.exe stop
mh_netd\\\"'\\n"
- " Some comment\\n ExecWait '\\\"$SYSDIR\\\\sc.exe stop
mh_serviced\\\"'\\n"
- " Give them time to stop\\n Sleep 10000\\n"
- " Some comment\\n DetailPrint \\\"Removing Matahari
services\\\"\\n"
- " Some comment\\n ExecWait '\\\"$SYSDIR\\\\sc.exe delete
mh_hostd\\\"'\\n"
- " Some comment\\n ExecWait '\\\"$SYSDIR\\\\sc.exe delete
mh_netd\\\"'\\n"
- " Some comment\\n ExecWait '\\\"$SYSDIR\\\\sc.exe delete
mh_serviced\\\"'\\n"
- " Some comment\\n DetailPrint \\\"Removing Matahari service
binaries\\\"\\n"
- " Some comment\\n ExecWait 'del
\\\"$INSTDIR\\\\mh_hostd.exe\\\"'\\n"
- " Some comment\\n ExecWait 'del
\\\"$INSTDIR\\\\mh_netd.exe\\\"'\\n"
- " Some comment\\n ExecWait 'del
\\\"$INSTDIR\\\\mh_serviced.exe\\\"'\\n"
+ " Some comment\\n ExecWait
\\\"$INSTDIR\\\\sbin\\\\uninstall.bat\\\"\\n"
)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/windows/autorun.inf.in
@@ -103,6 +92,7 @@ if(WIN32)
file(GLOB_RECURSE SRVANY_EXE ${MINGW_ROOT}/*/srvany.exe)
install(FILES ${SRVANY_EXE} DESTINATION sbin)
install(FILES src/windows/install.bat DESTINATION sbin)
+ install(FILES src/windows/uninstall.bat DESTINATION sbin)
else(WIN32)
diff --git a/src/windows/install.bat b/src/windows/install.bat
index 5e6307e..3b0224b 100644
--- a/src/windows/install.bat
+++ b/src/windows/install.bat
@@ -12,12 +12,14 @@ cd "%target%"
rem Now install the agents as services and start them
-set agents=hostd networkd serviced
-for %%A in (%agents%) do sc delete mh_%%A
-for %%A in (%agents%) do del mh_%%A.exe
-for %%A in (%agents%) do copy srvany.exe mh_%%A.exe
-for %%A in (%agents%) do mh_%%A.exe install "%target%\matahari-qmf-%%A.exe"
"%target%"
-for %%A in (%agents%) do sc start mh_%%A
+set agents=hostd networkd serviced sysconfigd
+for %%A in (%agents%) do (
+ sc delete mh_%%A
+ del mh_%%A.exe
+ copy srvany.exe mh_%%A.exe
+ mh_%%A.exe install "%target%\matahari-qmf-%%A.exe" "%target%"
+ sc start mh_%%A
+)
rem Remove the old name for the network agent
sc delete mh_netd
diff --git a/src/windows/uninstall.bat b/src/windows/uninstall.bat
new file mode 100644
index 0000000..d24a958
--- /dev/null
+++ b/src/windows/uninstall.bat
@@ -0,0 +1,21 @@
+rem UnInstall Matahari services
+echo
+
+rem Get the install directory
+set target=%0
+set target=%target:\uninstall.bat=%
+
+rem Now remove quotes so we can add them as necessary
+set target=%target:"=%
+
+cd "%target%"
+
+rem Now uninstall the agents
+
+set agents=hostd networkd serviced sysconfigd
+for %%A in (%agents%) do (
+ sc stop mh_%%A
+ sc delete mh_%%A
+ taskkill /IM matahari-qmf-%%A.exe /f
+ del mh_%%A.exe
+)
--
Russell Bryant