Clean up quagga build oi_151a
authorJon Tibble <meths@btinternet.com>
Tue, 18 Jun 2013 19:17:37 +0100
branchoi_151a
changeset 228 dc60997879d6
parent 227 fbe7929c18b4
child 229 42e9bb6c7067
Clean up quagga build
usr/src/cmd/quagga/Makefile.sfw
usr/src/cmd/quagga/PATCHES.sfw
usr/src/cmd/quagga/exec_attr
usr/src/cmd/quagga/patches/quagga-privs-basicprivset.patch
usr/src/cmd/quagga/patches/quagga-ripngd-getopt.patch
usr/src/cmd/quagga/patches/quagga-sunw-smf.patch
usr/src/cmd/quagga/post-install.sh
--- a/usr/src/cmd/quagga/Makefile.sfw	Tue Jun 18 19:16:48 2013 +0100
+++ b/usr/src/cmd/quagga/Makefile.sfw	Tue Jun 18 19:17:37 2013 +0100
@@ -18,25 +18,23 @@
 #
 # CDDL HEADER END
 #
-# Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
 #
-#pragma ident	"@(#)Makefile.sfw	1.10	10/02/19 SMI"
+#pragma ident	"@(#)Makefile.sfw	1.11	11/03/16 SMI"
 
 NAME=quagga
 VERSION=0.99.8
 SOURCE=$(NAME)-$(VERSION).tar.gz
 SRCDIR=$(NAME)-$(VERSION)
 BUILDDIR=$(NAME)-$(MACH)-build
-VER=$(SRCDIR)
 
-PATCHES:sh= cat ./PATCHES.sfw | grep -v '^\#' | grep -v '^$' | sed 's/\(.*\)/patches\/\1\.applied/'
+PATCHES:sh= cat ./PATCHES.sfw | grep -v '^\#' | grep -v '^$' | sed 's/\(.*\)/$(SRCDIR)\/\1\.applied/'
 
 LD_OPTIONS=-L${ROOT}/usr/lib -L/usr/sfw/lib -L/usr/lib  -R/usr/sfw/lib:/usr/lib
 
-.PARALLEL: .compile
+.PARALLEL: $(BUILDDIR)/.compile
 
-all: runconfig .compile
+all: runconfig $(BUILDDIR)/.compile
 	@find . -name core -exec rm -f {} \;
 
 include ../Makefile.cmd
@@ -102,7 +100,7 @@
 	    --enable-ospf6d --enable-ripngd \
 	    --enable-user=root --enable-group=root)
 
-.compile:
+$(BUILDDIR)/.compile:
 	(cd $(BUILDDIR); $(GMAKE) \
 	    LD_OPTIONS="$(LD_OPTIONS)" \
 	    CC=$(CC) \
@@ -112,32 +110,36 @@
 	    PATH=$(SFW_PATH) \
 	    MAKE=$(GMAKE) \
 	    INSTALL="$(INSTALL) -c" )
-	touch .compile
+	touch $(BUILDDIR)/.compile
 
 packages: install .WAIT
 	(cd $(BUILDDIR)/solaris; $(GMAKE) MAKE="$(GMAKE)" DESTDIR=$(ROOT) packages)
 
 runconfig: $(BUILDDIR)/config.status
 
-.untar: $(SOURCE) 
+untar: $(SRCDIR)/.untar
+
+$(SRCDIR)/.untar: $(SOURCE) 
 	gzip -dc $(SOURCE) | tar xopf -
-	touch .untar
+	touch $(SRCDIR)/.untar
 
-.patch: $(PATCHES)
-	touch .patch
+patch: $(SRCDIR)/.patch
+
+$(SRCDIR)/.patch: $(SRCDIR)/.untar $(PATCHES)
+	touch $(SRCDIR)/.patch
 
 $(BUILDDIR):
 	mkdir $(BUILDDIR)
 
-.prep: .untar .patch $(BUILDDIR)
+.prep: $(SRCDIR)/.untar $(SRCDIR)/.patch $(BUILDDIR)
 	touch .prep
 
 prep: .prep
 
 clean:
