#!/bin/sh

mcaparamsfile=/etc/openmpi/openmpi-mca-params.conf

. alterator-sh-functions
. shell-config


on_message()
{
	case "$in_action" in
		list)
			echo '('
			mpi-selector --list|
			    sed 's,.*,("&"),'
			echo ')'
			;;
		write)
			[ -n "$in_type" ] && 
			    mpi-selector --set "$in_type" --system --yes
			#special tuning for openmpi
			[ -s "$mcaparamsfile" ] &&
			    shell_config_set "$mcaparamsfile" \
					     "btl" "openib,self" \
					     "[[:space:]]*=[[:space:]]*" "="
			write_nop
			;;
		*)
			echo '#f'
			;;
	esac
}

message_loop
