Update to use the generic manifest and make independent of the U3 packaging.

Also tidy up.


svn path=/trunk/; revision=24013
This commit is contained in:
Graeme Lunt 2008-01-04 14:12:22 +00:00
parent b6dc767069
commit 105c394521
5 changed files with 150 additions and 70 deletions

View File

@ -4,10 +4,11 @@
# $Id$ # $Id$
# #
[WiresharkPortable] [WiresharkPortable]
WiresharkDirectory=App\Wireshark
WiresharkDirectory=App/Wireshark
WiresharkExecutable=wireshark.exe WiresharkExecutable=wireshark.exe
AdditionalParameters= AdditionalParameters=
#DisableSplashScreen=false
DisableWinPcapInstall=false DisableWinPcapInstall=false
WinPcapInstaller=WinPcap_4_0_2.exe WinPcapInstaller=WinPcap_4_0_2.exe

View File

@ -30,7 +30,6 @@
!define WEBSITE "www.wireshark.org" !define WEBSITE "www.wireshark.org"
!define DEFAULTEXE "wireshark.exe" !define DEFAULTEXE "wireshark.exe"
!define DEFAULTAPPDIR "Wireshark" !define DEFAULTAPPDIR "Wireshark"
!define DEFAULTSETTINGSDIR "settings"
!define DEFAULTWINPCAP "WinPcap_4_0_2.exe" !define DEFAULTWINPCAP "WinPcap_4_0_2.exe"
;=== Program Details ;=== Program Details
@ -61,32 +60,26 @@ RequestExecutionLevel user
;=== Include ;=== Include
!include "FileFunc.nsh" !include "FileFunc.nsh"
!insertmacro GetParameters !insertmacro GetParameters
;!insertmacro GetRoot
;!include "ReplaceInFile.nsh"
;!include "StrRep.nsh"
;=== Program Icon ;=== Program Icon
Icon "Files/App/AppInfo/${APP}.ico" Icon "Files/App/AppInfo/${APP}.ico"
Var PROGRAMDIRECTORY Var PROGRAMDIRECTORY
Var SETTINGSDIRECTORY
Var ADDITIONALPARAMETERS Var ADDITIONALPARAMETERS
Var EXECSTRING Var EXECSTRING
Var PROGRAMEXECUTABLE Var PROGRAMEXECUTABLE
Var INIPATH Var INIPATH
Var SECONDARYLAUNCH
Var DISABLESPLASHSCREEN
Var DISABLEWINPCAPINSTALL Var DISABLEWINPCAPINSTALL
Var WINPCAPINSTALLER Var WINPCAPINSTALLER
Var WINPCAP_UNINSTALL ;declare variable for holding the value of a registry key Var WINPCAP_UNINSTALL ;declare variable for holding the value of a registry key
Var PDRIVE Var PDRIVE
Section "Main" Section "Main"
;=== Check if already running ;=== Check if another WiresharkPortable already running
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${NAME}") i .r1 ?e' System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${NAME}") i .r1 ?e'
Pop $0 Pop $0
StrCmp $0 0 CheckINI StrCmp $0 0 CheckINI
StrCpy $SECONDARYLAUNCH "true" Goto WarnAnotherInstance
CheckINI: CheckINI:
;=== Find the INI file, if there is one ;=== Find the INI file, if there is one
@ -103,15 +96,13 @@ Section "Main"
;=== Read the parameters from the INI file ;=== Read the parameters from the INI file
ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "${APP}Directory" ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "${APP}Directory"
StrCpy "$PROGRAMDIRECTORY" "$EXEDIR\$0" StrCpy "$PROGRAMDIRECTORY" "$EXEDIR\$0"
ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "SettingsDirectory"
StrCpy "$SETTINGSDIRECTORY" "$EXEDIR\$0"
;=== Check that the above required parameters are present ;=== Check that the above required parameters are present
IfErrors NoINI IfErrors NoINI
ReadINIStr $PROGRAMEXECUTABLE "$INIPATH\${NAME}.ini" "${NAME}" "ProgramExecutable" ReadINIStr $PROGRAMEXECUTABLE "$INIPATH\${NAME}.ini" "${NAME}" "${APP}Executable"
ReadINIStr $ADDITIONALPARAMETERS "$INIPATH\${NAME}.ini" "${NAME}" "AdditionalParameters" ReadINIStr $ADDITIONALPARAMETERS "$INIPATH\${NAME}.ini" "${NAME}" "AdditionalParameters"
ReadINIStr $DISABLESPLASHSCREEN "$INIPATH\${NAME}.ini" "${NAME}" "DisableSplashScreen"
ReadINIStr $DISABLEWINPCAPINSTALL "$INIPATH\${NAME}.ini" "${NAME}" "DisableWinPcapInstall" ReadINIStr $DISABLEWINPCAPINSTALL "$INIPATH\${NAME}.ini" "${NAME}" "DisableWinPcapInstall"
ReadINIStr $WINPCAPINSTALLER "$INIPATH\${NAME}.ini" "${NAME}" "WinPcapInstaller" ReadINIStr $WINPCAPINSTALLER "$INIPATH\${NAME}.ini" "${NAME}" "WinPcapInstaller"
@ -137,17 +128,15 @@ Section "Main"
IfFileExists "$EXEDIR\App\${DEFAULTAPPDIR}\${DEFAULTEXE}" "" CheckPortableProgramDIR IfFileExists "$EXEDIR\App\${DEFAULTAPPDIR}\${DEFAULTEXE}" "" CheckPortableProgramDIR
StrCpy "$PROGRAMDIRECTORY" "$EXEDIR\App\${DEFAULTAPPDIR}" StrCpy "$PROGRAMDIRECTORY" "$EXEDIR\App\${DEFAULTAPPDIR}"
StrCpy "$SETTINGSDIRECTORY" "$EXEDIR\Data\${DEFAULTSETTINGSDIR}"
GoTo EndINI GoTo EndINI
CheckPortableProgramDIR: CheckPortableProgramDIR:
IfFileExists "$EXEDIR\${NAME}\App\${DEFAULTAPPDIR}\${DEFAULTEXE}" "" NoProgramEXE IfFileExists "$EXEDIR\${NAME}\App\${DEFAULTAPPDIR}\${DEFAULTEXE}" "" NoProgramEXE
StrCpy "$PROGRAMDIRECTORY" "$EXEDIR\${NAME}\App\${DEFAULTAPPDIR}" StrCpy "$PROGRAMDIRECTORY" "$EXEDIR\${NAME}\App\${DEFAULTAPPDIR}"
StrCpy "$SETTINGSDIRECTORY" "$EXEDIR\${NAME}\Data\${DEFAULTSETTINGSDIR}"
GoTo EndINI GoTo EndINI
EndINI: EndINI:
IfFileExists "$PROGRAMDIRECTORY\$PROGRAMEXECUTABLE" FoundProgramEXE IfFileExists "$PROGRAMDIRECTORY\$PROGRAMEXECUTABLE" GetPassedParameters
NoProgramEXE: NoProgramEXE:
;=== Program executable not where expected ;=== Program executable not where expected
@ -155,24 +144,16 @@ Section "Main"
Abort Abort
FoundProgramEXE: FoundProgramEXE:
;=== Check if running ;=== Check if Wireshark running from somwehere else (e.g. U3 device)
StrCmp $SECONDARYLAUNCH "true" GetPassedParameters
; if the following step fails, you'll need the FindProcDLL plug-in from: ; if the following step fails, you'll need the FindProcDLL plug-in from:
; http://nsis.sourceforge.net/Find_Process_By_Name ; http://nsis.sourceforge.net/Find_Process_By_Name
FindProcDLL::FindProc "${DEFAULTEXE}" FindProcDLL::FindProc "${PROGRAMEXECUTABLE}"
StrCmp $R0 "1" WarnAnotherInstance DisplaySplash StrCmp $R0 "1" WarnAnotherInstance GetPassedParameters
WarnAnotherInstance: WarnAnotherInstance:
MessageBox MB_OK|MB_ICONINFORMATION `Another instance of ${APP} is already running. Please close other instances of ${APP} before launching ${FULLNAME}.` MessageBox MB_OK|MB_ICONINFORMATION `Another instance of ${APP} is already running. Please close other instances of ${APP} before launching ${FULLNAME}.`
Abort Abort
DisplaySplash:
; StrCmp $DISABLESPLASHSCREEN "true" GetPassedParameters
;=== Show the splash screen while processing registry entries
; InitPluginsDir
; File /oname=$PLUGINSDIR\splash.jpg "${NAME}.jpg"
; newadvsplash::show /NOUNLOAD 1000 100 0 -1 /L $PLUGINSDIR\splash.jpg
GetPassedParameters: GetPassedParameters:
;=== Get any passed parameters ;=== Get any passed parameters
${GetParameters} $0 ${GetParameters} $0
@ -221,34 +202,8 @@ Section "Main"
System::Call 'Kernel32::SetEnvironmentVariableA(t,t) i("U3_DEVICE_EXEC_PATH", "$EXEDIR\App\Wireshark").r0' System::Call 'Kernel32::SetEnvironmentVariableA(t,t) i("U3_DEVICE_EXEC_PATH", "$EXEDIR\App\Wireshark").r0'
System::Call 'Kernel32::SetEnvironmentVariableA(t,t) i("U3_ENV_VERSION", "1.0").r0' System::Call 'Kernel32::SetEnvironmentVariableA(t,t) i("U3_ENV_VERSION", "1.0").r0'
System::Call 'Kernel32::SetEnvironmentVariableA(t,t) i("U3_ENV_LANGUAGE", "1033").r0' System::Call 'Kernel32::SetEnvironmentVariableA(t,t) i("U3_ENV_LANGUAGE", "1033").r0'
; SettingsDirectory:
;=== Set the settings directory if we have a path
; IfFileExists "$SETTINGSDIRECTORY\*.*" CheckForSettings
; CreateDirectory $SETTINGSDIRECTORY
; CheckForSettings:
StrCmp $SECONDARYLAUNCH "true" LaunchAndExit StrCmp $SECONDARYLAUNCH "true" LaunchAndExit
; IfFileExists "$PROGRAMDIRECTORY\sumatrapdfprefs.txt" AdjustPaths
; IfFileExists "$SETTINGSDIRECTORY\sumatrapdfprefs.txt" MoveSettings AdjustPaths
;IfFileExists "$EXEDIR\App\DefaultData\sumatrapdfprefs.txt" "" LaunchNow
; CopyFiles /SILENT "$EXEDIR\App\DefaultData\sumatrapdfprefs.txt" "$PROGRAMDIRECTORY"
; Goto LaunchNow
; MoveSettings:
; Rename "$SETTINGSDIRECTORY\sumatrapdfprefs.txt" "$PROGRAMDIRECTORY\sumatrapdfprefs.txt"
; AdjustPaths:
; ReadINIStr $LASTDRIVE "$SETTINGSDIRECTORY\${NAME}Settings.ini" "${NAME}Settings" "LastDrive"
; ${GetRoot} $EXEDIR $CURRENTDRIVE
; StrCmp $LASTDRIVE $CURRENTDRIVE RememberPath
; IfFileExists "$PROGRAMDIRECTORY\sumatrapdfprefs.txt" "" RememberPath
; ${ReplaceInFile} "$PROGRAMDIRECTORY\sumatrapdfprefs.txt" 'File: $LASTDRIVE' 'File: $CURRENTDRIVE'
; Delete "$PROGRAMDIRECTORY\sumatrapdfprefs.txt.old"
; RememberPath:
; WriteINIStr "$SETTINGSDIRECTORY\${NAME}Settings.ini" "${NAME}Settings" "LastDrive" "$CURRENTDRIVE"
;LaunchNow:
ExecWait $EXECSTRING ExecWait $EXECSTRING
CheckRunning: CheckRunning:
@ -256,18 +211,13 @@ Section "Main"
FindProcDLL::FindProc "${DEFAULTEXE}" FindProcDLL::FindProc "${DEFAULTEXE}"
StrCmp $R0 "1" CheckRunning StrCmp $R0 "1" CheckRunning
;UninstallWinPcap:
StrCmp $WINPCAP_UNINSTALL "" TheEnd ;=== if we installed it, uninstall it StrCmp $WINPCAP_UNINSTALL "" TheEnd ;=== if we installed it, uninstall it
ExecWait $WINPCAP_UNINSTALL ExecWait $WINPCAP_UNINSTALL
;=== Put the settings file back
; Sleep 500
; Rename "$PROGRAMDIRECTORY\sumatrapdfprefs.txt" "$SETTINGSDIRECTORY\sumatrapdfprefs.txt"
Goto TheEnd Goto TheEnd
LaunchAndExit: LaunchAndExit:
Exec $EXECSTRING Exec $EXECSTRING
TheEnd: TheEnd:
; newadvsplash::wait
SectionEnd SectionEnd

