#!/bin/sh DATADIR=/srv/data/etc mkdir -p "$DATADIR" chown atheme:atheme -R "$DATADIR" if [ ! -e $DATADIR/atheme.conf ]; then echo "Configuration file not found. Generating it..." cp /srv/atheme/etc/atheme.conf.example $DATADIR/atheme.conf fi if ! test -w "$DATADIR/"; then echo "ERROR: $DATADIR must be mounted to a directory writable by UID $ATHEME_UID" exit 1 fi DBPATH="$DATADIR/services.db" if test -f "$DBPATH" && ! test -r "$DBPATH"; then echo "ERROR: $DBPATH must be readable by UID $ATHEME_UID" exit 1 fi TMPPATH="$DATADIR/services.db.new" if test -f "$TMPPATH" && ! test -w "$TMPPATH"; then echo "ERROR: $TMPPATH must either not exist or be writable by UID $ATHEME_UID" exit 1 fi rm -f /srv/atheme/var/atheme.pid su atheme -c "/srv/atheme/bin/atheme-services \ -c $DATADIR/atheme.conf \ -n"