nps: jnet/Makefile, jnet/makefile.common (REMOVED) - makefile.comm...

baggins baggins at pld-linux.org
Thu Sep 22 01:40:56 CEST 2005


Author: baggins                      Date: Wed Sep 21 23:40:56 2005 GMT
Module: nps                           Tag: HEAD
---- Log message:
- makefile.commont contents moved to Makefile

---- Files affected:
nps/jnet:
   Makefile (1.1 -> 1.2) , makefile.common (1.2 -> NONE)  (REMOVED)

---- Diffs:

================================================================
Index: nps/jnet/Makefile
diff -u nps/jnet/Makefile:1.1 nps/jnet/Makefile:1.2
--- nps/jnet/Makefile:1.1	Sun Sep 18 01:33:27 2005
+++ nps/jnet/Makefile	Thu Sep 22 01:40:51 2005
@@ -1,8 +1,65 @@
+################################################################################
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+# 
+#
+#  $Header$
+# 
+################################################################################
+SP_HOSTNAME = sp.D332B385-5567-42e9-8D66-545897E8120A
+
+###########################################################################
+# Environment tests
+
 KERNEL_DIR=/usr/src/linux
 PWD=$(shell pwd)
 TOPDIR=$(shell dirname $(PWD))
 
-KERNEL_VERSION := $(shell grep -m 1 UTS_RELEASE $(KERNEL_DIR)/include/linux/version.h | sed -e 's/.*UTS_RELEASE "\([0-9]*\.[0-9]*\)\..*"/\1/')
+# get the kernel version - we use this to find the correct install path
+KVER := $(shell grep -m 1 UTS_RELEASE $(KERNEL_DIR)/include/linux/version.h | sed -e 's/.*UTS_RELEASE "\(.*\)"/\1/')
+
+KERNEL_VERSION := $(shell echo $(KVER) | sed -e 's/\([0-9]*\.[0-9]*\)\..*/\1/')
+
+KKVER := $(shell echo $(KVER) | awk '{ if ($$0 ~ /2\.[4-9]\./) print "1"; else print "0"}')
+ifeq ($(KKVER), 0)
+  $(error *** Aborting the build. \
+          *** This driver is not supported on kernel versions older than 2.4.0)
+endif
+
+ifneq ($(KVER),$(shell uname -r))
+  $(warning ***)
+  $(warning *** Warning: kernel source version ($(KVER)))
+  $(warning *** does not match running kernel  ($(shell uname -r)))
+  $(warning *** Continuing with build,)
+  $(warning *** resulting driver may not be what you want)
+  $(warning ***)
+endif
+
+# pick an appropriate install path
+ifneq (,$(wildcard /lib/modules/$(KVER)/kernel))
+  INSTDIR := /lib/modules/$(KVER)/kernel/drivers/net
+else
+  INSTDIR := /lib/modules/$(KVER)/net
+endif
+
+# depmod version for rpm builds
+DEPVER := $(shell /sbin/depmod -V 2>/dev/null | awk 'BEGIN {FS="."} NR==1 {print $$2}')
+
+###########################################################################
+# Build rules
+.PHONY: clean install uninstall preinstall postinstall postuninstall
 
 ifeq ($(KERNEL_VERSION),2.4)
   include $(TOPDIR)/jnet/makefile.2_4
@@ -12,4 +69,81 @@
   endif
 endif
 