-	-$(RM) -r $(SRCDIR) $(BUILDDIR) patches/*.applied .untar .patch .prep .compile
+	-$(RM) -f -r $(SRCDIR) .prep $(BUILDDIR)
 
-%.patch.applied: %.patch
+$(SRCDIR)/%.patch.applied: patches/%.patch
 	(cd $(SRCDIR); gpatch -p0 < ../$< && cp ../$< ../$@ && touch ../$@)
 
 include ../Makefile.targ
--- a/usr/src/cmd/quagga/PATCHES.sfw	Tue Jun 18 19:16:48 2013 +0100
+++ b/usr/src/cmd/quagga/PATCHES.sfw	Tue Jun 18 19:17:37 2013 +0100
@@ -12,6 +12,7 @@
 quagga-isisd-iso-checksum.patch
 quagga-isisd-trill.patch
 quagga-privs-basicprivset.patch
+quagga-ripngd-getopt.patch
 # following two are experimental, and are in use on route-server.quagga.net
 # left in to allow me to easily reconstruct packages for that host
 #quagga-bgp-as4.patch
--- a/usr/src/cmd/quagga/exec_attr	Tue Jun 18 19:16:48 2013 +0100
+++ b/usr/src/cmd/quagga/exec_attr	Tue Jun 18 19:17:37 2013 +0100
@@ -1,2 +1,2 @@
-Network Management:solaris:cmd:::/usr/sbin/quaggaadm:privs=basic
-Network Management:solaris:cmd:::/usr/sbin/zebraadm:privs=basic
+Network Management:solaris:cmd:RO::/usr/sbin/quaggaadm:privs=basic
+Network Management:solaris:cmd:RO::/usr/sbin/zebraadm:privs=basic
--- a/usr/src/cmd/quagga/patches/quagga-privs-basicprivset.patch	Tue Jun 18 19:16:48 2013 +0100
+++ b/usr/src/cmd/quagga/patches/quagga-privs-basicprivset.patch	Tue Jun 18 19:17:37 2013 +0100
@@ -7,11 +7,11 @@
   *
   * Copyright (C) 2003 Paul Jakma.
 - * Copyright (C) 2005 Sun Microsystems, Inc.
-+ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
++ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
   *
   * This file is part of GNU Zebra.
   *
-@@ -351,6 +351,27 @@ zprivs_caps_terminate (void)
+@@ -351,6 +351,26 @@ zprivs_caps_terminate (void)
   * - http://blogs.sun.com/roller/page/gbrunett?entry=privilege_enabling_set_id_programs1
   */
  
@@ -28,7 +28,6 @@
 +
 +   /* create a minimal privilege set from the basic set */
 +  (void) priv_delset(minimal, PRIV_PROC_EXEC);
-+  (void) priv_delset(minimal, PRIV_PROC_FORK);
 +  (void) priv_delset(minimal, PRIV_PROC_INFO);
 +  (void) priv_delset(minimal, PRIV_PROC_SESSION);
 +  (void) priv_delset(minimal, PRIV_FILE_LINK_ANY);
@@ -39,7 +38,7 @@
  /* convert zebras privileges to system capabilities */
  static pset_t *
  zcaps2sys (zebra_capabilities_t *zcaps, int num)
-@@ -379,26 +400,34 @@ zcaps2sys (zebra_capabilities_t *zcaps, int num)
+@@ -379,26 +399,34 @@ zcaps2sys (zebra_capabilities_t *zcaps, int num)
  int 
  zprivs_change_caps (zebra_privs_ops_t op)
  {
@@ -80,7 +79,7 @@
      return -1;
    
    return 0;
-@@ -426,15 +455,15 @@ zprivs_state_caps (void)
+@@ -426,15 +454,15 @@ zprivs_state_caps (void)
      }
    else
      {
@@ -101,7 +100,7 @@
    return result;
  }
  
-@@ -442,7 +471,7 @@ static void
+@@ -442,7 +470,7 @@ static void
  zprivs_caps_init (struct zebra_privs_t *zprivs)
  {
    pset_t *basic;
@@ -110,7 +109,7 @@
    
    /* the specified sets */
    zprivs_state.syscaps_p = zcaps2sys (zprivs->caps_p, zprivs->cap_num_p);
-@@ -470,14 +499,6 @@ zprivs_caps_init (struct zebra_privs_t *zprivs)
+@@ -470,14 +498,6 @@ zprivs_caps_init (struct zebra_privs_t *zprivs)
    priv_union (basic, zprivs_state.syscaps_p);
    priv_freeset (basic);
    
@@ -125,7 +124,7 @@
    /* Hey kernel, we know about privileges! 
     * this isn't strictly required, use of setppriv should have same effect
     */
-@@ -520,16 +541,19 @@ zprivs_caps_init (struct zebra_privs_t *zprivs)
+@@ -520,16 +540,19 @@ zprivs_caps_init (struct zebra_privs_t *zprivs)
        exit (1);
      }
  
@@ -149,7 +148,7 @@
    
    /* set methods for the caller to use */
    zprivs->change = zprivs_change_caps;
