system/plocate: Added (a much faster locate).

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2022-01-10 23:24:58 -05:00 committed by Willy Sudiarto Raharjo
parent dc52d12192
commit 0b407b380e
No known key found for this signature in database
GPG Key ID: 3F617144D7238786
7 changed files with 185 additions and 0 deletions

12
system/plocate/README Normal file
View File

@ -0,0 +1,12 @@
plocate (a much faster locate)
plocate is a locate based on posting lists. Compared to mlocate,
it is much faster, and its index is much smaller. updatedb speed is
similar (or you can convert mlocate's index to plocate format using
plocate-build). It supports most mlocate options; see --help or the
man page for more information.
This replaces Slackware's mlocate. Technically, there's no conflict,
but it's redundant to have both plocate and mlocate installed, so you
should 'removepkg mlocate' before installing this (and add mlocate to
/etc/slackpkg/blacklist).

4
system/plocate/cron.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/sh
nodevs=$(< /proc/filesystems awk '$1 == "nodev" && $2 != "rootfs" && $2 != "zfs" { print $2 }')
ionice -c3 nice -n 19 /usr/sbin/plocate-updatedb -f "$nodevs"

25
system/plocate/doinst.sh Normal file
View File

@ -0,0 +1,25 @@
config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
rm $NEW
fi
}
config etc/updatedb.conf.new
# If there's no locate link, take over:
if [ ! -r usr/bin/locate ]; then
( cd usr/bin ; ln -sf plocate locate )
fi
# same for these man pages
if [ ! -r usr/man/man5/updatedb.conf.5.gz ]; then
( cd usr/man/man5 ; ln -sf plocate-updatedb.conf.5.gz updatedb.conf.5.gz )
fi
if [ ! -r usr/man/man1/locate.1.gz ]; then
( cd usr/man/man1 ; ln -sf plocate.1.gz locate.1.gz )
fi

View File

@ -0,0 +1,111 @@
#!/bin/bash
# Slackware build script for plocate
# Written by B. Watson (yalhcru@gmail.com)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=plocate
VERSION=${VERSION:-1.1.13}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
# doubleplusungood ref systemd.
sed -i.bak '/systemd\.timer/s,.*,.BR crond (8)\njob,' updatedb.8.in
mkdir build
cd build
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
meson .. \
--buildtype=release \
--infodir=/usr/info \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--localstatedir=/var \
--mandir=/usr/man \
--prefix=/usr \
--sysconfdir=/etc \
-Dstrip=true \
-Dlocategroup=slocate \
-Dupdatedb_progname=$PRGNAM-updatedb
"${NINJA:=ninja}"
DESTDIR=$PKG $NINJA install
cd ..
gzip -9 $PKG/usr/man/man*/*.*
mv $PKG/usr/man/man5/updatedb.conf.5.gz $PKG/usr/man/man5/$PRGNAM-updatedb.conf.5.gz
# change the permissions to match Slackware's mlocate.
chown root:slocate $PKG/var/lib/$PRGNAM
chmod 750 $PKG/var/lib/$PRGNAM
chmod 2711 $PKG/usr/bin/$PRGNAM
# do not install upstream's cron script. it doesn't actually run plocate's
# updatedb; it converts mlocate's database into plocate format, meaning
# mlocate would still have to be installed and be run from cron. upstream
# expects plocate's updatedb to be run from systemd, which we scorn, so
# include our own cron script.
mkdir -p $PKG/etc/cron.daily
install -oroot -groot -m0755 $CWD/cron.sh $PKG/etc/cron.daily/$PRGNAM
# this updatedb.conf is identical to the one in Slackware's mlocate.
install -oroot -groot -m0755 $CWD/updatedb.conf $PKG/etc/updatedb.conf.new
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a COPYING NEWS README $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE

View File

@ -0,0 +1,10 @@
PRGNAM="plocate"
VERSION="1.1.13"
HOMEPAGE="https://plocate.sesse.net/"
DOWNLOAD="https://plocate.sesse.net/download/plocate-1.1.13.tar.gz"
MD5SUM="19e38a086bedd90059743176120c759c"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
MAINTAINER="B. Watson"
EMAIL="yalhcru@gmail.com"

19
system/plocate/slack-desc Normal file
View File

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
plocate: plocate (a much faster locate)
plocate:
plocate: plocate is a locate based on posting lists. Compared to mlocate,
plocate: it is much faster, and its index is much smaller. updatedb speed is
plocate: similar (or you can convert mlocate's index to plocate format using
plocate: plocate-build). It supports most mlocate options; see --help or the
plocate: man page for more information.
plocate:
plocate:
plocate:
plocate:

View File

@ -0,0 +1,4 @@
PRUNE_BIND_MOUNTS = "yes"
PRUNEFS = "9p afs anon_inodefs auto autofs bdev binfmt_misc cgroup cifs coda configfs cpuset debugfs devpts ecryptfs exofs fuse fuse.sshfs fusectl gfs gfs2 gpfs hugetlbfs inotifyfs iso9660 jffs2 lustre mqueue ncpfs nfs nfs4 nfsd pipefs proc ramfs rootfs rpc_pipefs securityfs selinuxfs sfs sockfs sysfs tmpfs ubifs udf usbfs ceph fuse.ceph"
PRUNENAMES = ".git .hg .svn .bzr .arch-ids {arch} CVS"
PRUNEPATHS = "/afs /dev /media /mnt /net /proc /sys /tmp /usr/tmp /var/cache/ccache /var/lib/ceph /var/spool/cups /var/tmp"