Ethereal-dev: Re: [Ethereal-dev] fixes for nsis-installer script andmakefile

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Lars Roland <lars.roland@xxxxxxx>
Date: Tue, 03 Feb 2004 19:29:41 +0100
Hello all,

attached is an updated patch. It includes some additional checks for the uninstaller. It will try to remove tethereal.exe and ethereal.exe first. If tethereal.exe or ethereal.exe cannot be deleted (e.g. because it is in use), then the uninstall process will be aborted leaving the uninstaller intact. Messages are displayed to inform the user.

Please check in.

Olivier Biot wrote:

Hi all,

My thought is that the global settings on Win2000/XP/2003 should be
available in the "Documents and Settings/All Users/Application Data"
directory, and that user-specific files should reside in the
"Application Data" directory of the user's settings. Please note that
there are Windows-specific variables that are used to find the actual
directory names for the application data and the user profile, but I
don't know those by heart.

If you don't have admin privileges, then you'll still be able to run
Ethereal, but you'll not necessarily be able to capture with
(t)ethereal.

You will be able to do so soon. The recently released WinPcap 3.1 allows capturing for non-admins!


I also don't know the NS/IS installer so I don't know if you can
specify whether you want the application(s) to be instlled for the
installing user or for all users on the computer.


Yes it can specify that (Start menu and desktop icon are installed for "All users"). But Ethereal itself puts user specific data in each users "Application Data" directory.

Best Regards,

Lars Roland
Index: nsis/Makefile.nmake
===================================================================
RCS file: /cvsroot/ethereal/packaging/nsis/Makefile.nmake,v
retrieving revision 1.34
diff -u -r1.34 Makefile.nmake
--- nsis/Makefile.nmake	26 Jan 2004 21:12:41 -0000	1.34
+++ nsis/Makefile.nmake	3 Feb 2004 18:17:37 -0000
@@ -9,7 +9,15 @@
 
 include ../../config.nmake
 
-EXE=../../ethereal.exe ../../tethereal.exe ../../editcap.exe \
+!IFDEF GTK1
+DEST=ethereal
+GTK_DIR=$(GTK1_DIR)
+!ELSE
+DEST=ethereal2
+GTK_DIR=$(GTK2_DIR)
+!ENDIF
+
+EXE=../../$(DEST).exe ../../tethereal.exe ../../editcap.exe \
 	../../text2pcap.exe ../../mergecap.exe
 DLL=../../wiretap/wiretap-$(WTAP_VERSION).dll
 DOC=../../doc/ethereal.html		\
@@ -49,16 +57,6 @@
 DELIVERABLES=$(EXE) $(DLL) $(DOC) $(GPL) $(HELP) $(PLUGINS)
 
 
-
-!IFDEF GTK1
-DEST=ethereal
-GTK_DIR=$(GTK1_DIR)
-!ELSE
-DEST=ethereal2
-GTK_DIR=$(GTK2_DIR)
-!ENDIF
-
-
 $(DEST)-setup-$(VERSION).exe : ethereal.nsi $(DELIVERABLES) Makefile.nmake
 	$(MAKENSIS) \
 !IF "$(MAKENSIS_MODERN_UI)" != ""
@@ -88,6 +86,7 @@
 
 clean:
 	rm -f ethereal-setup-$(VERSION).exe
+	rm -f ethereal2-setup-$(VERSION).exe
 
 distclean: clean
 
Index: nsis/ethereal.nsi
===================================================================
RCS file: /cvsroot/ethereal/packaging/nsis/ethereal.nsi,v
retrieving revision 1.42
diff -u -r1.42 ethereal.nsi
--- nsis/ethereal.nsi	3 Feb 2004 01:06:21 -0000	1.42
+++ nsis/ethereal.nsi	3 Feb 2004 18:17:37 -0000
@@ -275,7 +275,7 @@
 Delete "$SMPROGRAMS\Ethereal\Ethereal Web Site.lnk"
 WriteINIStr "$SMPROGRAMS\Ethereal\Ethereal Web Site.url" \
           "InternetShortcut" "URL" "http://www.ethereal.com/";
-CreateShortCut "$SMPROGRAMS\Ethereal\Ethereal.lnk" "$INSTDIR\ethereal.exe"
+CreateShortCut "$SMPROGRAMS\Ethereal\Ethereal.lnk" "$INSTDIR\${DEST}.exe"
 CreateShortCut "$SMPROGRAMS\Ethereal\Ethereal Manual.lnk" "$INSTDIR\ethereal.html"
 CreateShortCut "$SMPROGRAMS\Ethereal\Display Filters Manual.lnk" "$INSTDIR\ethereal-filter.html"
 CreateShortCut "$SMPROGRAMS\Ethereal\Uninstall.lnk" "$INSTDIR\uninstall.exe"
@@ -285,20 +285,32 @@
 
 Section "Desktop Icon" SecDesktopIcon
 ;-------------------------------------------
-CreateShortCut "$DESKTOP\Ethereal.lnk" "$INSTDIR\Ethereal.exe"
+CreateShortCut "$DESKTOP\Ethereal.lnk" "$INSTDIR\${DEST}.exe"
 SectionEnd
 
 Section "Uninstall"
 ;-------------------------------------------
 
-DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal"
-DeleteRegKey HKEY_LOCAL_MACHINE SOFTWARE\Ethereal
-
 ;
 ; UnInstall for every user
 ;
 SetShellVarContext all
 
+Delete "$INSTDIR\tethereal.exe"
+IfErrors 0 NoTetherealErrorMsg
+	MessageBox MB_OK "Note: Tethereal could not be removed! Probably in use!" IDOK 0 ;skipped if tethereal.exe removed
+	Abort "Note: tethereal.exe could not be removed! Probably in use! Abort unistall!"
+NoTetherealErrorMsg:
+
+Delete "$INSTDIR\${DEST}.exe"
+IfErrors 0 NoEtherealErrorMsg
+	MessageBox MB_OK "Note: Ethereal could not be removed! Probably in use!" IDOK 0 ;skipped if ethereal.exe removed
+	Abort "Note: ${DEST}.exe could not be removed! Probably in use! Abort uninstall!"
+NoEtherealErrorMsg:
+
+DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal"
+DeleteRegKey HKEY_LOCAL_MACHINE SOFTWARE\Ethereal
+
 !ifdef GTK2
 Delete "$INSTDIR\etc\gtk-2.0\*.*"
 Delete "$INSTDIR\etc\pango\*.*"
@@ -338,6 +350,10 @@
 RMDir "$INSTDIR\snmp"
 RMDir "$INSTDIR"
 
+IfFileExists "$INSTDIR" 0 NoFinalErrorMsg
+    MessageBox MB_OK "Note: $INSTDIR could not be removed!" IDOK 0 ; skipped if file doesn't exist
+NoFinalErrorMsg: 
+
 SectionEnd