xcat-core/xCAT-nbroot/overlay/etc/init.d/S11stunnel

27 lines
913 B
Plaintext
Raw Normal View History

#!/bin/sh
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
#Stunnel init for xcat:
XCATDEST=""
killall stunnel
for parm in `cat /proc/cmdline`; do
key=`echo $parm|awk -F= '{print $1}'`
if [ "$key" == "xcatd" ]; then
XCATDEST=`echo $parm|awk -F= '{print $2}'`
XCATPORT=`echo $XCATDEST|awk -F: '{print $2}'`
fi
done
mkdir -p /etc/stunnel
echo 'client=yes' > /etc/stunnel/stunnel.conf
echo 'foreground=yes' >> /etc/stunnel/stunnel.conf
echo 'verify=0' >> /etc/stunnel/stunnel.conf
echo '[xcatds]' >> /etc/stunnel/stunnel.conf
echo 'accept=301' >> /etc/stunnel/stunnel.conf
echo 'connect='$XCATDEST >> /etc/stunnel/stunnel.conf
if [ -r /tmp/dhcpserver ]; then
echo '[dhcps]' >> /etc/stunnel/stunnel.conf
echo 'accept=300' >> /etc/stunnel/stunnel.conf
echo 'connect='`cat /tmp/dhcpserver`':'$XCATPORT >> /etc/stunnel/stunnel.conf
fi
mkdir -p /usr/var/run/stunnel
stunnel &