summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author B. Watson <yalhcru@gmail.com>2022-01-10 23:24:58 -0500
committer Willy Sudiarto Raharjo <willysr@slackbuilds.org>2022-01-17 09:03:28 +0700
commit0b407b380e0493113184997e804dd33bb5d162a6 (patch)
tree3a3305e5c0eb25e86d3bd947597541495639a4a3
parentdc52d121921a79e9fae20f586c820a1fd8dd14a5 (diff)
downloadslackbuilds-0b407b380e0493113184997e804dd33bb5d162a6.tar.gz
slackbuilds-0b407b380e0493113184997e804dd33bb5d162a6.tar.xz
system/plocate: Added (a much faster locate).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r--system/plocate/README12
-rw-r--r--system/plocate/cron.sh4
-rw-r--r--system/plocate/doinst.sh25
-rw-r--r--system/plocate/plocate.SlackBuild111
-rw-r--r--system/plocate/plocate.info10
-rw-r--r--system/plocate/slack-desc19
-rw-r--r--system/plocate/updatedb.conf4
7 files changed, 185 insertions, 0 deletions
diff --git a/system/plocate/README b/system/plocate/README
new file mode 100644
index 0000000000..632d1975dc
--- /dev/null
+++ b/system/plocate/README
@@ -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).
diff --git a/system/plocate/cron.sh b/system/plocate/cron.sh
new file mode 100644
index 0000000000..9897c60ea3
--- /dev/null
+++ b/system/plocate/cron.sh
@@ -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"
diff --git a/system/plocate/doinst.sh b/system/plocate/doinst.sh
new file mode 100644
index 0000000000..1ef6f52f26
--- /dev/null
+++ b/system/plocate/doinst.sh
@@ -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
diff --git a/system/plocate/plocate.SlackBuild b/system/plocate/plocate.SlackBuild
new file mode 100644
index 0000000000..971e28e115
--- /dev/null
+++ b/system/plocate/plocate.SlackBuild
@@ -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
diff --git a/system/plocate/plocate.info b/system/plocate/plocate.info
new file mode 100644
index 0000000000..c5468c2c91
--- /dev/null
+++ b/system/plocate/plocate.info
@@ -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"
diff --git a/system/plocate/slack-desc b/system/plocate/slack-desc
new file mode 100644
index 0000000000..ce5ef09e4e
--- /dev/null
+++ b/system/plocate/slack-desc
@@ -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:
diff --git a/system/plocate/updatedb.conf b/system/plocate/updatedb.conf
new file mode 100644
index 0000000000..542cd7c679
--- /dev/null
+++ b/system/plocate/updatedb.conf
@@ -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"