View File

@ -13,6 +13,8 @@ APPINFO = AppInfo
WIRESHARK = Wireshark WIRESHARK = Wireshark
SOURCE = WiresharkPortableSource SOURCE = WiresharkPortableSource
WSMANIFEST = ../../wireshark.manifest
FINDPROCDLL = $(MAKENSIS)\..\Plugins\FindProcDLL.dll FINDPROCDLL = $(MAKENSIS)\..\Plugins\FindProcDLL.dll
TOPDIR = ..\..\.. TOPDIR = ..\..\..
@ -24,6 +26,8 @@ COPY_FLAGS = /d /y
WIN32_SETUP_OPT=--download WIN32_SETUP_OPT=--download
!ENDIF !ENDIF
UPX_FLAGS = -q
PAPPS_VERSION=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_MICRO).0 PAPPS_VERSION=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_MICRO).0
all: package all: package
@ -39,13 +43,31 @@ dirs:
if not exist $(FILES)\$(OTHER) $(MKDIR) $(FILES)\$(OTHER) if not exist $(FILES)\$(OTHER) $(MKDIR) $(FILES)\$(OTHER)
if not exist $(FILES)\$(OTHER)\$(SOURCE) $(MKDIR) $(FILES)\$(OTHER)\$(SOURCE) if not exist $(FILES)\$(OTHER)\$(SOURCE) $(MKDIR) $(FILES)\$(OTHER)\$(SOURCE)
wireshark: nsis-bits:
cd $(U3DIST) cd ../../nsis
nmake -f makefile.nmake test $(MAKE) /$(MAKEFLAGS) -f Makefile.nmake user-guide.chm NEWS.txt
cd ../../portableapps/win32 cd ../u3/win32
$(COPY) $(U3DIST)\device\* $(FILES)\$(APP)\$(WIRESHARK) /S $(COPY_FLAGS)
$(COPY) $(U3DIST)\host\* $(FILES)\$(APP)\$(WIRESHARK) /S $(COPY_FLAGS) $(WSMANIFEST):
# $(UPX) $(FILES)\$(APP)\$(WIRESHARK)\*.dll cd ../..
$(MAKE) /$(MAKEFLAGS) -f makefile.nmake wireshark.manifest
cd portableapps/win32
distribution.nmake: $(WSMANIFEST) makenmake.pl
$(PERL) makenmake.pl $(WSMANIFEST) > $@
distribution: distribution.nmake
nmake -f distribution.nmake
pack: distribution
!IFDEF UPX
-$(UPX) $(UPX_FLAGS) $(FILES)\$(APP)\$(WIRESHARK)\*.exe
-$(UPX) $(UPX_FLAGS) $(FILES)\$(APP)\$(WIRESHARK)\*.dll
-$(UPX) $(UPX_FLAGS) $(FILES)\$(APP)\$(WIRESHARK)\plugins\$(VERSION)\*.dll
-$(UPX) $(UPX_FLAGS) $(FILES)\$(APP)\$(WIRESHARK)\lib\gtk-2.0\$(GTK2_LIB_DIR)\immodules\*.dll
-$(UPX) $(UPX_FLAGS) $(FILES)\$(APP)\$(WIRESHARK)\$(GTK_WIMP_DLLDST_DIR)\*.dll
!ENDIF
appinfo.ini: appinfo.tmpl $(TOPDIR)\config.nmake appinfo.ini: appinfo.tmpl $(TOPDIR)\config.nmake
sed -e 's/$$(PAPPS_VERSION)/$(PAPPS_VERSION)/g' \ sed -e 's/$$(PAPPS_VERSION)/$(PAPPS_VERSION)/g' \
@ -67,7 +89,7 @@ findprocdll:
@$(SH) $(TOPDIR)\tools\win32-setup.sh "$(WIN32_SETUP_OPT)" "$(MAKENSIS)\.." \ @$(SH) $(TOPDIR)\tools\win32-setup.sh "$(WIN32_SETUP_OPT)" "$(MAKENSIS)\.." \
Plugins FindProc.zip Plugins FindProc.zip
WiresharkPortable-$(VERSION).paf.exe : dirs appinfo wireshark source Files/WiresharkPortable.exe Installer.nsi WiresharkPortable-$(VERSION).paf.exe : dirs appinfo nsis-bits pack source Files/WiresharkPortable.exe Installer.nsi
$(MAKENSIS) \ $(MAKENSIS) \
/DVERSION=$(PAPPS_VERSION) \ /DVERSION=$(PAPPS_VERSION) \
/DWSVERSION=$(VERSION) \ /DWSVERSION=$(VERSION) \
@ -80,8 +102,12 @@ Files/WiresharkPortable.exe : WiresharkPortable.nsi findprocdll
WiresharkPortable.nsi WiresharkPortable.nsi
clean: clean:
cd ../../
$(MAKE) -f makefile.nmake $@
cd portableapps/win32
rm -rf $(FILES) rm -rf $(FILES)
rm -rf appinfo.ini rm -rf appinfo.ini
rm -rf distribution.nmake
rm -rf WiresharkPortable-$(VERSION).paf.exe rm -rf WiresharkPortable-$(VERSION).paf.exe
rm -rf *~ *.*~ rm -rf *~ *.*~

