diff options
author | Robby Workman <rw@rlworkman.net> | 2010-05-11 20:02:06 +0200 |
---|---|---|
committer | David Somero <xgizzmo@slackbuilds.org> | 2010-05-11 20:02:06 +0200 |
commit | 90500bd86f52dcc9d4bbe26e150d647175675f81 (patch) | |
tree | 9fd3b325533b90aaaeb1c874fc72eab95297b077 /system | |
parent | 96025eb035a7f510c30a01b923d644ae56479bc7 (diff) |
system/preload: Added to 12.0 repository
Diffstat (limited to 'system')
-rw-r--r-- | system/preload/README | 4 | ||||
-rw-r--r-- | system/preload/doinst.sh | 24 | ||||
-rw-r--r-- | system/preload/preload.8 | 58 | ||||
-rw-r--r-- | system/preload/preload.SlackBuild | 95 | ||||
-rw-r--r-- | system/preload/preload.info | 8 | ||||
-rw-r--r-- | system/preload/rc.preload | 62 | ||||
-rw-r--r-- | system/preload/slack-desc | 19 |
7 files changed, 270 insertions, 0 deletions
diff --git a/system/preload/README b/system/preload/README new file mode 100644 index 0000000000000..9cfbb372b5e2a --- /dev/null +++ b/system/preload/README @@ -0,0 +1,4 @@ +Preload is an adaptive readahead daemon. It monitors applications +that users run, and by analyzing this data, predicts what apps +users might run, and fetches those binaries and their dependencies +into memory for faster startup times. diff --git a/system/preload/doinst.sh b/system/preload/doinst.sh new file mode 100644 index 0000000000000..3fe2d3f76797e --- /dev/null +++ b/system/preload/doinst.sh @@ -0,0 +1,24 @@ +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... +} + +# Keep same perms on rc.preload.new: +if [ -e etc/rc.d/rc.preload ]; then + cp -a etc/rc.d/rc.preload etc/rc.d/rc.preload.new.incoming + cat etc/rc.d/rc.preload.new > etc/rc.d/rc.preload.new.incoming + mv etc/rc.d/rc.preload.new.incoming etc/rc.d/rc.preload.new +fi + +config etc/rc.d/rc.preload.new +config etc/preload.conf.new +config etc/logrotate.d/preload.new + diff --git a/system/preload/preload.8 b/system/preload/preload.8 new file mode 100644 index 0000000000000..ef8341861213a --- /dev/null +++ b/system/preload/preload.8 @@ -0,0 +1,58 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.35. +.TH PRELOAD "8" "September 2005" "preload 0.2" "System Administration Utilities" +.SH NAME +preload \- Adaptive readahead daemon +.SH SYNOPSIS +.B preload +[\fIOPTION\fR]... +.SH DESCRIPTION +preload is an adaptive readahead daemon that prefetches files mapped by +applications from the disk to reduce application startup time. +.TP +\fB\-h\fR, \fB\-\-help\fR +Display this information and exit. +.TP +\fB\-v\fR, \fB\-\-version\fR +Display version information and exit. +.TP +\fB\-c\fR, \fB\-\-conffile\fR +Set configuration file. Empty string means no conf file. +(default is /home/behdad/.local/etc/preload.conf) +.TP +\fB\-s\fR, \fB\-\-statefile\fR +Set state file to load/save. Empty string means no state. +(default is /home/behdad/.local/var/preload/preload.state) +.TP +\fB\-l\fR, \fB\-\-logfile\fR +Set log file. Empty string means to log to stderr. +(default is /home/behdad/.local/var/log/preload.log) +.TP +\fB\-f\fR, \fB\-\-foreground\fR +Run in foreground, do not daemonize. +.TP +\fB\-n\fR, \fB\-\-nice\fR +Nice level. +(default is 15) +.TP +\fB\-V\fR, \fB\-\-verbose\fR +Set the verbosity level. Levels 0 to 10 are recognized. +(default is 4) +.TP +\fB\-d\fR, \fB\-\-debug\fR +Debug mode: \fB\-\-logfile\fR '' \fB\-\-foreground\fR \fB\-\-verbose\fR 9 +.SH SIGNALS + +On receipt of a SIGHUP, the daemon will close and reopen its log file, and +reread the configuratoin file. + +On receipt of a SIGUSR1, the daemon dumps the currently loaded configuration +into the log file. + +On receipt of a SIGUSR2, the daemon saves its state into the state file. +.SH AUTHOR +Written by Behdad Esfahbod <behdad@gnu.org> +.SH COPYRIGHT +Copyright \(co 2005 Behdad Esfahbod. +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. diff --git a/system/preload/preload.SlackBuild b/system/preload/preload.SlackBuild new file mode 100644 index 0000000000000..58673bc6794cd --- /dev/null +++ b/system/preload/preload.SlackBuild @@ -0,0 +1,95 @@ +#!/bin/sh + +# Slackware build script for preload + +# Copyright 2008 Robby Workman Northport, Alabama (USA) +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=preload +VERSION=0.4 +ARCH=${ARCH:-i486} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" +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 . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; + +CFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --build=$ARCH-slackware-linux + +make +make install DESTDIR=$PKG + +( cd $PKG + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null +) + +# Let's not clobber things that might already exist +mv $PKG/etc/preload.conf $PKG/etc/preload.conf.new +mv $PKG/etc/logrotate.d/preload $PKG/etc/logrotate.d/preload.new + +# Add an init script (in noclobber mode) +install -m 0755 $CWD/rc.preload $PKG/etc/rc.d/rc.preload.new + +# Kill some things we don't need or can't use +rm -rf $PKG/etc/sysconfig $PKG/etc/rc.d/init.d + +# This requires 'help2man' in order to build a proper man page, so we cheated. +gzip -9c $CWD/preload.8 > $PKG/usr/man/man8/preload.8.gz + +mv $PKG/usr/share/doc $PKG/usr ; rmdir $PKG/usr/share +cp -a AUTHORS COPYING ChangeLog INSTALL NEWS README TODO \ + $PKG/usr/doc/$PRGNAM-$VERSION/$DOC +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.tgz diff --git a/system/preload/preload.info b/system/preload/preload.info new file mode 100644 index 0000000000000..5f385528f4b18 --- /dev/null +++ b/system/preload/preload.info @@ -0,0 +1,8 @@ +PRGNAM="preload" +VERSION="0.4" +HOMEPAGE="http://sourceforge.net/projects/preload" +DOWNLOAD="http://downloads.sourceforge.net/preload/preload-0.4.tar.gz" +MD5SUM="9c98bc97ec261925c9a40e5084c9c149" +MAINTAINER="Robby Workman" +EMAIL="rw@rlworkman.net" +APPROVED="David Somero" diff --git a/system/preload/rc.preload b/system/preload/rc.preload new file mode 100644 index 0000000000000..73f6e0e838df0 --- /dev/null +++ b/system/preload/rc.preload @@ -0,0 +1,62 @@ +#!/bin/sh + +# /etc/rc.d/rc.preload + +# See preload(8) for options +PRELOAD_OPTS="-c /etc/preload.conf -s /var/lib/preload/preload.state -l /var/log/preload.log" + +# You need at least 256 MB of memory for this to be useful +free -m | awk '/Mem:/ {exit ($2 >= ('256'))?0:1}' || exit 1 + +start() { + if [ -x /usr/sbin/preload ]; then + if [ ! -f /var/lock/subsys/preload ]; then + echo "Starting preload daemon: /usr/sbin/preload " + /usr/sbin/preload $PRELOAD_OPTS && \ + touch /var/lock/subsys/preload + else + echo "/usr/sbin/preload is already running. Exiting." + exit 1 + fi + else + echo "/usr/sbin/preload is either not present or not executable." + echo "Exiting." + exit 1 + fi +} + +stop() { + echo "Stopping preload daemon... " + killall -9 preload + rm -f /var/lock/subsys/preload +} + +restart() { + stop + sleep 1 + start +} + +reload() { + trap "" SIGHUP + killall -HUP preload +} + +case "$1" in +start) + start + ;; +stop) + stop + ;; +reload) + reload + ;; +restart) + restart + ;; +*) + echo $"Usage: $0 {start|stop|restart|reload}" + exit 1 +esac + diff --git a/system/preload/slack-desc b/system/preload/slack-desc new file mode 100644 index 0000000000000..6c28f9b073d67 --- /dev/null +++ b/system/preload/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 ':'. + + |-----handy-ruler-----------------------------------------------------| +preload: preload (adaptive readahead daemon) +preload: +preload: preload is an adaptive readahead daemon. It monitors applications +preload: that users run, and by analyzing this data, predicts what apps +preload: users might run, and fetches those binaries and their dependencies +preload: into memory for faster startup times. +preload: +preload: Homepage: http://sourceforge.net/projects/preload +preload: +preload: +preload: |