summaryrefslogtreecommitdiff
blob: 5e4fa72b06f430b786f1ad0a7fa6d2e5445c5dab (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
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/slocate/slocate-2.7-r5.ebuild,v 1.13 2004/06/16 01:52:15 dragonheart Exp $

inherit flag-o-matic

DESCRIPTION="Secure way to index and quickly search for files on your system (drop-in replacement for 'locate')"
HOMEPAGE="http://www.geekreview.org/slocate/"
SRC_URI="ftp://ftp.geekreview.org/slocate/src/slocate-${PV}.tar.gz
	mirror://gentoo/slocate-${PV}-uclibc-sl_fts.patch"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="x86 ppc sparc mips alpha arm hppa amd64 ia64 ppc64 s390"
IUSE="uclibc"

DEPEND="sys-apps/shadow
	>=sys-apps/sed-4
	sys-devel/automake"
RDEPEND="sys-apps/shadow"

src_unpack() {
	unpack ${A}
	use uclibc && epatch ${DISTDIR}/slocate-${PV}-uclibc-sl_fts.patch
}

src_compile() {
	filter-lfs-flags
	econf || die
	emake || die
}

src_install() {
	dodir /usr/share/man/man1

	sed -i -e "/groupadd/s/^/#/;/chown.*slocate/s/^/#/" Makefile || die
	make DESTDIR=${D} install || die

	# make install for this package is blocked by sandbox
	dosym slocate /usr/bin/locate
	dosym slocate /usr/bin/updatedb
	fperms 0755 /etc/cron.daily/slocate
	keepdir /var/lib/slocate

	# fix bug 37354: nice updatedb
	sed -i -e 's,^\([[:space:]]*\)\(/usr/bin/updatedb\),\1nice \2,' \
		${D}/etc/cron.daily/slocate

	dodoc INSTALL AUTHORS NEWS README ChangeLog

	# man page fixing
	rm -f ${D}/usr/share/man/man1/locate.1.gz
	dosym slocate.1.gz /usr/share/man/man1/locate.1.gz

	insinto /etc
	doins ${FILESDIR}/updatedb.conf
	fperms 0644 /etc/updatedb.conf
}

pkg_postinst() {
	touch /var/lib/slocate/slocate.db

	# /var/lib/slocate is owned by group slocate and so is the executable
	if ! groupmod slocate; then
		groupadd slocate 2> /dev/null || die "Failed to create slocate group"
	fi

	chown root:slocate /usr/bin/slocate

	# If nobody else minds I'd like to see 2711 become the system wide default.
	# -solar
	if has sfperms ${FEATURES}; then
		chmod 2711 /usr/bin/slocate
	else
		chmod 2755 /usr/bin/slocate
	fi

	chown -R root:slocate /var/lib/slocate
	chmod 0750 /var/lib/slocate

	if [[ -f /etc/cron.daily/slocate.cron ]]; then
		ewarn
		ewarn "If you merged slocate-2.7.ebuild, please remove"
		ewarn "/etc/cron.daily/slocate.cron since .cron has been removed"
		ewarn "from the filename"
		ewarn
		echo
	fi

	einfo
	einfo "Note that the /etc/updatedb.conf file is generic"
	einfo "Please customize it to your system requirements"
	einfo
}