summarylogtreecommitdiffstats
path: root/opensm.launch
diff options
context:
space:
mode:
authorJames Harvey2016-07-14 21:35:13 -0400
committerJames Harvey2016-07-14 21:35:13 -0400
commit6b5a3946cff92868f6d86a055381a3f38c298648 (patch)
treebbb975a42078abf5e66593b42b0af46225c161d2 /opensm.launch
parent260e840e93053d363b70190f83bd589f9b4e80dd (diff)
downloadaur-6b5a3946cff92868f6d86a055381a3f38c298648.tar.gz
Integrated Fedora's method for easier handling of multiple interfaces
Diffstat (limited to 'opensm.launch')
-rw-r--r--opensm.launch43
1 files changed, 39 insertions, 4 deletions
diff --git a/opensm.launch b/opensm.launch
index 08f0b1f5ec2f..8b721c4bede4 100644
--- a/opensm.launch
+++ b/opensm.launch
@@ -1,9 +1,44 @@
#!/bin/bash
-# Copied from Fedora's opensm-3.3.17-4.fc22.x86_64.rpm
-# Modified to just launch opensm
-# Will come back to adding multiple OpenSM daemons running at once, which is what the rest of Fedora's version is for
+# Copied from Fedora's opensm-3.3.19-1.fc23.src.rpm
+# Modified for Arch
#
# Launch the necessary OpenSM daemons for systemd
+#
+# Config files: /etc/opensm.conf (created by opensm), and additional /etc/opensm_extra.conf and /etc/opensm/opensm.conf.[0-9]*
+
+shopt -s nullglob
+
+prog=/usr/bin/opensm
+[ -f /etc/opensm_extra.conf ] && . /etc/opensm_extra.conf
+
+[ -n "$PRIORITY" ] && prio="-p $PRIORITY"
-(while true; do /usr/bin/opensm; sleep 30; done) &
+if [ -z "$GUIDS" ]; then
+ CONFIGS=""
+ CONFIG_CNT=0
+ for conf in /etc/opensm/opensm.conf.[0-9]*; do
+ CONFIGS="$CONFIGS $conf"
+ let CONFIG_CNT++
+ done
+else
+ GUID_CNT=0
+ for guid in $GUIDS; do
+ let GUID_CNT++
+ done
+fi
+# Start opensm
+if [ -n "$GUIDS" ]; then
+ SUBNET_COUNT=0
+ for guid in $GUIDS; do
+ SUBNET_PREFIX=`printf "0xfe800000000000%02d" $SUBNET_COUNT`
+ (while true; do $prog $prio -g $guid --subnet_prefix $SUBNET_PREFIX; sleep 30; done) &
+ let SUBNET_COUNT++
+ done
+elif [ -n "$CONFIGS" ]; then
+ for config in $CONFIGS; do
+ (while true; do $prog $prio -F $config; sleep 30; done) &
+ done
+else
+ (while true; do $prog $prio; sleep 30; done) &
+fi
exit 0