usr/src/cmd/quagga/post-install.sh
author Jon Tibble <meths@btinternet.com>
Tue, 18 Jun 2013 19:17:37 +0100
branchoi_151a
changeset 228 dc60997879d6
parent 14 ebdd963f7d5e
permissions -rw-r--r--
Clean up quagga build

#!/bin/sh

# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
#
# 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.:
#
# - manual pages are delivered mode 0444, but make install'd 0644. Perms must
#   be fixed. Similar with various other files.
#   - it'd be nice to just specify the desired permissions level in /only/
#     the prototype files, but can't cause checkproto complains
# - make install delivers static libs, headers and libtool files, must
#   be removed from proto area.
#   - or else checkproto complains
# - there are files in Solaris/ which we deliver but which the source
#   'make install' obviously doesnt install, we must copy those
#   to the proto area.
#   - we could use pkgmk's "f wherever/file=../../cmd/quagga/Solaris/file"
#     feature, unfortunately protocmp doesnt grok this, so checkproto complains
#
# This script contains information which is replicated in ../../pkgdefs/...
# changes here must be synced to relevant prototype files, and similarly
# vice versa. Slightly tedious.

if [ $# -ne 2 ]; then
	exit 1;
fi

ROOT="$1"
SRCDIR="../${2}"

if [ ! -d "$ROOT" ]; then
	exit 1;
fi

if [ ! -d "$SRCDIR" ]; then
	exit 1;
fi

. ${SRC}/tools/install.subr

# Remove unused installed files. E.g. libzebra/libospf development related
# files, such as headers, static libs libtool files, unused man pages, etc.
for H in "usr/sbin/ospfclient" \
	"usr/sfw/lib/libospf.a*" \
	"usr/sfw/lib/libospf.la*" \
	"usr/sfw/lib/libzebra.a*" \
	"usr/sfw/lib/libzebra.la*" \
	"usr/sfw/lib/libospfapiclient.a*" \
	"usr/sfw/lib/libospfapiclient.la*" \
	"usr/sfw/share/man/man1/vtysh.1" \
	"usr/sfw/include/quagga/*.h" \
	"usr/sfw/include/quagga/ospfd/*.h" \
	"usr/sfw/include/quagga/ospfapi/*.h" ; do
	rm -f -- ${ROOT}/${H}
done

for H in quagga/ospfd quagga/ospfapi quagga ; do
	rmdir ${ROOT}/usr/sfw/include/${H}
done

# various docs
for H in zebra ospfd ospf6d bgpd ripd ripngd isisd ; do
	chmod 0444 "$ROOT"/usr/sfw/share/man/man8/${H}.8
done
chmod 0444 "$ROOT"/usr/sfw/share/info/quagga.info

# Don't leave /etc/quagga in the root be dependent on vagaries of
# umask, etc.. 
chmod 0755 "$ROOT"/etc/quagga 

# files which must be copied.
_install N ../Solaris/quagga.8 ${ROOT}/usr/sfw/share/man/man8/quagga.8 444
_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 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
_install N solaris/trill.xml ${ROOT}/lib/svc/manifest/network/routing/trill.xml 444
_install S solaris/quagga.init ${ROOT}/lib/svc/method/quagga 0555
_install N ${SRCDIR}/doc/quagga.info-1 ${ROOT}/usr/sfw/share/info/quagga.info 444

# rm the make-install'd quagga.info-1
rm -f ${ROOT}/usr/sfw/share/info/quagga.info-1