From 3f320d348f94c33a88b013e1b4011ecf5d2033ce Mon Sep 17 00:00:00 2001 From: Rene Mayrhofer Date: Mon, 6 Nov 2006 20:09:04 +0000 Subject: - Fix an important bug: renaming of the no_oe.conf to oe.conf. Changes to postinst. - Update debconf translations. --- debian/strongswan.postinst | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) (limited to 'debian/strongswan.postinst') diff --git a/debian/strongswan.postinst b/debian/strongswan.postinst index 5875db9db..13a11017d 100644 --- a/debian/strongswan.postinst +++ b/debian/strongswan.postinst @@ -206,23 +206,39 @@ case "$1" in db_get strongswan/enable-oe if [ "$RET" != "true" ]; then echo -n "Disabling opportunistic encryption (OE) in config file ... " - if egrep -q "^include /etc/ipsec.d/examples/no_oe.conf$" /etc/ipsec.conf; then - echo "already disabled" + if egrep -q "include /etc/ipsec.d/examples/no_oe.conf$" /etc/ipsec.conf; then + # also update to new-style config + sed 's/.*include \/etc\/ipsec.d\/examples\/no_oe.conf/#include \/etc\/ipsec.d\/examples\/oe.conf/' < /etc/ipsec.conf > /etc/ipsec.conf.tmp + mv /etc/ipsec.conf.tmp /etc/ipsec.conf + echo -n "converted old config line to new format" + fi + if egrep -q "^include /etc/ipsec.d/examples/oe.conf$" /etc/ipsec.conf; then + sed 's/include \/etc\/ipsec.d\/examples\/oe.conf/#include \/etc\/ipsec.d\/examples\/oe.conf/' < /etc/ipsec.conf > /etc/ipsec.conf.tmp + mv /etc/ipsec.conf.tmp /etc/ipsec.conf + echo "done" else - cat <> /etc/ipsec.conf -#Disable Opportunistic Encryption -include /etc/ipsec.d/examples/no_oe.conf -EOF - echo "done" + echo "already disabled" fi else echo -n "Enabling opportunistic encryption (OE) in config file ... " - if egrep -q "^include /etc/ipsec.d/examples/no_oe.conf$" /etc/ipsec.conf; then - sed 's/include \/etc\/ipsec.d\/examples\/no_oe.conf/#include \/etc\/ipsec.d\/examples\/no_oe.conf/' < /etc/ipsec.conf > /etc/ipsec.conf.tmp + if egrep -q "include /etc/ipsec.d/examples/no_oe.conf$" /etc/ipsec.conf; then + # also update to new-style config + sed 's/.*include \/etc\/ipsec.d\/examples\/no_oe.conf/include \/etc\/ipsec.d\/examples\/oe.conf/' < /etc/ipsec.conf > /etc/ipsec.conf.tmp + mv /etc/ipsec.conf.tmp /etc/ipsec.conf + echo -n "converted old config line to new format" + fi + if egrep -q "^include /etc/ipsec.d/examples/oe.conf$" /etc/ipsec.conf; then + echo "already enabled" + elif egrep -q "^#.*include /etc/ipsec.d/examples/oe.conf$" /etc/ipsec.conf; then + sed 's/#.*include \/etc\/ipsec.d\/examples\/oe.conf/include \/etc\/ipsec.d\/examples\/oe.conf/' < /etc/ipsec.conf > /etc/ipsec.conf.tmp mv /etc/ipsec.conf.tmp /etc/ipsec.conf echo "done" else - echo "already enabled" + cat <> /etc/ipsec.conf +#Enable Opportunistic Encryption +include /etc/ipsec.d/examples/oe.conf +EOF + echo "done" fi fi -- cgit v1.2.3