From 410b02a8a38445aa6890868d4352053490a8e273 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Le=20Ninivin?= <cedric.leninivin@tiolive.com>
Date: Fri, 14 Sep 2012 15:46:49 +0200
Subject: [PATCH] Fixed update process (now integrate clientipv4.conf

---
 slapprepare/slapprepare/__init__.py                |  9 +++++++++
 .../slapprepare/template/clientipv4.conf.in        | 14 ++++++++++++++
 updating_suse_image.rst                            |  2 +-
 3 files changed, 24 insertions(+), 1 deletion(-)
 create mode 100644 slapprepare/slapprepare/template/clientipv4.conf.in

diff --git a/slapprepare/slapprepare/__init__.py b/slapprepare/slapprepare/__init__.py
index 9d587bb..befdc04 100644
--- a/slapprepare/slapprepare/__init__.py
+++ b/slapprepare/slapprepare/__init__.py
@@ -359,6 +359,15 @@ def prepare_scripts (config):
       % dict(slapos_configuration=slapos_configuration))
     os.chmod(path, 0755)
 
+  # add clientipv4
+  path = os.path.join('/','etc','openvpn','clientipv4.conf')
+  print "Creating %r" % path
+  if not dry_run:
+    open(path, 'w').write(
+      pkg_resources.resource_stream(__name__,
+                                    'template/%s' % 'clientipv4.conf.in').read())
+    os.chmod(path, 0755)
+
   # Remove old-timers scripts
   remove_former_scripts(slapos_configuration)
 
diff --git a/slapprepare/slapprepare/template/clientipv4.conf.in b/slapprepare/slapprepare/template/clientipv4.conf.in
new file mode 100644
index 0000000..2130b72
--- /dev/null
+++ b/slapprepare/slapprepare/template/clientipv4.conf.in
@@ -0,0 +1,14 @@
+client
+comp-lzo
+keepalive 10 60
+ping-timer-rem
+persist-tun
+persist-key
+verb 0
+dev tun
+remote 88.191.151.195
+proto tcp
+port 443
+ca /etc/openvpn/vifib-keys/ca.crt
+cert /etc/openvpn/vifib-keys/client-vifib.crt
+key /etc/openvpn/vifib-keys/client-vifib.key
diff --git a/updating_suse_image.rst b/updating_suse_image.rst
index b8abd41..dbae5a5 100644
--- a/updating_suse_image.rst
+++ b/updating_suse_image.rst
@@ -7,7 +7,7 @@ Procedure
 Run this whole command as root
 ++++++++++++++++++++++++++++++
 
-# wget http://perso.telecom-paristech.fr/~leninivi/slapprepare.tar.gz ;zypper remove -y slapos.node ; rm -f /etc/opt/slapos/slapos.node-0.88-28.1.x86_64.rpm ;tar -xzf slapprepare.tar.gz ; cd slapprepare; python setup.py install; cd .. ; rm -r slapprepare* ; slapprepare -u ;
+# wget http://perso.telecom-paristech.fr/~leninivi/slapprepare.tar.gz ;zypper remove -y slapos.node ; rm -f /etc/opt/slapos/slapos.node*.rpm ;tar -xzf slapprepare.tar.gz ; cd slapprepare; python setup.py install; cd .. ; rm -r slapprepare* ; slapprepare -u ;
 
 Check your config
 -----------------
-- 
2.30.9