Blame Identity/Webenv/Mailman/svn-install.sh

4c79b5
#!/bin/bash
4c79b5
# Install Mailman customization using a remote svn installation source 
4c79b5
4c79b5
DOINSTALL=N
4c79b5
SVNDIR=http://centos.org/svn/artwork/trunk/Extras/Mailman/
4c79b5
EXPORTDIR=Exported_files
4c79b5
4c79b5
echo 'Looking for available customizations ...'
4c79b5
select MM_VALIDVERSION in `svn list $SVNDIR | sed 's!/$!!' | grep -v install.sh`;do
4c79b5
	break;
4c79b5
done
4c79b5
4c79b5
# Check mailman package from available repository
4c79b5
function check_mailman_yuminstall {
4c79b5
	# This customization was built for
4c79b5
	# mailman-2.1.9-4.el5 and only tested on it. It may not work in other
4c79b5
	# version. If other version is found show a warning message about this
4c79b5
	# issue and let the user decide what to do.
4c79b5
	MM_VERSION=`yum info mailman | egrep '^Version: ' | cut -f2 -d' '`
4c79b5
	MM_RELEASE=`yum info mailman | egrep '^Release: ' | cut -f2 -d' '`
4c79b5
	MM_REPOSIT=`yum info mailman | egrep '^Repo   : ' | sed	-r 's/^Repo   : //'`
4c79b5
	MM_VERSREL="$MM_VERSION-$MM_RELEASE"
4c79b5
	if [ $MM_VERSREL == $MM_VALIDVERSION ];then
4c79b5
		return 0
4c79b5
	else
4c79b5
		echo "   Package found : mailman-$MM_VERSREL"
4c79b5
		echo "   Repository    : $MM_REPOSIT"
4c79b5
  		echo "   ****************************************************"
4c79b5
		echo "   WARNING!: You are trying to apply"
4c79b5
		echo "             mailman-$MM_VALIDVERSION customization to"
4c79b5
		echo "             mailman-$MM_VERSREL and that may not work!"
4c79b5
  		echo "   ****************************************************"
4c79b5
		printf "   Do you want to apply it anyway ? [y/N]: "
4c79b5
		read DOINSTALL
4c79b5
4c79b5
		if [ "$DOINSTALL" == 'y' ];then
4c79b5
			return 0
4c79b5
		else
4c79b5
			exit 1;
4c79b5
		fi
4c79b5
	fi
4c79b5
}
4c79b5
4c79b5
# Apply customization
4c79b5
function install_mailman_customization {
4c79b5
	echo 'Downloading customization ...'
4c79b5
  	svn export ${SVNDIR}${MM_VALIDVERSION} $EXPORTDIR --quiet --force
4c79b5
	echo 'Applying customization ...'
4c79b5
	/bin/cp -r $EXPORTDIR/Mailman/* /usr/lib/mailman/Mailman/
4c79b5
	/bin/cp -r $EXPORTDIR/messages/* /usr/lib/mailman/messages/
4c79b5
	/bin/cp -r $EXPORTDIR/templates/* /usr/lib/mailman/templates/
4c79b5
	/bin/cp $EXPORTDIR/mailman.conf /etc/httpd/conf.d/
4c79b5
	rm -r $EXPORTDIR
4c79b5
}
4c79b5
4c79b5
# Verify mailman local installation 
4c79b5
function check_mailman_localinstall {
4c79b5
	echo "Looking for local installation ..."
4c79b5
	# Is mailman already installed ?
4c79b5
	rpm -q mailman-$MM_VALIDVERSION > /dev/null
4c79b5
4c79b5
	if [ $? == 0 ]; then
4c79b5
		# Package is already installed ... jump to customization
4c79b5
		install_mailman_customization
4c79b5
		# and exit;
4c79b5
		exit 0;
4c79b5
	else
4c79b5
		echo   "   mailman-$MM_VALIDVERSION is not installed."
4c79b5
		printf '   Do you want to install it now ? [y/N]: '
4c79b5
		read DOINSTALL
4c79b5
	
4c79b5
		if [ "$DOINSTALL" == 'y' ];then
4c79b5
			return 0
4c79b5
		else
4c79b5
			exit 1
4c79b5
		fi
4c79b5
	fi
4c79b5
}
4c79b5
4c79b5
4c79b5
# Install mailman package from available repository
4c79b5
function install_mailman {
4c79b5
	check_mailman_yuminstall
4c79b5
	yum -y install mailman
4c79b5
	install_mailman_customization
4c79b5
}
4c79b5
4c79b5
check_mailman_localinstall
4c79b5
install_mailman
4c79b5
4c79b5
4c79b5
# After this you need to configure your mailman:
4c79b5
# (Take a look to: /usr/share/doc/mailman-2.1.9/INSTALL.REDHAT)
4c79b5
#
4c79b5
# 1. Create your site password:
4c79b5
#
4c79b5
#	/usr/lib/mailman/bin/mmsitepass
4c79b5
#
4c79b5
# 2. Define the first mailing list. 
4c79b5
#
4c79b5
#	/usr/lib/mailman/bin/newsite mailman@domain.tld
4c79b5
#
4c79b5
# 3. Restart the Apache web server
4c79b5
#
4c79b5
#	/sbin/service httpd restart
4c79b5
#
4c79b5
# 4. Start mailman daemon
4c79b5
#
4c79b5
# 	/sbin/service mailman start
4c79b5
#
4c79b5
#
4c79b5
# ... and thats all folks! :)