Blame SOURCES/opensm.launch

2700c3
#!/bin/bash
2700c3
#
2700c3
# Launch the necessary OpenSM daemons for systemd
2700c3
#
2700c3
# sysconfig: /etc/sysconfig/opensm
2700c3
# config: /etc/rdma/opensm.conf
2700c3
#
2700c3
2700c3
shopt -s nullglob
2700c3
2700c3
prog=/usr/sbin/opensm
2700c3
[ -f /etc/sysconfig/opensm ] && . /etc/sysconfig/opensm
2700c3
2700c3
[ -n "$PRIORITY" ] && prio="-p $PRIORITY"
2700c3
2700c3
if [ -z "$GUIDS" ]; then
2700c3
	CONFIGS=""
2700c3
	CONFIG_CNT=0
2700c3
	for conf in /etc/rdma/opensm.conf.[0-9]*; do
2700c3
		CONFIGS="$CONFIGS $conf"
2700c3
		let CONFIG_CNT++
2700c3
	done
2700c3
else
2700c3
	GUID_CNT=0
2700c3
	for guid in $GUIDS; do
2700c3
		let GUID_CNT++
2700c3
	done
2700c3
fi
2700c3
# Start opensm
2700c3
if [ -n "$GUIDS" ]; then
2700c3
	SUBNET_COUNT=0
2700c3
	for guid in $GUIDS; do
2700c3
		SUBNET_PREFIX=`printf "0xfe800000000000%02d" $SUBNET_COUNT`
2700c3
		(while true; do $prog $prio -g $guid --subnet_prefix $SUBNET_PREFIX; sleep 30; done) &
2700c3
		let SUBNET_COUNT++
2700c3
	done
2700c3
elif [ -n "$CONFIGS" ]; then
2700c3
	for config in $CONFIGS; do
2700c3
		(while true; do $prog $prio -F $config; sleep 30; done) &
2700c3
	done
2700c3
else
2700c3
	(while true; do $prog $prio; sleep 30; done) &
2700c3
fi
2700c3
exit 0