east:~# D=/testing/scripts/ipsec.conf-restart-01
east:~# export IPSEC_CONFS="$D/etc-norestart"
east:~# ipsec setup --showonly start | sed -e 's=\(Starting FreeS/WAN IPsec \).*\.\.\.=\1DATE...='
ipsec_setup: 	 PATH=/usr/local/sbin:/sbin:/usr/sbin:/usr/local/bin:/bin:/usr/bin
ipsec_setup: 	 test ! -f /var/run/pluto/ipsec_setup.pid || { echo "Libreswan IPsec apparently already active, start aborted" ; exit 0 ; }
ipsec_setup:    echo "Starting Libreswan IPsec VER"
ipsec_setup: 	 rm -f /var/run/pluto/ipsec_setup.pid
ipsec_setup: 	 test -r /dev/random || { echo "...unable to start Libreswan IPsec, no /dev/random!" ; exit 1 ; }
ipsec_setup: 	 test -r /dev/urandom || { echo "...unable to start Libreswan IPsec, no /dev/urandom!" ; exit 1 ; }
ipsec_setup: 	 echo $$ > /var/run/pluto/ipsec_setup.pid
ipsec_setup: 	 test -s /var/run/pluto/ipsec_setup.pid || { echo "...unable to create /var/run/pluto/ipsec_setup.pid, aborting start!" ; rm -f /var/run/pluto/ipsec_setup.pid ; exit 1 ; }
ipsec_setup: 	 > /var/run/pluto/ipsec.info
ipsec_setup: 	 ipsec _startklips --info /var/run/pluto/ipsec.info --debug "" --omtu "" --fragicmp "yes" --hidetos "yes" --rpfilter "0" --log "daemon.error" %defaultroute || { rm -f /var/run/pluto/ipsec_setup.pid ; exit 1 ; }
ipsec_setup: 	 test -f /proc/net/ipsec_version || test -f /proc/net/pfkey || { echo "OOPS, should have aborted!  Broken shell!" ; exit 1 ; }
ipsec_setup: 	 test -d /var/lock/subsys && touch /var/lock/subsys/ipsec
ipsec_setup: 	 ipsec _plutorun --debug "" --uniqueids "no" --nocrsend "no" --strictcrlpolicy "" --nat_traversal "no" --keep_alive "" --protostack "auto" --disable_port_floating "" --virtual_private "" --crlcheckinterval "0" --ocspuri "" --nhelpers "" --dump "" --opts "" --stderrlog "" --wait "no" --pre "" --post "" --log "daemon.error" --plutorestartoncrash true --pid "/var/run/pluto/pluto.pid" || { ifl=`grep -v NULL /proc/net/ipsec_tncfg 2> /dev/null | sed -n -e "/^ipsec/s/ .*//p" ` ; test "X$ifl" != "X" && for i in $ifl ; do ip link set $i down ; ip addr flush dev $i ; ipsec tncfg --detach --virtual $i ; done ; test -r /proc/net/ipsec_klipsdebug && ipsec klipsdebug --none ; test -d /proc/net/ipsec/eroute && ipsec eroute --clear ; test -d /proc/net/ipsec/spi && ipsec spi --clear ; rm -f /var/run/pluto/ipsec_setup.pid ; exit 1 ; }
ipsec_setup: 	 echo "...Libreswan IPsec started" | logger -p daemon.error -t ipsec_setup
east:~# export IPSEC_CONFS="$D/etc-restart"
east:~# ipsec setup --showonly start | sed -e 's=\(Starting FreeS/WAN IPsec \).*\.\.\.=\1DATE...='
ipsec_setup: 	 PATH=/usr/local/sbin:/sbin:/usr/sbin:/usr/local/bin:/bin:/usr/bin
ipsec_setup: 	 test ! -f /var/run/pluto/ipsec_setup.pid || { echo "Libreswan IPsec apparently already active, start aborted" ; exit 0 ; }
ipsec_setup:    echo "Starting Libreswan IPsec VER"
ipsec_setup: 	 rm -f /var/run/pluto/ipsec_setup.pid
ipsec_setup: 	 test -r /dev/random || { echo "...unable to start Libreswan IPsec, no /dev/random!" ; exit 1 ; }
ipsec_setup: 	 test -r /dev/urandom || { echo "...unable to start Libreswan IPsec, no /dev/urandom!" ; exit 1 ; }
ipsec_setup: 	 echo $$ > /var/run/pluto/ipsec_setup.pid
ipsec_setup: 	 test -s /var/run/pluto/ipsec_setup.pid || { echo "...unable to create /var/run/pluto/ipsec_setup.pid, aborting start!" ; rm -f /var/run/pluto/ipsec_setup.pid ; exit 1 ; }
ipsec_setup: 	 > /var/run/pluto/ipsec.info
ipsec_setup: 	 ipsec _startklips --info /var/run/pluto/ipsec.info --debug "" --omtu "" --fragicmp "yes" --hidetos "yes" --rpfilter "0" --log "daemon.error" %defaultroute || { rm -f /var/run/pluto/ipsec_setup.pid ; exit 1 ; }
ipsec_setup: 	 test -f /proc/net/ipsec_version || test -f /proc/net/pfkey || { echo "OOPS, should have aborted!  Broken shell!" ; exit 1 ; }
ipsec_setup: 	 test -d /var/lock/subsys && touch /var/lock/subsys/ipsec
ipsec_setup: 	 ipsec _plutorun --debug "" --uniqueids "no" --nocrsend "no" --strictcrlpolicy "" --nat_traversal "no" --keep_alive "" --protostack "auto" --disable_port_floating "" --virtual_private "" --crlcheckinterval "0" --ocspuri "" --nhelpers "" --dump "" --opts "" --stderrlog "" --wait "no" --pre "" --post "" --log "daemon.error" --plutorestartoncrash false --pid "/var/run/pluto/pluto.pid" || { ifl=`grep -v NULL /proc/net/ipsec_tncfg 2> /dev/null | sed -n -e "/^ipsec/s/ .*//p" ` ; test "X$ifl" != "X" && for i in $ifl ; do ip link set $i down ; ip addr flush dev $i ; ipsec tncfg --detach --virtual $i ; done ; test -r /proc/net/ipsec_klipsdebug && ipsec klipsdebug --none ; test -d /proc/net/ipsec/eroute && ipsec eroute --clear ; test -d /proc/net/ipsec/spi && ipsec spi --clear ; rm -f /var/run/pluto/ipsec_setup.pid ; exit 1 ; }
ipsec_setup: 	 echo "...Libreswan IPsec started" | logger -p daemon.error -t ipsec_setup