-@@ -541,8 +565,7 @@ zprivs_caps_terminate (void)
+@@ -541,8 +564,7 @@ zprivs_caps_terminate (void)
  {
    assert (zprivs_state.caps);
    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/quagga/patches/quagga-ripngd-getopt.patch	Tue Jun 18 19:17:37 2013 +0100
@@ -0,0 +1,19 @@
+*** ripngd/ripng_main.c.orig	Sun Feb 27 10:45:54 2011
+--- ripngd/ripng_main.c	Sun Feb 27 10:47:02 2011
+***************
+*** 207,213 ****
+      {
+        int opt;
+  
+!       opt = getopt_long (argc, argv, "dlf:i:hA:P:u:g:vC", longopts, 0);
+      
+        if (opt == EOF)
+  	break;
+--- 207,213 ----
+      {
+        int opt;
+  
+!       opt = getopt_long (argc, argv, "dlf:i:hA:P:ru:g:vC", longopts, 0);
+      
+        if (opt == EOF)
+  	break;
--- a/usr/src/cmd/quagga/patches/quagga-sunw-smf.patch	Tue Jun 18 19:16:48 2013 +0100
+++ b/usr/src/cmd/quagga/patches/quagga-sunw-smf.patch	Tue Jun 18 19:17:37 2013 +0100
@@ -1,14 +1,14 @@
---- solaris/quagga.init.in.orig	Tue Jul 17 15:09:24 2007
-+++ solaris/quagga.init.in	Tue Jul 17 15:14:59 2007
+--- solaris/quagga.init.in.orig	Sun Feb 27 09:25:54 2011
++++ solaris/quagga.init.in	Sun Feb 27 09:36:47 2011
 @@ -1,6 +1,6 @@
  #!/sbin/sh
  #
 -# Copyright 2001,2003 Sun Microsystems, Inc. All rights reserved.
-+# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
++# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
  # Use is subject to license terms.
  #
  # This file is part of Quagga.
-@@ -25,20 +25,163 @@
+@@ -25,20 +25,164 @@
  # Starts/stops the given daemon
  
  SMFINCLUDE=/lib/svc/share/smf_include.sh
@@ -125,6 +125,7 @@
 +	case $1 in
 +	zebra)
 +		args="${args} `get_daemon_option_from_boolean_property $SMF_FMRI batch -b true`"
++		args="${args} `get_daemon_option_from_boolean_property $SMF_FMRI retain -r true`"
 +		;;
 +	ripd|ripngd)
 +		args="${args} `get_daemon_option_from_boolean_property $SMF_FMRI retain -r true`"
@@ -175,7 +176,7 @@
  else
  	# pre-SMF system, fake up any functions and exit codes
  	# which SMFINCLUDE usually provides.
-@@ -55,7 +198,7 @@
+@@ -55,7 +199,7 @@
  
  usage () {
  	if smf_present ; then
@@ -184,7 +185,7 @@
  	else
  		echo "Usage: $0 <stop|start> <daemon> <daemon arguments>";
  	fi
-@@ -67,7 +210,7 @@
+@@ -67,7 +211,7 @@
  case $1 in
  	'help' | 'usage')
  		usage
@@ -193,7 +194,7 @@
  		;;
  esac
  
-@@ -79,8 +222,6 @@
+@@ -79,8 +223,6 @@
  fi
  
  DAEMON="$1"
@@ -202,7 +203,7 @@
  
  # daemon path must be given
  if [ -z "$DAEMON_PATH/$DAEMON" ]; then
-@@ -91,12 +232,9 @@
+@@ -91,12 +233,9 @@
  # only bgpd is suitable for running in a non-global zone, at this
  # time.
  case "${DAEMON}" in
@@ -216,7 +217,7 @@
  		quagga_is_globalzone || exit $SMF_EXIT_OK
  	;;
  	*)
-@@ -105,6 +243,27 @@
+@@ -105,6 +244,27 @@
  	;;
  esac
  
@@ -225,7 +226,7 @@
 +# so we must handle that.
 +if [ smf_present -a -f "$ROUTEADMINCLUDE" ]; then
 +	handle_routeadm_upgrade $DAEMON;
-+	DAEMON_ARGS=`routeadm_daemon_args`;
++	DAEMON_ARGS=`routeadm_daemon_args $DAEMON`;
 +	routeadm_zebra_enable $DAEMON;
 +else
 +	if [ $# -gt 0 ] ; then
@@ -244,7 +245,7 @@
  # we need @quagga_statedir@ to exist, it probably is on tmpfs.
  if [ ! -d @quagga_statedir@ ] ; then
  	mkdir -p @quagga_statedir@
-@@ -115,6 +274,10 @@
+@@ -115,6 +275,10 @@
  PIDFILE="@quagga_statedir@/${DAEMON}.pid"
  
  start () {
@@ -256,7 +257,7 @@
 +	eval exec $DAEMON_PATH/$DAEMON $DAEMON_ARGS --pid_file ${PIDFILE} &
  }
  
-@@ -134,7 +297,7 @@
+@@ -134,7 +298,7 @@
  
  *)
  	usage
