Blame Artworks/Webenv/Themes/Default/Mailman/local-install.sh

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