From 31091d70cebd9ce4592013f2b0e01346d2e934f0 Mon Sep 17 00:00:00 2001 From: Glen Gibb Date: Fri, 11 Jul 2008 17:45:20 -0700 Subject: [PATCH] Better identification of global plugin dir Looks in a couple of spots to identify the global plugin dir. Tries to identify versions beneath that if they exist and chooses the last (newest). --- .../wireshark_dissectors/openflow/Makefile | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/utilities/wireshark_dissectors/openflow/Makefile b/utilities/wireshark_dissectors/openflow/Makefile index 2413467..c43d395 100644 --- a/utilities/wireshark_dissectors/openflow/Makefile +++ b/utilities/wireshark_dissectors/openflow/Makefile @@ -10,9 +10,27 @@ PLUGIN_NAME = packet-openflow LOCAL_PLUGIN_DIR = /home/$(shell whoami)/.wireshark/plugins # determine global installation path (use latest plugin version path) -GLOBAL_PLUGIN_DIR_PARTIAL=/usr/local/lib/wireshark/plugins -GLOBAL_PLUGIN_VER=$(shell ls $(GLOBAL_PLUGIN_DIR_PARTIAL) | sort --reverse | head -n 1) -GLOBAL_PLUGIN_DIR=$(GLOBAL_PLUGIN_DIR_PARTIAL)/$(GLOBAL_PLUGIN_VER) +ifneq ($(wildcard /usr/lib/wireshark/plugins),) + GLOBAL_PLUGIN_DIR_PARTIAL=/usr/lib/wireshark/plugins +else ifneq ($(wildcard /usr/local/lib/wireshark/plugins),) + GLOBAL_PLUGIN_DIR_PARTIAL=/usr/local/lib/wireshark/plugins +endif + +# Work out if there are version-specific subdirectories +GLOBAL_PLUGIN_DIR_FILES := $(wildcard $(GLOBAL_PLUGIN_DIR_PARTIAL)/*) +GLOBAL_PLUGIN_DIR_SUBDIRS := $(foreach file,$(GLOBAL_PLUGIN_DIR_FILES),$(dir $(wildcard $(file)/.))) +GLOBAL_PLUGIN_DIR_SUBDIRS := $(subst $(GLOBAL_PLUGIN_DIR_PARTIAL)/,,$(GLOBAL_PLUGIN_DIR_SUBDIRS)) +GLOBAL_PLUGIN_DIR_SUBDIRS := $(subst /,,$(GLOBAL_PLUGIN_DIR_SUBDIRS)) + +# Assume that the "last" directory is the one we ant to use if it exists +GLOBAL_PLUGIN_VER := $(lastword $(sort $(GLOBAL_PLUGIN_DIR_SUBDIRS))) + +# Create the actual global plugin dir to use +ifneq ($(GLOBAL_PLUGIN_VER),) + GLOBAL_PLUGIN_DIR=$(GLOBAL_PLUGIN_DIR_PARTIAL)/$(GLOBAL_PLUGIN_VER) +else + GLOBAL_PLUGIN_DIR=$(GLOBAL_PLUGIN_DIR_PARTIAL) +endif # specify the port on which event capture packets will be destined DISSECT_PORT = -DOPENFLOW_DST_TCP_PORT=975