my $debconf_owner = 'openflow-switch';
my $default = '/etc/default/openflow-switch';
+my $template = '/usr/share/openflow/switch/default.template';
my $etc = '/etc/openflow-switch';
my $rundir = '/var/run';
my $privkey_file = "$etc/of0-privkey.pem";
local $_ = $oldconfig{$key};
&{$map{$key}}() if defined && !/^\s*$/;
}
+} elsif (-e $template) {
+ %oldconfig = load_config($template);
}
my $cacert_preverified = -e $cacert_file;
/etc/openflow-switch
+/usr/share/openflow/switch
--- /dev/null
+#!/bin/sh
+# postinst script for openflow-switch
+#
+# 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)
+ DEFAULT=/etc/default/openflow-switch
+ TEMPLATE=/usr/share/openflow/switch/default.template
+ if ! test -e $DEFAULT; then
+ cp $TEMPLATE $DEFAULT
+ elif ! grep DATAPATH_ID $DEFAULT; then
+ echo >> $DEFAULT
+ sed -n '/DATAPATH_ID:/,/DATAPATH_ID=/p' $TEMPLATE >> $DEFAULT
+ fi
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0
+
+
--- /dev/null
+#!/bin/sh
+# postrm script for openflow-switch
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postrm> `remove'
+# * <postrm> `purge'
+# * <old-postrm> `upgrade' <new-version>
+# * <new-postrm> `failed-upgrade' <old-version>
+# * <new-postrm> `abort-install'
+# * <new-postrm> `abort-install' <old-version>
+# * <new-postrm> `abort-upgrade' <old-version>
+# * <disappearer's-postrm> `disappear' <overwriter>
+# <overwriter-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ purge)
+ rm -f /etc/default/openflow-switch
+ ;;
+
+ remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+ ;;
+
+ *)
+ echo "postrm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
dh_installdirs -s
$(MAKE) -C _debian DESTDIR=$(CURDIR)/debian/openflow install
cp debian/openflow-switch-config.overrides debian/openflow-switch-config/usr/share/lintian/overrides/openflow-switch-config
+ cp debian/openflow-switch.template debian/openflow-switch/usr/share/openflow/switch/default.template
dh_install -s
$(ext_install_arch)