From f8ac5d4703080cc87ba2fe36f68df745d3a5f62f Mon Sep 17 00:00:00 2001 From: root Date: Sat, 4 Aug 2012 00:02:16 +0000 Subject: Sat Aug 4 00:02:16 UTC 2012 --- community/preload/PKGBUILD | 13 ++++--- community/preload/rc.d | 97 ++++++++++++++++++++++++++++++++++++++++++++++ community/preload/service | 11 ++++++ 3 files changed, 116 insertions(+), 5 deletions(-) create mode 100644 community/preload/rc.d create mode 100644 community/preload/service (limited to 'community/preload') diff --git a/community/preload/PKGBUILD b/community/preload/PKGBUILD index c24bb52a2..736800b65 100644 --- a/community/preload/PKGBUILD +++ b/community/preload/PKGBUILD @@ -1,11 +1,11 @@ -# $Id: PKGBUILD 64901 2012-02-18 20:00:16Z bpiotrowski $ +# $Id: PKGBUILD 74711 2012-08-02 09:27:00Z bpiotrowski $ # Maintainer: # Contributor: Jaroslaw Swierczynski # Contributor: William Rea pkgname=preload pkgver=0.6.4 -pkgrel=4 +pkgrel=5 arch=('i686' 'x86_64') pkgdesc="Makes applications run faster by prefetching binaries and shared objects" url="http://sourceforge.net/projects/preload" @@ -16,9 +16,10 @@ backup=('etc/preload.conf') options=('!makeflags') install=$pkgname.install source=("http://downloads.sourceforge.net/sourceforge/preload/$pkgname-$pkgver.tar.gz" - rc.preload) + rc.d service) md5sums=('10786287b55afd3a2b433b4f898809f4' - 'bde0dd7867c77e7c4d10b481b5cddcd3') + 'bde0dd7867c77e7c4d10b481b5cddcd3' + 'db9350ab52fd643edbc88ebab2c8c1bb') build() { cd "${srcdir}"/$pkgname-$pkgver @@ -33,7 +34,9 @@ package() { cd "${srcdir}"/$pkgname-$pkgver make DESTDIR="${pkgdir}" install - install -D -m755 "${srcdir}"/rc.preload "${pkgdir}"/etc/rc.d/preload + install -Dm755 "${srcdir}"/rc.d "${pkgdir}"/etc/rc.d/preload + install -Dm644 "${srcdir}"/service "${pkgdir}"/usr/lib/systemd/system/preload.service + rm -rf "${pkgdir}"/etc/rc.d/init.d rm -rf "${pkgdir}"/var/lib/preload/preload.state diff --git a/community/preload/rc.d b/community/preload/rc.d new file mode 100644 index 000000000..a3cb01ba0 --- /dev/null +++ b/community/preload/rc.d @@ -0,0 +1,97 @@ +#!/bin/bash +# +# /etc/rc.d/init.d/preload +# +# Starts the preload daemon +# +# Heavily modified for Arch Linux by Leslie P. Polzer . + +. /etc/rc.conf +. /etc/rc.d/functions + +PID=`pidof -o %PPID /usr/sbin/preload` + +if [ -f /etc/conf.d/preload ]; then + . /etc/conf.d/preload +fi + +MIN_MEMORY=${MIN_MEMORY:-256} +# Check for > MIN_MEMORY MB +free -m | awk '/Mem:/ {exit ($2 >= ('"$MIN_MEMORY"'))?0:1}' || exit 0 + +RETVAL=0 + +# +# See how we were called. +# + +start() { + if [ -z "$PID" ]; then + stat_busy "Starting preload daemon: " + /usr/sbin/preload $PRELOAD_OPTS + RETVAL=$? + if [ $RETVAL -eq 0 ]; then + if [ -n $IONICE_OPTS ]; then + /usr/bin/ionice $IONICE_OPTS -p "`pidof -o %PPID /usr/sbin/preload`" + fi + add_daemon preload + stat_done + else + stat_fail + fi + fi + return $RETVAL +} + +stop() { + stat_busy "Stopping preload daemon: " + kill $PID &>/dev/null + RETVAL=$? + if [ $RETVAL -eq 0 ]; then + rm_daemon preload + stat_done + PID="" + else + stat_fail + fi + return $RETVAL +} + + +restart() { + $0 stop + sleep 1 + $0 start +} + +reload() { + trap "" SIGHUP + kill -HUP $PID +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + reload) + reload + ;; + restart) + restart + ;; + condrestart) + if [ ! -z $PID ]; then + restart + else + stat_fail + fi + ;; + *) + echo "Usage: $0 {start|stop|restart|condrestart|reload}" + exit 1 +esac + +exit $RETVAL diff --git a/community/preload/service b/community/preload/service new file mode 100644 index 000000000..e4202751f --- /dev/null +++ b/community/preload/service @@ -0,0 +1,11 @@ +[Unit] +Description=Adaptive readahead daemon + +[Service] +Type=simple +IOSchedulingClass=3 +EnvironmentFile=/etc/conf.d/preload +ExecStart=/usr/sbin/preload --foreground $PRELOAD_OPTS + +[Install] +WantedBy=multi-user.target -- cgit v1.2.3-54-g00ecf