On 05/12/14 13:11, andy wrote:
NB; My 'patches' are not really patches as they are not code diff's. They are just suggested changes i've posted on the lists. When I get more time (I'm a one man band at the mo for my company!) I want to get more familiar with the code base etc and contribute diffs to OBSD..
if [ `ifconfig | grep "status: master" | wc -l` > 0 ]; then ipsecctl -d -f /etc/ipsec.conf; fi sleep 1 if [ `ifconfig | grep "status: master" | wc -l` > 0 ]; then ipsecctl -d -f /etc/ipsec.conf; fi if [ `ifconfig | grep "status: master" | wc -l` > 0 ]; then ipsecctl -F -f /etc/ipsec.conf; fi
Now my eyes hurt a bit and I cannot let this pass uncontradicted. AFAICT, the above chunk would always perform all of the ipsecctl's, and as a bonus leave a '0' file wherever it is run from.
While it could be fixed in the intended style, instead I'll overdo it and leave it to the reader to find a nice suitable middle ground. :-)
local f for f in d d F; do ifconfig | grep -q "status: master" || break ipsecctl -$f -f /etc/ipsec.conf done Totally untested, but the idea should be clear. /Alexander