-include $(TOPDIR)/jnet/makefile.common
+install: preinstall
+	# remove all old versions of the driver
+	find $(DESTDIR)/lib/modules/$(KVER) -name $(TARGET) -exec rm {} \; \
+		|| true
+	@mkdir -p $(DESTDIR)/lib/modules/$(KVER)
+	install -D -m 644 $(TARGET) $(DESTDIR)$(INSTDIR)/$(TARGET)
+ifeq (,$(DESTDIR))
+	/sbin/depmod -a || true
+else
+  ifeq ($(DEPVER),1 )
+	/sbin/depmod -r $(DESTDIR) -a || true
+  else
+	/sbin/depmod -b $(DESTDIR) -a -n > /dev/null || true
+  endif
+endif
+	@mkdir -p $(DESTDIR)/etc/newisys/jnet
+	sed -e "s/<SWInstalledDate>.*</<SWInstalledDate>`date +%s`</" \
+	    -e "s/SWInfo\(.*\)</SWInfo\1 Source</" \
+	  < swinventory.xml > $(DESTDIR)/etc/newisys/jnet/swinventory.xml
+	@chmod 644 $(DESTDIR)/etc/newisys/jnet/swinventory.xml
+	make postinstall
+
+uninstall:
+	if [ -e $(INSTDIR)/$(TARGET) ] ; then \
+	    rm -f $(INSTDIR)/$(TARGET) ; \
+	fi
+	/sbin/depmod -a
+	rm -rf /etc/newisys/jnet
+	make postuninstall
+
+#
+# if we are running RH9, we need to add a flag to the network config file
+#
+preinstall:
+ifeq (,$(BUILD_FROM_RPM))
+	if `uname -r | grep -v "grep" | grep -q "2.4.2[01]-"` ; then \
+          if [ -f /etc/sysconfig/network ] ; then \
+            if ! `grep -q NOZEROCONF.*yes $(DESTDIR)/etc/sysconfig/network` ; then \
+              echo "NOZEROCONF=yes $(DESTDIR)/etc/sysconfig/network" ;\
+              echo "NOZEROCONF=yes" >> $(DESTDIR)/etc/sysconfig/network ;\
+            fi ;\
+          fi ;\
+        fi
+endif
+
+#
+# 1.  need to add a file for JNET's ip address
+# 2.  the "route del" command is needed to run poci after an install without rebooting
+# 2b. need to add to /etc/hosts
+#
+postinstall:
+ifeq (,$(BUILD_FROM_RPM))
+	@if [ ! -f $(DESTDIR)/etc/newisys/jnet/jnet.conf ] ; then \
+          mkdir -p $(DESTDIR)/etc/newisys/jnet ;\
+          echo "install $(DESTDIR)/etc/newisys/jnet/jnet.conf" ;\
+          echo "169.254.101.2" >$(DESTDIR)/etc/newisys/jnet/jnet.conf ;\
+          chmod 600 $(DESTDIR)/etc/newisys/jnet/jnet.conf ;\
+          echo "adding $(SP_HOSTNAME) to $(DESTDIR)/etc/hosts" ;\
+          echo "169.254.101.2  $(SP_HOSTNAME)" >> $(DESTDIR)/etc/hosts ;\
+        fi
+	@if [ ! `lsmod | grep -q "jnet"` ] ; then \
+          if `uname -r | grep -v "grep" | grep -q "2.4.2[01]-"` ; then \
+            echo "route del -net 169.254.0.0 gw 0 netmask 255.255.0.0 dev eth0" ;\
+            route del -net 169.254.0.0 gw 0 netmask 255.255.0.0 dev eth0 1>/dev/null 2>/dev/null || true;\
+            echo "route del -net 169.254.0.0 gw 0 netmask 255.255.0.0 dev eth1" ;\
+            route del -net 169.254.0.0 gw 0 netmask 255.255.0.0 dev eth1 1>/dev/null 2>/dev/null || true;\
+          fi ;\
+        fi
+endif
+
+#
+# need to remove jnet's file
+# need to remove to /etc/hosts
+#
+postuninstall:
+	rm -rf /etc/jnet
+	@sed /.*$(SP_HOSTNAME)/d < /etc/hosts > /etc/hosts.bak
+	@mv /etc/hosts.bak /etc/hosts
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/nps/jnet/Makefile?r1=1.1&r2=1.2&f=u




More information about the pld-cvs-commit mailing list