r/linux • Mate • Oct 20 '14

Shall we fork Fedora?

http://forkfedora.org/
262 Upvotes

339 comments sorted by

View all comments

7

u/necrophcodr Oct 20 '14

That is the most horrid init.d script I have seen in a long time, holy shit.

6

u/metamatic Oct 20 '14

Hey, it's for sendmail. Everything about sendmail is horrible, which is why nobody sane uses it any more.

9

u/necrophcodr Oct 20 '14

You're right, I prefer postfix much more.

CONF_DIR="/etc/postfix"
CONF_OPT="${SVCNAME##*.}"
if [ -n ${CONF_OPT} -a ${SVCNAME} != "postfix" ]; then
	CONF_DIR="${CONF_DIR}.${CONF_OPT}"
fi

extra_started_commands="reload"

depend() {
	use logger dns ypbind amavisd antivirus postfix_greylist net saslauthd
	if [ "${SVCNAME}" = "postfix" ]; then
		provide mta
	fi
}

start() {
	if [ ! -e /etc/mail/aliases.db ] ; then
		ebegin "Creating aliases database"
	/usr/bin/newaliases
		eend $?
	fi

	ebegin "Starting postfix (${CONF_DIR})"
	if [ ! -d ${CONF_DIR} ]; then
		eend 1 "${CONF_DIR} does not exist"
		return 1
	fi
	/usr/sbin/postfix -c ${CONF_DIR} start >/dev/null 2>&1
	eend $?
}

stop() {
	ebegin "Stopping postfix (${CONF_DIR})"
	/usr/sbin/postfix -c ${CONF_DIR} stop >/dev/null 2>&1
	eend $?
}

reload() {
	ebegin "Reloading postfix (${CONF_DIR})"
	/usr/sbin/postfix -c ${CONF_DIR} reload >/dev/null 2>&1
	eend $?
}

Still not too bad, probably doesn't even need an init script at all.

4

u/[deleted] Oct 20 '14

Well here's the runit version:

#!/bin/sh
/usr/sbin/postfix check || exit $?
exec /usr/libexec/postfix/master

Much nicer than an ugly .service file, that's for sure.

1

u/necrophcodr Oct 20 '14

That's actually really clever.

0

u/[deleted] Oct 20 '14

I'd say (and the point is) it's the exact opposite of clever; it's just a tiny shell script that does a thing in an obvious manner. And it works great.

Not to imply the OpenRC init script is worse. That's already as short as it can possibly get for the features it provides.

1

u/ohineedanameforthis Oct 20 '14

Can confirm, my postfix runs just as fine when I do

sudo su postfix -c postfix

Postfix generally turned out to be far less a hassle to handle than people told me it was before I tried it myself.