summaryrefslogtreecommitdiff
blob: e5c79a6491061b200325a273b44a063584852424 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-usbin/freebsd-usbin-6.0-r1.ebuild,v 1.2 2006/04/20 07:16:22 flameeyes Exp $

inherit bsdmk freebsd flag-o-matic eutils

DESCRIPTION="FreeBSD /usr/sbin tools"
SLOT="0"
KEYWORDS="~x86-fbsd"

IUSE="atm bluetooth tcpd ssl usb ipv6 acpi ipfilter isdn pam ssl radius
	netgraph minimal ipsec nis pam suid nat radius"

SRC_URI="mirror://gentoo/${P}.tar.bz2
		mirror://gentoo/${CONTRIB}.tar.bz2
		mirror://gentoo/${UBIN}.tar.bz2
		mirror://gentoo/${LIB}.tar.bz2
		mirror://gentoo/${SBIN}.tar.bz2
		mirror://gentoo/${ETC}.tar.bz2
		nis? ( mirror://gentoo/${LIBEXEC}.tar.bz2 )"

RDEPEND="=sys-freebsd/freebsd-lib-${RV}*
	=sys-freebsd/freebsd-libexec-${RV}*
	ssl? ( dev-libs/openssl )
	tcpd? ( sys-apps/tcp-wrappers )
	net-libs/libpcap"
DEPEND="${RDEPEND}
	=sys-freebsd/freebsd-mk-defs-${RV}*
	=sys-freebsd/freebsd-sources-${RV}*
	sys-apps/texinfo
	sys-devel/flex"

PROVIDE="virtual/logger"

S="${WORKDIR}/usr.sbin"

pkg_setup() {
	# Release crunch is something like minimal. It seems to remove everything
	# which is not needed to work.
	use minimal && mymakeopts="${mymakeopts} RELEASE_CRUNCH= "

	use atm || mymakeopts="${mymakeopts} NO_ATM= "
	use bluetooth || mymakeopts="${mymakeopts} NO_BLUETOOTH= "
	use ipv6 || mymakeopts="${mymakeopts} NO_INET6= "
	use ipfilter || mymakeopts="${mymakeopts} NO_IPFILTER= "
	use ssl || mymakeopts="${mymakeopts} NO_OPENSSL= NO_CRYPT= "
	use usb || mymakeopts="${mymakeopts} NO_USB= "
	use acpi || mymakeopts="${mymakeopts} NO_ACPI= "
	use isdn || mymakeopts="${mymakeopts} NO_I4B= "
	use pam || mymakeopts="${mymakeopts} NO_PAM= "
	use radius || mymakeopts="${mymakeopts} NO_RADIUS= "
	use suid || mymakeopts="${mymakeopts} NO_SUID= "
	use ipsec || mymakeopts="${mymakeopts} NO_IPSEC= "
	use nis || mymakeopts="${mymakeopts} NO_NIS= "
	use nat || mymakeopts="${mymakeopts} NO_NAT= "
	use pam || mymakeopts="${mymakeopts} NO_PAM= "
	use suid || mymakeopts="${mymakeopts} NO_SUID= PPP_NOSUID= "
	use radius || mymakeopts="${mymakeopts} NO_RADIUS= "
	use tcpd || mymakeopts="${mymakeopts} NO_WRAP= "

	mymakeopts="${mymakeopts} NO_MAILWRAPPER= NO_BIND= NO_SENDMAIL= NO_PF= NO_AUTHPF= NO_LPR="

	# kldxref does not build with -O2
	replace-flags "-O?" "-O1"
}

PATCHES="${FILESDIR}/${PN}-${RV}-fixmakefiles.patch
	${FILESDIR}/${PN}-nowrap.patch"

REMOVE_SUBDIRS="
	named named-checkzone named-checkconf rndc rndc-confgen
		dnssec-keygen dnssec-signzone
	tcpdchk tcpdmatch
	sendmail praliases editmap mailstats makemap
	sysinstall cron mailwrapper ntp bsnmpd mount_smbfs
	tcpdump ndp traceroute pkg_install inetd
	wpa/wpa_supplicant wpa/hostapd"

src_unpack() {
	freebsd_src_unpack
	ln -s "/usr/src/sys-${RV}" "${WORKDIR}/sys"
	ln -s "/usr/include" "${WORKDIR}/include"
}

src_install() {
	# By creating these two directories we avoid having to do a
	# more complex hack inside lpr/SMM.doc and nologin makefiles.
	dodir /usr/share/doc
	dodir /sbin
	dodir /usr/libexec

	# FILESDIR is used by some makefiles which will install files
	# in the wrong place, just put it in the doc directory.
	mkinstall DOCDIR=/usr/share/doc/${PF} || die "Install failed"

	for util in nfs nfsmount rpcbind syslogd moused powerd; do
		newinitd ${FILESDIR}/${util}.initd ${util}
		[[ -e ${FILESDIR}/${util}.confd ]] && \
			newconfd ${FILESDIR}/${util}.confd ${util}
	done

	for class in daily monthly weekly; do
		cat - > ${T}/periodic.${class} <<EOS
#!/bin/sh
/usr/sbin/periodic ${class}
EOS
		exeinto /etc/cron.${class}
		newexe ${T}/periodic.${class} periodic
	done

	# Install the pw.conf file to let pw use Gentoo's skel location
	insinto /etc
	doins "${FILESDIR}/pw.conf"

	cd "${WORKDIR}/etc"
	doins amd.map apmd.conf syslog.conf newsyslog.conf usbd.conf

	insinto /etc/ppp
	doins ppp/ppp.conf

	if use isdn; then
		insinto /etc/isdn
		doins isdn/*
		rm -f ${D}/etc/isdn/Makefile
	fi

	if use bluetooth; then
		insinto /etc/bluetooth
		doins bluetooth/*
		rm -f ${D}/etc/bluetooth/Makefile
	fi

	# Install the periodic stuff (needs probably to be ported in a more
	# gentooish way)
	cd "${WORKDIR}/etc/periodic"

	doperiodic daily daily/*.accounting
	doperiodic monthly monthly/*.accounting
}

pkg_postinst() {
	for logfile in messages security auth.log maillog lpd-errs xferlog cron \
		debug.log slip.log ppp.log; do
		[[ -f ${ROOT}/var/log/${logfile} ]] || touch ${ROOT}/var/log/${logfile}
	done
}