View File

@ -0,0 +1,86 @@
#
# makenmake.pl - create a nmake file from a generic manifest file that will create the appropriate PortableApp structure
# $Id$
#
print "
include ../../../config.nmake
include <win32.mak>
FILES = Files
APP = App
WIRESHARK = Wireshark
TOPDIR = ..\\..\\..
COPY = xcopy
MOVE = mv
MKDIR = mkdir
COPY_FLAGS = /d /y
distribution:
";
while($line = <>) {
if($line =~ /^\#/) { # comment
next;
} elsif($line =~ /^\[(\S+)/) { # new directory
$dir = $1;
$dir =~ s/\$INSTDIR?//; # remove $INSTDIR
$dir =~ s/\{/\(/g; $dir =~ s/\}/\)/g; # convert curlies to round brackets
if($dir ne '') {
print "\tif not exist \$(FILES)\\\$(APP)\\\$(WIRESHARK)$dir \$(MKDIR) \$(FILES)\\\$(APP)\\\$(WIRESHARK)$dir\n";
}
} else { # this is a file
$line =~ /^\s+(\S+)/;
$file = $1;
$file =~ s/\{/\(/g; $file =~ s/\}/\)/g; # convert curlies to round brackets
if($file =~ /^[^\$]/) {
$file = "\$(TOPDIR)\\" . $file;
}
if($line =~ /ifdef=(\w+)/) { # dependency
if($define ne $1) {
if(defined $define) {
print "!ENDIF\n";
}
$define = $1;
print "!IF DEFINED($define)";
if($define eq "GTK1_DIR") {
# only include this if GTK2_DIR is not defined
print "& !DEFINED(GTK2_DIR)";
}
print "\n";
}
} else {
if(defined $define) {
print "!ENDIF\n";
}
undef $define;
}
$oname = "";
print "\t\$(COPY) $file \$(FILES)\\\$(APP)\\\$(WIRESHARK)$dir \$(COPY_FLAGS)\n";
if($line =~ /oname=(\S+)/) { # override this filename
$oname = $1;
$file =~ /\\(.*)$/;
$name = $1;
print "\t\$(MOVE) \$(FILES)\\\$(APP)\\\$(WIRESHARK)\\$dir\\$name \$(FILES)\\\$(APP)\\\$(WIRESHARK)\\$dir\\$oname\n";
}
}
}

View File

@ -25,5 +25,22 @@ NSIS is used by the standard Win32 installation mechansim (packaging/nsis) but a
INI Settings INI Settings
============ ============
The Wireshark Portable Launcher will look for an ini file called WiresharkPortable.ini within its directory. It is only necessary to have a ini file if you wish to change the default configuration.
There is an example INI included with this package to get you started. The INI file is formatted as follows:
To be documented. [WiresharkPortable]
WiresharkDirectory
WiresharkExecutable
AdditionalParameters
DisableWinPcapInstall
WinPcapInstaller
The WiresharkDirectory entry should be set to the *relative* path to the directory containing the Wireshark Portable Launcher (WiresharkPortable.exe). This entry must be present.
The WiresharkExecutable entry allows you to set the Wireshark Portable Launcher to use an alternate EXE call to launch Wireshark.
The AdditionalParameters entry allows you to pass additional commandline parameter entries to wireshark.exe.
The DisableWinPcapInstall allows you to disable the installation of WinPcap, even if it it not present on the host system.
The WinPcapInstaller allows you to specify a different WinPcap installer than the default one included in the distribution. For example, if you download a later version.