Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Apr 2007 22:16:42 +1000
From:      Edwin Groothuis <edwin@mavetju.org>
To:        Evren Yurtesen <yurtesen@ispro.net>, freebsd-hackers@freebsd.org
Subject:   Re: any plans to enhance 'locate'?
Message-ID:  <20070413121642.GB1028@k7.mavetju>
In-Reply-To: <20070413113537.GA1028@k7.mavetju>
References:  <461F1CCB.7070504@ispro.net> <20070413113537.GA1028@k7.mavetju>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Apr 13, 2007 at 09:35:37PM +1000, Edwin Groothuis wrote:
> On Fri, Apr 13, 2007 at 09:01:47AM +0300, Evren Yurtesen wrote:
> > Is there a reason why there is no port for slocate or the FreeBSD
> > locate to not to be enhanced this way?
> > 
> > There seems to be a port for this for Mac OS X:
> > http://slocate.darwinports.com/dports/sysutils/slocate/
> 
> Port it to FreeBSD, and submit it for in the ports collection :-)

In case you're brave, the basic work is done. All you need to do
is something which does do the mkdir and pw group add slocate at
the installation.

Don't forget portlint :-)

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	slocate/
#	slocate/Makefile
#	slocate/distinfo
#	slocate/files
#	slocate/files/patch-main.c
#
echo c - slocate/
mkdir -p slocate/ > /dev/null 2>&1
echo x - slocate/Makefile
sed 's/^X//' >slocate/Makefile << 'END-of-slocate/Makefile'
XPORTNAME=	slocate
XPORTVERSION=	2.7
XCATEGORIES=	sysutils security
XMASTER_SITES=	http://www.mirrors.wiretapped.net/security/host-security/slocate/src/
X
XCOMMENT=	slocate
XMAINTAINER=	you
X
XUSE_GMAKE=	yes
XUSE_AUTOTOOLS=	automake:14
XHAS_CONFIGURE=	yes
X
XPLIST_FILES=	bin/slocate
X
X#
X# mkdir /var/db/slocate
X# pw group add slocate
X# slocate -u
X#
X
X.include <bsd.port.mk>
END-of-slocate/Makefile
echo x - slocate/distinfo
sed 's/^X//' >slocate/distinfo << 'END-of-slocate/distinfo'
XMD5 (slocate-2.7.tar.gz) = 4872830642ea2ed5f9aff932720583c9
XSHA256 (slocate-2.7.tar.gz) = ddff733fcc5f240d40361c5acbce0011b2204efc506efb0da63c8d0e38947dcf
XSIZE (slocate-2.7.tar.gz) = 87240
END-of-slocate/distinfo
echo c - slocate/files
mkdir -p slocate/files > /dev/null 2>&1
echo x - slocate/files/patch-main.c
sed 's/^X//' >slocate/files/patch-main.c << 'END-of-slocate/files/patch-main.c'
X--- main.c.orig	Fri Apr 13 22:01:37 2007
X+++ main.c	Fri Apr 13 22:07:18 2007
X@@ -540,53 +540,6 @@
X }
X 
X 
X-#ifdef __FreeBSD__
X-/* Get File System type in the form of a string. "*fstype*" */
X-
X-char *
X-    get_fs_type(int fs_type)
X-{
X-	if (fs_type == MOUNT_UFS)
X-	    return("*UFS*");
X-	else if (fs_type == MOUNT_NFS)
X-	    return("*NFS*");
X-	else if (fs_type == MOUNT_MFS)
X-	    return("*MFS*");
X-	else if (fs_type == MOUNT_MSDOS)
X-	    return("*MSDOS*");
X-	else if (fs_type == MOUNT_LFS)
X-	    return("*LFS*");
X-	else if (fs_type == MOUNT_LOFS)
X-	    return("*LOFS*");   
X-	else if (fs_type == MOUNT_FDESC)
X-	    return("*FDESC*");
X-	else if (fs_type == MOUNT_PORTAL)
X-	    return("*PORTAL*");
X-	else if (fs_type == MOUNT_NULL)
X-	    return("*NULL*");
X-	else if (fs_type == MOUNT_UMAP)
X-	    return("*UMAP*");
X-	else if (fs_type == MOUNT_KERNFS)
X-	    return("*KERNFS*");
X-	else if (fs_type == MOUNT_PROCFS)
X-	    return("*PROCFS*");
X-	else if (fs_type == MOUNT_AFS)
X-	    return("*AFS*");
X-	else if (fs_type == MOUNT_CD9660)
X-	    return("*CD9660*");
X-	else if (fs_type == MOUNT_UNION)
X-	    return("*UNION*");
X-	else if (fs_type == MOUNT_DEVFS)
X-	    return("*DEVFS*");
X-	else if (fs_type == MOUNT_EXT2FS)
X-	    return("*EXT2FS*");
X-	else if (fs_type == MOUNT_TFS)
X-	    return("*TFS*");
X-	else
X-	    return("*NONE*");
X-}
X-#endif
X-
X /* Parse File System Type Exclusion */
X int
X     parse_fs_exclude(char *estr)
X@@ -637,7 +590,7 @@
X 		num_mounts = getfsstat(fs_stat,bufsize,MNT_WAIT);
X 		
X 		for (i = 0; i < num_mounts; i+=1) {
X-			if (strstr(estr,get_fs_type(fs_stat[i].f_type))) {
X+			if (strstr(estr,fs_stat[i].f_fstypename)) {
X 				if (!exclude_str) {
X 					exclude_str = malloc(strlen(fs_stat[i].f_mntonname)+1);
X 					if (!exclude_str)
END-of-slocate/files/patch-main.c
exit


Edwin
-- 
Edwin Groothuis      |            Personal website: http://www.mavetju.org
edwin@mavetju.org    |              Weblog: http://www.mavetju.org/weblog/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070413121642.GB1028>