diff options
author | B. Watson <yalhcru@gmail.com> | 2019-12-28 08:55:52 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2019-12-28 08:55:52 +0700 |
commit | 18ce54101fcedd1b595c1fcc53860a31e8f5c463 (patch) | |
tree | 3eb1db296fcdc5214e209c9756c4b196cdcd0f83 | |
parent | c3aed3486866289068e8b4c88c862b3a6deb8f24 (diff) | |
download | slackbuilds-18ce54101fcedd1b595c1fcc53860a31e8f5c463.tar.gz |
system/mlocate: Added (locate/updatedb implementation).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r-- | system/mlocate/README | 31 | ||||
-rw-r--r-- | system/mlocate/doinst.sh | 24 | ||||
-rw-r--r-- | system/mlocate/mlocate-run-updatedb | 4 | ||||
-rw-r--r-- | system/mlocate/mlocate.SlackBuild | 120 | ||||
-rw-r--r-- | system/mlocate/mlocate.cron | 2 | ||||
-rw-r--r-- | system/mlocate/mlocate.info | 10 | ||||
-rw-r--r-- | system/mlocate/slack-desc | 19 | ||||
-rw-r--r-- | system/mlocate/updatedb.conf.new | 4 |
8 files changed, 214 insertions, 0 deletions
diff --git a/system/mlocate/README b/system/mlocate/README new file mode 100644 index 0000000000..f2029ce76a --- /dev/null +++ b/system/mlocate/README @@ -0,0 +1,31 @@ +mlocate (locate/updatedb implementation) + +mlocate is a locate/updatedb implementation. It keeps a database of all +existing files and allows you to lookup files by name. The 'm' stands for +"merging": updatedb reuses the existing database to avoid rereading most +of the file system, which makes updatedb faster and does not trash the +system caches as much as traditional locate implementations. + +This is the same "locate" that's in Slackware-current (and eventually 15.0). + +This conflicts with Slackware 14.2's slocate package! Before installing +this, add slocate to /etc/slackpkg/blacklist and then: + + # removepkg slocate + +It's also recommended to: + + # rm -rf /var/lib/slocate /etc/updatedb.conf + +The locate database will be created daily, as a cron job. If you don't +want to wait, you can create it manually: + + # /etc/cron.daily/mlocate + +If you want to revert to Slackware's slocate, remove slocate from +/etc/slackpkg/blacklist, then: + + # removepkg mlocate + # rm -rf /var/lib/mlocate /etc/updatedb.conf + # slackpkg update + # slackpkg install slocate diff --git a/system/mlocate/doinst.sh b/system/mlocate/doinst.sh new file mode 100644 index 0000000000..8afb2a4fff --- /dev/null +++ b/system/mlocate/doinst.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +# doinst.sh copied from Pat's, got rid of the stuff that creates the +# slocate group. + +config() { + NEW="$1" + OLD="`dirname $NEW`/`basename $NEW .new`" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} +config etc/updatedb.conf.new + +if [ ! -r var/lib/mlocate/mlocate.db ]; then + touch var/lib/mlocate/mlocate.db + chown root:slocate var/lib/mlocate/mlocate.db + chmod 640 var/lib/mlocate/mlocate.db +fi + diff --git a/system/mlocate/mlocate-run-updatedb b/system/mlocate/mlocate-run-updatedb new file mode 100644 index 0000000000..7d3f2ac526 --- /dev/null +++ b/system/mlocate/mlocate-run-updatedb @@ -0,0 +1,4 @@ +#!/bin/sh + +nodevs=$(< /proc/filesystems awk '$1 == "nodev" && $2 != "rootfs" && $2 != "zfs" { print $2 }') +/usr/bin/updatedb -f "$nodevs" diff --git a/system/mlocate/mlocate.SlackBuild b/system/mlocate/mlocate.SlackBuild new file mode 100644 index 0000000000..9f213fbb54 --- /dev/null +++ b/system/mlocate/mlocate.SlackBuild @@ -0,0 +1,120 @@ +#!/bin/sh + +# Slackware build script for mlocate + +# Written by B. Watson (yalhcru@gmail.com) + +# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. + +# Notes: +# - This is intended to be 100% compatible with the mlocate in -current. +# - mlocate and slocate can't read each others' database formats. Bummer. +# - DOWNLOAD is upstream's site, but the file is identical to the one +# from Pat's source/ dir. I used upstream so the file won't disappear if +# Pat upgrades or changes his mind. +# - mlocate on -current uses the slocate group (there's no mlocate group), +# so I do the same here. +# - mlocate's database is about 40% larger than slocate's, on my build box. +# Not a real concern unless you're building a tiny embedded system. + +PRGNAM=mlocate +VERSION=${VERSION:-0.26} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +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.xz +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 {} \+ + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --sysconfdir=/etc \ + --localstatedir=/var/lib \ + --mandir=/usr/man \ + --docdir=/usr/doc/$PRGNAM-$VERSION \ + --build=$ARCH-slackware-linux + +make groupname=slocate +make install-strip DESTDIR=$PKG + +gzip $PKG/usr/man/man?/*.? + +# This stuff comes straight from Pat's mlocate.SlackBuild: +mkdir -p $PKG/etc +cp -a $CWD/updatedb.conf.new $PKG/etc/updatedb.conf.new +chown root:root $PKG/etc/updatedb.conf.new +chmod 644 $PKG/etc/updatedb.conf.new + +mv $PKG/usr/bin/locate $PKG/usr/bin/mlocate +( cd $PKG/usr/bin ; ln -sf mlocate locate ) + +( cd $PKG/usr/man/man1 + ln -sf locate.1 mlocate.1 +) + +mkdir -p $PKG/usr/libexec +cp -a $CWD/mlocate-run-updatedb $PKG/usr/libexec/mlocate-run-updatedb +chown root:root $PKG/usr/libexec/mlocate-run-updatedb +chmod 755 $PKG/usr/libexec/mlocate-run-updatedb + +mkdir -p $PKG/etc/cron.daily +cp -a $CWD/mlocate.cron $PKG/etc/cron.daily/mlocate +chown root:root $PKG/etc/cron.daily/mlocate +chmod 755 $PKG/etc/cron.daily/mlocate + +chown root:slocate $PKG/usr/bin/mlocate +chmod 2711 $PKG/usr/bin/mlocate +mkdir -p $PKG/var/lib/mlocate +chown root:slocate $PKG/var/lib/mlocate +chmod 750 $PKG/var/lib/mlocate +# End of Pat's stuff. + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a AUTHORS COPYING* ChangeLog 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:-tgz} diff --git a/system/mlocate/mlocate.cron b/system/mlocate/mlocate.cron new file mode 100644 index 0000000000..5464abad35 --- /dev/null +++ b/system/mlocate/mlocate.cron @@ -0,0 +1,2 @@ +#!/bin/sh +ionice -c3 nice -n 19 /usr/libexec/mlocate-run-updatedb diff --git a/system/mlocate/mlocate.info b/system/mlocate/mlocate.info new file mode 100644 index 0000000000..b9eb39f232 --- /dev/null +++ b/system/mlocate/mlocate.info @@ -0,0 +1,10 @@ +PRGNAM="mlocate" +VERSION="0.26" +HOMEPAGE="https://pagure.io/mlocate/releases" +DOWNLOAD="https://releases.pagure.org/mlocate/mlocate-0.26.tar.xz" +MD5SUM="539e6f86bf387358aa2b14d5f880e49a" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="%README%" +MAINTAINER="B. Watson" +EMAIL="yalhcru@gmail.com" diff --git a/system/mlocate/slack-desc b/system/mlocate/slack-desc new file mode 100644 index 0000000000..e28d270792 --- /dev/null +++ b/system/mlocate/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------------------------------------------------------| +mlocate: mlocate (locate/updatedb implementation) +mlocate: +mlocate: mlocate is a locate/updatedb implementation. It keeps a database +mlocate: of all existing files and allows you to lookup files by name. The +mlocate: 'm' stands for "merging": updatedb reuses the existing database +mlocate: to avoid rereading most of the file system, which makes updatedb +mlocate: faster and does not trash the system caches as much as traditional +mlocate: locate implementations. +mlocate: +mlocate: This conflicts with Slackware 14.2's slocate package. See README +mlocate: for details. diff --git a/system/mlocate/updatedb.conf.new b/system/mlocate/updatedb.conf.new new file mode 100644 index 0000000000..542cd7c679 --- /dev/null +++ b/system/mlocate/updatedb.conf.new @@ -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" |