Browse Source

n/dovecot: Added startup script.

slackware-14.2
Damien Goutte-Gattat 12 years ago
parent
commit
0a2ec43d34
  1. 20
      n/dovecot/doinst.sh
  2. 13
      n/dovecot/dovecot.SlackBuild
  3. 54
      n/dovecot/rc.dovecot

20
n/dovecot/doinst.sh

@ -0,0 +1,20 @@
#!/bin/sh
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/dovecot.conf.new
if ! grep ^dovecot /etc/group > /dev/null ; then
/usr/sbin/groupadd dovecot
fi
if ! grep ^dovecot /etc/passwd > /dev/null ; then
/usr/sbin/useradd -C Dovecot -d /var/run/dovecot -g dovecot dovecot
fi

13
n/dovecot/dovecot.SlackBuild

@ -32,7 +32,7 @@ WGET=${WGET:-http://www.dovecot.org/releases/1.1/$ARCHIVE}
# Built package infos
NAMETGZ=${NAMETGZ:-dovecot}
BUILD=${BUILD:-1GGD}
BUILD=${BUILD:-2GGD}
ARCH=${ARCH:-i486}
TARGET=${TARGET:-i486}
@ -80,6 +80,8 @@ CFLAGS=$CPUOPT \
CXXFLAGS=$CPUOPT \
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--docdir=/usr/doc/$NAME \
--disable-static \
--disable-ipv6 \
@ -92,15 +94,18 @@ CXXFLAGS=$CPUOPT \
--without-deliver
make -j 3
make install DESTDIR=$PKG
mv $PKG/usr/etc/dovecot-*example.conf $PKG/usr/doc/$NAME
rm -rf $PKG/usr/{include,etc}
mv $PKG/etc/dovecot-{ldap,sql,db}-example.conf $PKG/usr/doc/$NAME
mv $PKG/etc/dovecot-example.conf $PKG/etc/dovecot.conf.new
rm -rf $PKG/usr/include
# Strip binaries
find $PKG | xargs file | grep "ELF 32-bit LSB" | cut -d : -f 1 | \
xargs strip --strip-unneeded 2> /dev/null
# Copy slack-desc file
# Copy auxiliary files
install -D -m 644 $CWD/rc.dovecot $PKG/etc/rc.d/rc.dovecot
install -D -m 644 $CWD/slack-desc $PKG/install/slack-desc
install -m 755 $CWD/doinst.sh $PKG/install/doinst.sh
# Package the tree
cd $PKG

54
n/dovecot/rc.dovecot

@ -0,0 +1,54 @@
#!/bin/sh
PIDFILE=/var/run/dovecot/master.pid
dovecot_start() {
/usr/sbin/dovecot
}
dovecot_stop() {
kill `cat $PIDFILE`
}
dovecot_restart() {
dovecot_stop
sleep 2
dovecot_start
}
dovecot_status() {
[ -f $PIDFILE ] && kill -0 `cat $PIDFILE` && echo "Dovecot running"
}
dovecot_reload() {
[ -f $PIDFILE ] && kill -HUP `cat $PIDFILE`
}
case "$1" in
start)
dovecot_start
;;
stop)
dovecot_stop
;;
restart)
dovecot_restart
;;
status)
dovecot_status
;;
reload)
dovecot_reload
;;
*)
echo "Usage: /etc/rc.d/rc.dovecot {start|stop|restart|status|reload}"
exit 1
;;
esac
exit 0
Loading…
Cancel
Save