@@ -265,8 +266,8 @@
  	;;
  esac	
  
---- solaris/quagga.xml.in.orig	Tue Jul 17 15:09:11 2007
-+++ solaris/quagga.xml.in	Tue Jul 17 15:11:49 2007
+--- solaris/quagga.xml.in.orig	Sun Feb 27 09:25:54 2011
++++ solaris/quagga.xml.in	Sun Feb 27 09:28:09 2011
 @@ -18,18 +18,20 @@
  	Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  	02111-1307, USA.
@@ -326,7 +327,7 @@
   		</method_context>
  	</exec_method>
  
-@@ -84,11 +86,47 @@
+@@ -84,11 +86,48 @@
  		<propval name='ignore_error'
  		    type='astring' value='core,signal' />
  	</property_group>
@@ -374,10 +375,11 @@
 +		
 +		<!-- Options specific to zebra -->
 +		<propval name='batch' type='boolean' value='false' />
++		<propval name='retain' type='boolean' value='false' />
  	</property_group>
  	
  	<property_group name='general' type='framework'>
-@@ -95,6 +133,8 @@
+@@ -95,6 +134,8 @@
  		<!-- to start stop routing services -->
  		<propval name='action_authorization' type='astring'
  			 value='solaris.smf.manage.routing' />
@@ -386,7 +388,7 @@
  	</property_group>
  
  	<template>
-@@ -111,7 +151,7 @@
+@@ -111,7 +152,7 @@
  		</documentation>
  	</template>
  	</instance>
@@ -395,7 +397,7 @@
  </service>
  
  <service
-@@ -129,39 +169,40 @@
+@@ -129,39 +170,40 @@
  			value='svc:/system/filesystem/usr:default' />
  	</dependency>
  
@@ -457,7 +459,7 @@
   		</method_context>
  	</exec_method>
  
-@@ -179,10 +220,44 @@
+@@ -179,10 +221,44 @@
  		    type='astring' value='core,signal' />
  	</property_group>
  
@@ -504,7 +506,7 @@
  	</property_group>
  
  	<property_group name='general' type='framework'>
-@@ -189,6 +264,8 @@
+@@ -189,6 +265,8 @@
  		<!-- to start stop routing services -->
  		<propval name='action_authorization' type='astring'
  			 value='solaris.smf.manage.routing' />
@@ -513,7 +515,7 @@
  	</property_group>
  
  	<template>
-@@ -205,7 +282,7 @@
+@@ -205,7 +283,7 @@
  		</documentation>
  	</template>
  	</instance>
@@ -522,7 +524,7 @@
  </service>
  
  <service
-@@ -223,39 +300,40 @@
+@@ -223,39 +301,40 @@
  			value='svc:/system/filesystem/usr:default' />
  	</dependency>
  	
@@ -583,7 +585,7 @@
   		</method_context>
  	</exec_method>
  
-@@ -273,10 +351,42 @@
+@@ -273,10 +352,42 @@
  		    type='astring' value='core,signal' />
  	</property_group>
  
@@ -628,7 +630,7 @@
  	</property_group>
  
  	<property_group name='general' type='framework'>
-@@ -283,6 +393,8 @@
+@@ -283,6 +394,8 @@
  		<!-- to start stop routing services -->
  		<propval name='action_authorization' type='astring'
  			 value='solaris.smf.manage.routing' />
@@ -637,7 +639,7 @@
  	</property_group>
  
  	<template>
-@@ -299,7 +411,7 @@
+@@ -299,7 +412,7 @@
  		</documentation>
  	</template>
  	</instance>
@@ -646,7 +648,7 @@
  </service>
  
  <service
-@@ -317,47 +429,51 @@
+@@ -317,47 +430,51 @@
  			value='svc:/system/filesystem/usr:default' />
  	</dependency>
  	
@@ -719,7 +721,7 @@
  	</exec_method>
  
  	<property_group name='startd'
-@@ -367,10 +483,41 @@
+@@ -367,10 +484,41 @@
  		    type='astring' value='core,signal' />
  	</property_group>
  
@@ -763,7 +765,7 @@
  	</property_group>
  
  	<property_group name='general' type='framework'>
