1#!/bin/sh 2 3# 4# For our package, and for the SMF script, we need to define where we 5# want things to go... 6# 7BIN_DIR="/usr/sbin" 8CONF_DIR="/etc" 9MAN_DIR="/usr/share/man/man8" 10 11PACKAGE_NAME="dnsmasq" 12 13# 14# Since we know we are in the contrib directory we can work out where 15# the rest of the tree is... 16# 17BASEDIR="`dirname $0`/../.." 18 19# 20# We need a version number to use for the package creation... 21# 22if [ $# != 1 ]; then 23 echo "Usage: $0 <package_version_number>" >&2 24 exit 1 25fi 26VERSION="$1" 27 28# 29# First thing we do is fix-up the smf file to use the paths we prefer... 30# 31if [ ! -f "${BASEDIR}/contrib/Solaris10/dnsmasq.xml" ]; then 32 echo "$0: unable to find contrib/Solaris10/dnsmasq.xml" >&2 33 exit 1 34fi 35 36echo "Fixing up smf file ... \c" 37cat "${BASEDIR}/contrib/Solaris10/dnsmasq.xml" | \ 38 sed -e "s%/usr/local/etc%${CONF_DIR}%" \ 39 -e "s%/usr/local/sbin%${BIN_DIR}%" \ 40 -e "s%/usr/local/man%${MAN_DIR}%" > ${BASEDIR}/contrib/Solaris10/dnsmasq-pkg.xml 41echo "done." 42 43echo "Creating packaging file ... \c" 44cat <<EOF >${BASEDIR}/contrib/Solaris10/dnsmasq_package.inc 45# 46# header 47# 48set name=pkg.name value="dnsmasq" 49set name=pkg.description value="dnsmasq daemon - dns, dhcp, tftp etc" 50set name=pkg.detailed_url value="http://www.thekelleys.org.uk/dnsmasq/doc.html" 51set name=info.maintainer value="TBD (tbd@tbd.com)" 52set name=info.upstream value="dnsmasq-discuss@lists.thekelleys.org.uk" 53set name=info.upstream_url value="http://www.thekelleys.org.uk/dnsmasq/doc.html" 54# 55# dependencies ... none? 56# 57 58# 59# directories 60# 61dir mode=0755 owner=root group=bin path=${BIN_DIR}/ 62dir mode=0755 owner=root group=sys path=${CONF_DIR}/ 63dir mode=0755 owner=root group=sys path=${MAN_DIR}/ 64dir mode=0755 owner=root group=sys path=/var/ 65dir mode=0755 owner=root group=sys path=/var/svc 66dir mode=0755 owner=root group=sys path=/var/svc/manifest 67dir mode=0755 owner=root group=sys path=/var/svc/manifest/network 68 69# 70# files 71# 72file ${BASEDIR}/src/dnsmasq mode=0555 owner=root group=bin path=${BIN_DIR}/dnsmasq 73file ${BASEDIR}/man/dnsmasq.8 mode=0555 owner=root group=bin path=${MAN_DIR}/dnsmasq.8 74file ${BASEDIR}/dnsmasq.conf.example mode=0644 owner=root group=sys path=${CONF_DIR}/dnsmasq.conf preserve=strawberry 75file ${BASEDIR}/contrib/Solaris10/dnsmasq-pkg.xml mode=0644 owner=root group=sys path=/var/svc/manifest/network/dnsmasq.xml restart_fmri=svc:/system/manifest-import:default 76 77EOF 78echo "done." 79 80echo "Creating package..." 81eval `pkgsend open ${PACKAGE_NAME}@${VERSION}` 82pkgsend include ${BASEDIR}/contrib/Solaris10/dnsmasq_package.inc 83if [ "$?" = 0 ]; then 84 pkgsend close 85else 86 echo "Errors" 87fi 88