From 686cd5c3d8dd7f23c320b4e3a3c25c59c355f78c Mon Sep 17 00:00:00 2001
From: Ben Pfaff <blp@nicira.com>
Date: Thu, 30 Oct 2008 10:24:02 -0700
Subject: [PATCH] Break HTTP parts of openflow-pki package into new
 openflow-pki-server package.

---
 debian/control.in                             | 14 +++++-
 ...ki.apache2 => openflow-pki-server.apache2} |  0
 ...flow-pki.dirs => openflow-pki-server.dirs} |  0
 ...ki.install => openflow-pki-server.install} |  0
 debian/openflow-pki-server.postinst           | 44 +++++++++++++++++++
 debian/openflow-pki.postinst                  |  8 ----
 debian/rules                                  |  2 +-
 7 files changed, 58 insertions(+), 10 deletions(-)
 rename debian/{openflow-pki.apache2 => openflow-pki-server.apache2} (100%)
 rename debian/{openflow-pki.dirs => openflow-pki-server.dirs} (100%)
 rename debian/{openflow-pki.install => openflow-pki-server.install} (100%)
 create mode 100755 debian/openflow-pki-server.postinst

diff --git a/debian/control.in b/debian/control.in
index 65d537f17..b7aa8b544 100644
--- a/debian/control.in
+++ b/debian/control.in
@@ -39,7 +39,7 @@ Description: OpenFlow switch implementations
 
 Package: openflow-pki
 Architecture: all
-Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, openflow-common, apache2
+Depends: ${shlibs:Depends}, ${misc:Depends}, openflow-common
 Description: OpenFlow public key infrastructure
  openflow-pki provides PKI (public key infrastructure) support for
  OpenFlow switches and controllers, reducing the risk of
@@ -47,6 +47,18 @@ Description: OpenFlow public key infrastructure
  .
  OpenFlow is a protocol for flow-based control over network switching.
 
+Package: openflow-pki-server
+Architecture: all
+Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, openflow-pki, apache2
+Description: OpenFlow public key infrastructure (HTTP server support)
+ openflow-pki-server provides HTTP access to the OpenFlow PKI (public
+ key infrastructure) maintained on the local machine by the
+ openflow-pki package.  This HTTP access is needed for secure and
+ convenient OpenFlow switch setup using the ofp-switch-setup program
+ in the openflow-switch package.
+ .
+ OpenFlow is a protocol for flow-based control over network switching.
+
 Package: openflow-controller
 Architecture: any
 Depends: ${shlibs:Depends}, openflow-common, openflow-pki
diff --git a/debian/openflow-pki.apache2 b/debian/openflow-pki-server.apache2
similarity index 100%
rename from debian/openflow-pki.apache2
rename to debian/openflow-pki-server.apache2
diff --git a/debian/openflow-pki.dirs b/debian/openflow-pki-server.dirs
similarity index 100%
rename from debian/openflow-pki.dirs
rename to debian/openflow-pki-server.dirs
diff --git a/debian/openflow-pki.install b/debian/openflow-pki-server.install
similarity index 100%
rename from debian/openflow-pki.install
rename to debian/openflow-pki-server.install
diff --git a/debian/openflow-pki-server.postinst b/debian/openflow-pki-server.postinst
new file mode 100755
index 000000000..d161a98a9
--- /dev/null
+++ b/debian/openflow-pki-server.postinst
@@ -0,0 +1,44 @@
+#!/bin/sh
+# postinst script for openflow
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+case "$1" in
+    configure)
+        # Enable site under Apache.
+        a2ensite openflow-pki >/dev/null
+        if command -v invoke-rc.d >/dev/null 2>&1; then
+                invoke-rc.d apache2 force-reload || :
+        else
+                [ -x /etc/init.d/apache2 ] && /etc/init.d/apache2 force-reload || :
+        fi
+        ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+        ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+        ;;
+esac
+
+#DEBHELPER#
+
+exit 0
+
+
diff --git a/debian/openflow-pki.postinst b/debian/openflow-pki.postinst
index 8a687179e..5cf6515db 100755
--- a/debian/openflow-pki.postinst
+++ b/debian/openflow-pki.postinst
@@ -23,14 +23,6 @@ case "$1" in
         if test ! -d /usr/share/openflow/pki; then
             ofp-pki init
         fi
-
-        # Enable site under Apache.
-        a2ensite openflow-pki >/dev/null
-        if command -v invoke-rc.d >/dev/null 2>&1; then
-                invoke-rc.d apache2 force-reload || :
-        else
-                [ -x /etc/init.d/apache2 ] && /etc/init.d/apache2 force-reload || :
-        fi
         ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)
diff --git a/debian/rules b/debian/rules
index 238414fc8..d5f55c081 100755
--- a/debian/rules
+++ b/debian/rules
@@ -104,7 +104,7 @@ install-indep: build-indep
 	cp _debian/openflow.tar.gz $(MODDIR)
 	cd debian; cp changelog control compat *.modules.in rules $(MODDIR)/debian
 	cd debian/openflow-datapath-source/usr/src && tar -c modules | bzip2 -9 > openflow-datapath.tar.bz2 && rm -rf modules
-	install -m644 debian/openflow-pki.apache2 debian/openflow-pki/etc/apache2/sites-available/openflow-pki
+	install -m644 debian/openflow-pki-server.apache2 debian/openflow-pki-server/etc/apache2/sites-available/openflow-pki
 	dh_install -i
 
 install-arch: build-arch
-- 
2.47.0