-@@ -377,6 +524,8 @@
+@@ -377,6 +525,8 @@
  		<!-- to start stop routing services -->
  		<propval name='action_authorization' type='astring'
  			 value='solaris.smf.manage.routing' />
@@ -772,7 +774,7 @@
  	</property_group>
  
  	<template>
-@@ -393,7 +542,7 @@
+@@ -393,7 +543,7 @@
  		</documentation>
  	</template>
  	</instance>
@@ -781,7 +783,7 @@
  </service>
  
  <service
-@@ -411,39 +560,40 @@
+@@ -411,39 +561,40 @@
  			value='svc:/system/filesystem/usr:default' />
  	</dependency>
  	
@@ -842,7 +844,7 @@
   		</method_context>
  	</exec_method>
  
-@@ -461,10 +611,39 @@
+@@ -461,10 +612,39 @@
  		    type='astring' value='core,signal' />
  	</property_group>
  
@@ -884,7 +886,7 @@
  	</property_group>
  
  	<property_group name='general' type='framework'>
-@@ -471,12 +650,14 @@
+@@ -471,12 +651,14 @@
  		<!-- to start stop routing services -->
  		<propval name='action_authorization' type='astring'
  			 value='solaris.smf.manage.routing' />
@@ -900,7 +902,7 @@
  			</loctext>
  		</common_name>
  		<documentation>
-@@ -487,7 +668,7 @@
+@@ -487,7 +669,7 @@
  		</documentation>
  	</template>
  	</instance>
@@ -909,7 +911,7 @@
  </service>
  
  
-@@ -506,40 +687,48 @@
+@@ -506,40 +688,48 @@
  			value='svc:/system/filesystem/usr:default' />
  	</dependency>
  	
@@ -979,7 +981,7 @@
   		</method_context>
  	</exec_method>
  
-@@ -557,10 +746,57 @@
+@@ -557,10 +747,57 @@
  		    type='astring' value='core,signal' />
  	</property_group>
  
@@ -1039,7 +1041,7 @@
  	</property_group>
  
  	<property_group name='general' type='framework'>
-@@ -567,6 +803,8 @@
+@@ -567,6 +804,8 @@
  		<!-- to start stop routing services -->
  		<propval name='action_authorization' type='astring'
  			 value='solaris.smf.manage.routing' />
@@ -1048,7 +1050,7 @@
  	</property_group>
  
  	<template>
-@@ -583,6 +821,6 @@
+@@ -583,6 +823,6 @@
  		</documentation>
  	</template>
  	</instance>
--- a/usr/src/cmd/quagga/post-install.sh	Tue Jun 18 19:16:48 2013 +0100
+++ b/usr/src/cmd/quagga/post-install.sh	Tue Jun 18 19:17:37 2013 +0100
@@ -19,9 +19,9 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
 #
-# ident	"@(#)post-install.sh	1.8	10/04/22 SMI"
+# ident	"@(#)post-install.sh	1.9	11/03/10 SMI"
 #
 # Handle various things where the files installed by Quagga's 'make install'
 # differ from what we need for the SFW packages. E.g.:
@@ -73,7 +73,7 @@
 	"usr/sfw/include/quagga/*.h" \
 	"usr/sfw/include/quagga/ospfd/*.h" \
 	"usr/sfw/include/quagga/ospfapi/*.h" ; do
-	rm -- ${ROOT}/${H}
+	rm -f -- ${ROOT}/${H}
 done
 
 for H in quagga/ospfd quagga/ospfapi quagga ; do
@@ -95,7 +95,6 @@
 _install N ../Solaris/quaggaadm.1m ${ROOT}/usr/sfw/share/man/man1m/quaggaadm.1m 444
 _install N ../Solaris/README.Solaris ${ROOT}/etc/quagga/README.Solaris 644
 _install N ../Solaris/ospfd.HA.conf.sample ${ROOT}/etc/quagga/ospfd.HA.conf.sample 644
-_install N ../../../common/rbac/exec_attr ${ROOT}/etc/security/exec_attr 644
 _install S ../Solaris/quaggaadm ${ROOT}/usr/sbin/quaggaadm 555
 _install L quaggaadm ${ROOT}/usr/sbin/zebraadm
 _install N solaris/quagga.xml ${ROOT}/lib/svc/manifest/network/routing/quagga.xml 444
@@ -104,4 +103,4 @@
 _install N ${SRCDIR}/doc/quagga.info-1 ${ROOT}/usr/sfw/share/info/quagga.info 444
 
 # rm the make-install'd quagga.info-1
-rm ${ROOT}/usr/sfw/share/info/quagga.info-1
+rm -f ${ROOT}/usr/sfw/share/info/quagga.info-1