diff --git a/SOURCES/netcf-Require-bridge-utils-for-netcf-libs-in-the-specfile.patch b/SOURCES/netcf-Require-bridge-utils-for-netcf-libs-in-the-specfile.patch
new file mode 100644
index 0000000..f3ed352
--- /dev/null
+++ b/SOURCES/netcf-Require-bridge-utils-for-netcf-libs-in-the-specfile.patch
@@ -0,0 +1,46 @@
+From 097cfe01588570f924050bc3d1423a0266cd1ca4 Mon Sep 17 00:00:00 2001
+From: Laine Stump <laine@laine.org>
+Date: Fri, 7 Feb 2014 16:17:24 +0200
+Subject: [PATCH] Require bridge-utils for netcf-libs in the specfile
+
+This resolves:
+
+  https://bugzilla.redhat.com/show_bug.cgi?id=1060317 (RHEL7)
+  https://bugzilla.redhat.com/show_bug.cgi?id=911403 (Fedora 20)
+
+netcf itself doesn't use anything in bridge-utils, but it called
+/sbin/ifup, which *can* run brctl (which is part of bridge-utils).
+Technically, initscripts should require brutils (since /sbin/ifup is a
+part of initscripts), but we all know that's not going to
+happen. Instead we can just make netcf require bridge-utils. It's not
+a very large package, so it's unlikely we'll get any complaints about
+bloat.
+
+(NB: in the past, libvirt had a Requires: bridge-utils, so this didn't
+used to be a problem. libvirt removed this Requires: in v0.9.8, when
+it switched from execing brctl to directly calling ioctls to create
+and manage bridge devices.)
+
+(cherry picked from commit 5bb22ec48096338a6651590299740f9e42367bb9)
+---
+ netcf.spec.in | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/netcf.spec.in b/netcf.spec.in
+index 6ab3ee5..7862e74 100644
+--- a/netcf.spec.in
++++ b/netcf.spec.in
+@@ -66,6 +66,10 @@ developing applications that use %{name}.
+ Summary:        Libraries for %{name}
+ Group:          System Environment/Libraries
+ 
++# bridge-utils is needed because /sbin/ifup calls brctl
++# if you create a bridge device
++Requires:       bridge-utils
++
+ %description    libs
+ The libraries for %{name}.
+ 
+-- 
+1.8.3.1
+
diff --git a/SOURCES/netcf-eliminate-use-of-uninitialized-data-when-getting-mac.patch b/SOURCES/netcf-eliminate-use-of-uninitialized-data-when-getting-mac.patch
new file mode 100644
index 0000000..48e2192
--- /dev/null
+++ b/SOURCES/netcf-eliminate-use-of-uninitialized-data-when-getting-mac.patch
@@ -0,0 +1,112 @@
+From 423f9e7d93c4971a5a02b2ea5dc352f4bf2dfd9f Mon Sep 17 00:00:00 2001
+From: Laine Stump <laine@laine.org>
+Date: Tue, 7 Jan 2014 20:12:06 +0200
+Subject: [PATCH] eliminate use of uninitialized data when getting mac address
+
+https://bugzilla.redhat.com/show_bug.cgi?id=1046594
+
+If the call to get_augeas() at the top of aug_get_mac() failed, we
+would goto error and FREE(path), which would not have been
+initialized. And if by some magic of fate we happened to get past
+that, we would return garbage for the return code, since r was also
+not initialized. This patch initializes both path and r to fix the
+crash documented in Bug 1046594.
+
+Although it doesn't directly impact the referenced bug, a quick audit
+of other functions in the same file showed that defnode() had the same
+problem with uninitialized "r". Beyond that, I also defensively
+initialized the pointer to mac address to NULL both in aug_get_mac()
+as well as two of its callers, to make future audits of the code
+easier, and to shut up both valgrind and whatever static analyzers
+might be run on the code.
+
+(cherry picked from commit 8ed36d22fbc792474ca9c3b06c8a326b1fb5af08)
+---
+ src/drv_redhat.c  | 4 ++--
+ src/drv_suse.c    | 4 ++--
+ src/dutil_linux.c | 9 +++++----
+ 3 files changed, 9 insertions(+), 8 deletions(-)
+
+diff --git a/src/drv_redhat.c b/src/drv_redhat.c
+index b5b8694..e9d25cb 100644
+--- a/src/drv_redhat.c
++++ b/src/drv_redhat.c
+@@ -1,7 +1,7 @@
+ /*
+  * drv_redhat.c: the Red Hat distro family backend for netcf
+  *
+- * Copyright (C) 2009-2013 Red Hat Inc.
++ * Copyright (C) 2009-2014 Red Hat Inc.
+  *
+  * This library is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Lesser General Public
+@@ -989,7 +989,7 @@ int drv_lookup_by_mac_string(struct netcf *ncf, const char *mac,
+ 
+ const char *drv_mac_string(struct netcf_if *nif) {
+     struct netcf *ncf = nif->ncf;
+-    const char *mac;
++    const char *mac = NULL;
+     char *path = NULL;
+     int r;
+ 
+diff --git a/src/drv_suse.c b/src/drv_suse.c
+index e59d7d3..e346c27 100644
+--- a/src/drv_suse.c
++++ b/src/drv_suse.c
+@@ -2,7 +2,7 @@
+  * drv_suse.c: the suse backend for netcf
+  *
+  * Copyright (C) 2010 Novell Inc.
+- * Copyright (C) 2009-2013 Red Hat Inc.
++ * Copyright (C) 2009-2014 Red Hat Inc.
+  *
+  * This library is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Lesser General Public
+@@ -1132,7 +1132,7 @@ int drv_lookup_by_mac_string(struct netcf *ncf, const char *mac,
+ 
+ const char *drv_mac_string(struct netcf_if *nif) {
+     struct netcf *ncf = nif->ncf;
+-    const char *mac;
++    const char *mac = NULL;
+     char *path = NULL;
+     int r;
+ 
+diff --git a/src/dutil_linux.c b/src/dutil_linux.c
+index 271c515..7af741e 100644
+--- a/src/dutil_linux.c
++++ b/src/dutil_linux.c
+@@ -1,7 +1,7 @@
+ /*
+  * dutil_linux.c: Linux utility functions for driver backends.
+  *
+- * Copyright (C) 2009-2012 Red Hat Inc.
++ * Copyright (C) 2009-2012, 2014 Red Hat Inc.
+  *
+  * This library is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Lesser General Public
+@@ -221,7 +221,7 @@ int defnode(struct netcf *ncf, const char *name, const char *value,
+     struct augeas *aug = get_augeas(ncf);
+     va_list ap;
+     char *expr = NULL;
+-    int r, created;
++    int r = -1, created;
+ 
+     ERR_BAIL(ncf);
+ 
+@@ -370,10 +370,11 @@ int aug_match_mac(struct netcf *ncf, const char *mac, char ***matches) {
+ 
+ /* Get the MAC address of the interface INTF */
+ int aug_get_mac(struct netcf *ncf, const char *intf, const char **mac) {
+-    int r;
+-    char *path;
++    int r = -1;
++    char *path = NULL;
+     struct augeas *aug = get_augeas(ncf);
+ 
++    *mac = NULL;
+     ERR_BAIL(ncf);
+ 
+     r = xasprintf(&path, "/files/sys/class/net/%s/address/content", intf);
+-- 
+1.8.3.1
+
diff --git a/SOURCES/netcf-fix-autogen-build-error.patch b/SOURCES/netcf-fix-autogen-build-error.patch
new file mode 100644
index 0000000..b64cfd8
--- /dev/null
+++ b/SOURCES/netcf-fix-autogen-build-error.patch
@@ -0,0 +1,36 @@
+From 576e913f6fbce1a3428ad16af2c3e94544b862e7 Mon Sep 17 00:00:00 2001
+From: Laine Stump <laine@laine.org>
+Date: Wed, 22 Jan 2014 15:27:43 +0200
+Subject: [PATCH] fix autogen build error
+
+This is also required for the fix for:
+
+  https://bugzilla.redhat.com/show_bug.cgi?id=1044681
+
+A last minute change to the previous patch addressing a review comment
+managed to break an autogen, but I didn't notice because the error
+scrolled off the screen:
+
+checking for system init flavor... ./configure: line 32046: systemd: command not found
+
+(cherry picked from commit 9dabd473ce54a5264ae92a78d5e4019b864f6997)
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 4dc415f..c9e0ad2 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -139,7 +139,7 @@ fi
+ 
+ AM_CONDITIONAL([NETCF_USE_INITSCRIPTS], test "$with_sysinit" = "initscripts")
+ AM_CONDITIONAL([NETCF_USE_SYSTEMD], test "$with_sysinit" = "systemd")
+-AM_CONDITIONAL([NETCF_TRANSACTION_SUPPORT], "$with_sysinit" != "none")
++AM_CONDITIONAL([NETCF_TRANSACTION_SUPPORT], test "$with_sysinit" != "none")
+ AC_MSG_RESULT($with_sysinit)
+ if test "$with_sysinit" != "none" && test "$with_driver" != "redhat"; then
+   AC_MSG_ERROR([netcf does not have support for $with_sysinit combined with the $with_driver driver])
+-- 
+1.8.3.1
+
diff --git a/SOURCES/netcf-remove-extraneous-quotes-from-BONDING_OPTS.patch b/SOURCES/netcf-remove-extraneous-quotes-from-BONDING_OPTS.patch
new file mode 100644
index 0000000..ac4cb25
--- /dev/null
+++ b/SOURCES/netcf-remove-extraneous-quotes-from-BONDING_OPTS.patch
@@ -0,0 +1,127 @@
+From d25230cb26cdd6603d2758bdb2d3c56925d8219e Mon Sep 17 00:00:00 2001
+From: Satoru SATOH <ssato@redhat.com>
+Date: Wed, 3 Jul 2013 13:17:27 -0400
+Subject: [PATCH] remove extraneous quotes from BONDING_OPTS
+
+This fixes: https://bugzilla.redhat.com/show_bug.cgi?id=798851
+
+For some unknown reason, the BONDING_OPTS setting in ifcfg files was
+being set with an extra set of single quotes. So, for example, instead of:
+
+  BONDING_OPTS="mode=active-backup primary=eth1 miimon=100 updelay=10 use_carrier=0"
+
+we would get (e.g.):
+
+  BONDING_OPTS="'mode=active-backup primary=eth1 miimon=100 updelay=10 use_carrier=0'"
+
+Even when there weren't any BONDING_OPTS to set, the ifcfg file would
+still get:
+
+  BONDING_OPTS="''"
+
+Since the extra quotes are added in all cases, and are never needed,
+this patch just unconditionally removes them.
+
+(cherry picked from commit 581ff3f252552cf5edc8e47c4a72667a39e133ba)
+
+Conflicts:
+
+ AUTHORS - one additional name upstream for debian-specific patch not
+   yet in RHEL.
+
+ tests/suse/schema/*.xml - the upstream patch modified some files that
+   weren't yet being shipped in the tarball as of netcf-0.2.3; they are
+   unused in RHEL anyway.
+---
+ AUTHORS                               | 1 +
+ data/xml/util-get.xsl                 | 2 --
+ tests/redhat/schema/bond-arp.xml      | 2 +-
+ tests/redhat/schema/bond-defaults.xml | 2 +-
+ tests/redhat/schema/bond.xml          | 2 +-
+ tests/redhat/schema/bridge-bond.xml   | 2 +-
+ 6 files changed, 5 insertions(+), 6 deletions(-)
+
+diff --git a/AUTHORS b/AUTHORS
+index b41f26e..2512ac8 100644
+--- a/AUTHORS
++++ b/AUTHORS
+@@ -19,3 +19,4 @@ Contributions by:
+   Guido G�nther    <agx@sigxcpu.org>
+   Ed Maste         <emaste@freebsd.org>
+   Hendrik Schwartke <hendrik@os-t.de>
++  Satoru SATOH     <ssato@redhat.com>
+diff --git a/data/xml/util-get.xsl b/data/xml/util-get.xsl
+index 9edace3..ac0a320 100644
+--- a/data/xml/util-get.xsl
++++ b/data/xml/util-get.xsl
+@@ -3,7 +3,6 @@
+                 version="1.0">
+ 
+   <xsl:template name="bonding-opts">
+-    <xsl:text>'</xsl:text>
+     <xsl:if test="bond/@mode">mode=<xsl:value-of select='bond/@mode'/></xsl:if>
+     <xsl:if test="bond/@mode = 'active-backup'"> primary=<xsl:value-of select='bond/interface[1]/@name'/></xsl:if>
+     <xsl:if test="bond/miimon">
+@@ -21,7 +20,6 @@
+       <xsl:text> arp_ip_target=</xsl:text><xsl:value-of select="bond/arpmon/@target"/>
+       <xsl:if test="bond/arpmon/@validate"><xsl:text> arp_validate=</xsl:text><xsl:value-of select="bond/arpmon/@validate"/></xsl:if>
+     </xsl:if>
+-    <xsl:text>'</xsl:text>
+   </xsl:template>
+ 
+ </xsl:stylesheet>
+diff --git a/tests/redhat/schema/bond-arp.xml b/tests/redhat/schema/bond-arp.xml
+index 6a53d09..884cb84 100644
+--- a/tests/redhat/schema/bond-arp.xml
++++ b/tests/redhat/schema/bond-arp.xml
+@@ -7,7 +7,7 @@
+     <node label="IPADDR" value="192.168.50.7"/>
+     <node label="NETMASK" value="255.255.255.0"/>
+     <node label="GATEWAY" value="192.168.50.1"/>
+-    <node label="BONDING_OPTS" value="'mode=active-backup primary=eth1 arp_interval=100 arp_ip_target=192.168.50.1 arp_validate=active'"/>
++    <node label="BONDING_OPTS" value="mode=active-backup primary=eth1 arp_interval=100 arp_ip_target=192.168.50.1 arp_validate=active"/>
+   </tree>
+   <tree path="/files/etc/sysconfig/network-scripts/ifcfg-eth1">
+     <node label="DEVICE" value="eth1"/>
+diff --git a/tests/redhat/schema/bond-defaults.xml b/tests/redhat/schema/bond-defaults.xml
+index 3e92d19..5ee875d 100644
+--- a/tests/redhat/schema/bond-defaults.xml
++++ b/tests/redhat/schema/bond-defaults.xml
+@@ -11,7 +11,7 @@
+     <node label="IPADDR" value="192.168.50.7"/>
+     <node label="NETMASK" value="255.255.255.0"/>
+     <node label="GATEWAY" value="192.168.50.1"/>
+-    <node label="BONDING_OPTS" value="''"/>
++    <node label="BONDING_OPTS" value=""/>
+   </tree>
+   <tree  path="/files/etc/sysconfig/network-scripts/ifcfg-eth1">
+     <node label="DEVICE" value="eth1"/>
+diff --git a/tests/redhat/schema/bond.xml b/tests/redhat/schema/bond.xml
+index d97542d..4a7e9bf 100644
+--- a/tests/redhat/schema/bond.xml
++++ b/tests/redhat/schema/bond.xml
+@@ -11,7 +11,7 @@
+     <node label="IPADDR" value="192.168.50.7"/>
+     <node label="NETMASK" value="255.255.255.0"/>
+     <node label="GATEWAY" value="192.168.50.1"/>
+-    <node label="BONDING_OPTS" value="'mode=active-backup primary=eth1 miimon=100 updelay=10 use_carrier=0'"/>
++    <node label="BONDING_OPTS" value="mode=active-backup primary=eth1 miimon=100 updelay=10 use_carrier=0"/>
+   </tree>
+   <tree  path="/files/etc/sysconfig/network-scripts/ifcfg-eth1">
+     <node label="DEVICE" value="eth1"/>
+diff --git a/tests/redhat/schema/bridge-bond.xml b/tests/redhat/schema/bridge-bond.xml
+index c72f8d3..0b521d4 100644
+--- a/tests/redhat/schema/bridge-bond.xml
++++ b/tests/redhat/schema/bridge-bond.xml
+@@ -17,7 +17,7 @@
+     <node label="DEVICE" value="bond0"/>
+     <node label="ONBOOT" value="yes"/>
+     <node label="MTU" value="1500"/>
+-    <node label="BONDING_OPTS" value="'mode=active-backup primary=eth1 miimon=100 updelay=10 use_carrier=0'"/>
++    <node label="BONDING_OPTS" value="mode=active-backup primary=eth1 miimon=100 updelay=10 use_carrier=0"/>
+     <node label="BRIDGE" value="br0"/>
+   </tree>
+   <tree path="/files/etc/sysconfig/network-scripts/ifcfg-eth1">
+-- 
+1.8.3.1
+
diff --git a/SOURCES/netcf-support-systemd-based-netcf-transaction.patch b/SOURCES/netcf-support-systemd-based-netcf-transaction.patch
new file mode 100644
index 0000000..24de738
--- /dev/null
+++ b/SOURCES/netcf-support-systemd-based-netcf-transaction.patch
@@ -0,0 +1,524 @@
+From afcdbdd1923d148f947c53984c42102fd9188207 Mon Sep 17 00:00:00 2001
+From: Laine Stump <laine@laine.org>
+Date: Fri, 17 Jan 2014 11:58:46 +0200
+Subject: [PATCH] support systemd-based netcf-transaction
+
+https://bugzilla.redhat.com/show_bug.cgi?id=1044681
+
+The netcf-transaction script is used in two ways:
+
+1) It is called by libnetcf.so to begin, commit, and manually rollback
+a set of network interface config changes.
+
+2) It is called as part of normal system startup to automatically
+rollback any config changes that are part of a netcf transaction that
+hasn't yet been committed. (in other words, if you reboot after
+calling ncf_change_begin() but before calling ncf_change_commit(), all
+the changes you made subsequent to ncf_change_begin() will be erased).
+
+This functionality is only supported for the "redhat" driver (used by
+Fedora, CentOS, and RHEL), and up until now, it was all self-contained
+in an initscripts-style shell script installed to
+/etc/init.d/netcf-transaction - libnetcf.so would exec this script,
+and it was also conveniently placed for initscripts to run it at
+startup.
+
+Some time ago, Fedora started supporting systemd for system
+init/daemon management, but is still maintaining legacy support for
+initscripts for packages that haven't yet moved over to systemd. RHEL7
+also will support systemd.
+
+This patch updates netcf to allow building packages either with an
+initscripts-style script for /etc/init.d or a systemd-style init file
+for /lib/systemd/system. The selection of which to include in the
+build can either be made manually at configure-time (using the
+--with-sysinit=(initscripts|systemd) option) or, if not explicitly
+given on the configure commandline, configure.ac attempts to
+automatically determine which style to use based on the existence of
+the directory "/etc/systemd". Additionally, netcf.spec decides which
+type of sysinit to build for based on the Fedora/RHEL version, so that
+anyone building a netcf rpm on Fedora < 20 will continue to get
+initscripts files rather than switching midstream to systemd.
+
+The core functionality that was previously in
+/etc/init.d/netcf-transaction has been moved to the file
+/usr/libexec/netcf-transaction.sh, which is referenced both by the
+initscripts init file (/etc/init.d/netcf-transaction) and by the
+systemd service file (/lib/systemd/system/netcf-transaction.service):
+
+  src/netcf-transaction.init.in (new initscripts file)
+  src/netcf-transaction.service.in (systemd service file)
+  src/netcf-transaction.sh.in (this was previously the initscripts file)
+
+netcf.spec.in:
+ * add check to decide systemd vs. initscripts based on
+   RHEL/Fedora version and set configure commandline accordingly;
+
+ * update %post and %postun to do the right thing for systems, and add
+   a new %preun section for the same reason. Unlike libvirt, we know
+   that any version of netcf chosen to use systemd by this specfile
+   will already have the systemd rpm macros available, so we don't
+   need the extra check for that which is present in the libvirt
+   specfile. (this patch was written by heavily referencing the
+   libvirt bits responsible for setting up the "libvirt-guests"
+   service in libvirt).
+
+src/Makefile.am:
+ * generate the three new files when appropriate
+ * change install-data-local and uninstall-local targets as appropriate
+   for systemd vs initscripts vs none.
+
+configure.ac:
+
+ * support new --with-sysinit arg to manually specify
+   systemd/initscripts/none.
+
+ * autodetect which to use based on setting of $with_driver and
+   presence of /etd/systemd directory.
+
+NB: the location of the netcf-transaction script, which src/drv_*.c
+find via the NETCF_TRANSACTION #define is currently hardcoded to look
+in /usr/libexec. Ideally, this should use $libexecdir, but that
+resolves to "${exec_prefix}/libexec" at configure time. To get the
+desired results, we need to update gnulib and use gnulib's configmake
+package, this way we'll end up with a NETCF_TRANSACTION that will be
+set at the time make is run rather than configure. This is left as a
+separate patch though, so that the initial support for systemd can be
+backported to older releases of netcf (a gnulib update shouldn't be
+backported to the maintenance branch of an already-cut release).
+
+(cherry picked from commit 2ca7857cc5ececf12288f4bcda586befdb16378c)
+
+Conflicts: had to remove changes to .gitignore, since it isn't present
+           in the release tarball.
+---
+ configure.ac                                       | 57 ++++++++++++--
+ netcf.spec.in                                      | 60 ++++++++++++++-
+ src/Makefile.am                                    | 86 ++++++++++++++++------
+ src/netcf-transaction.init.in                      | 31 ++++++++
+ src/netcf-transaction.service.in                   | 15 ++++
+ ...transaction.init.sh => netcf-transaction.sh.in} | 34 +++++----
+ 6 files changed, 236 insertions(+), 47 deletions(-)
+ create mode 100644 src/netcf-transaction.init.in
+ create mode 100644 src/netcf-transaction.service.in
+ rename src/{netcf-transaction.init.sh => netcf-transaction.sh.in} (88%)
+ mode change 100755 => 100644
+
+diff --git a/configure.ac b/configure.ac
+index 3f30865..4dc415f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -50,14 +50,14 @@ if test "$prefix" = "/usr" && test "$sysconfdir" = '${prefix}/etc' ; then
+ fi
+ 
+ dnl
+-dnl init script flavor
++dnl network driver flavor
+ dnl
+ AC_ARG_WITH([driver],
+             [AS_HELP_STRING([--with-driver],
+-                            [Network driver name])],
++                            [network driver name])],
+             [],[with_driver=check])
+ 
+-AC_MSG_CHECKING([Network driver name])
++AC_MSG_CHECKING([network driver name])
+ if test "x$with_driver" = "xcheck" ; then
+   case "$host" in
+ 	*-*-mingw*)
+@@ -93,12 +93,57 @@ AM_CONDITIONAL([NETCF_DRIVER_SUSE], test "x$with_driver" = "xsuse")
+ AM_CONDITIONAL([NETCF_DRIVER_MSWINDOWS], test "x$with_driver" = "xmswindows")
+ 
+ if test "x$with_driver" = "xredhat"; then
++    # FIXME: This should be defined relative to $libexecdir,
++    # but that requires gnulib configmake to do correctly.
+     AC_DEFINE_UNQUOTED([NETCF_TRANSACTION],
+-                       ["$sysconfdir/rc.d/init.d/netcf-transaction"],
++                       ["/usr/libexec/netcf-transaction.sh"],
+                        [Location of the netcf-transaction shell script])
+ fi
+-AM_CONDITIONAL([NETCF_INIT_SCRIPT_RED_HAT],
+-               [test x$with_driver = xredhat])
++
++dnl
++dnl system init flavor
++dnl
++AC_MSG_CHECKING([for system init flavor])
++AC_ARG_WITH([sysinit],
++  [AS_HELP_STRING([--with-sysinit@<:@=STYLE@:>@],
++    [Style of init script to install: initscripts, systemd,
++     check, none @<:@default=check@:>@])],
++  [],[with_sysinit=check])
++
++case "$with_sysinit" in
++    systemd)
++       ;;
++    initscripts)
++       ;;
++    none)
++       ;;
++    check)
++       if test "$cross_compiling" != "yes" && \
++          test "$with_driver" = "redhat"; then
++         if test -d /etc/systemd; then
++           with_sysinit=systemd
++         else
++           with_sysinit=initscripts
++         fi
++       else
++         with_sysinit=none
++       fi
++       ;;
++    *)
++       AC_MSG_ERROR([Unknown system initscript flavor $with_sysinit])
++    ;;
++esac
++if test "x$with_sysinit" = "xcheck" ; then
++  with_sysinit=none
++fi
++
++AM_CONDITIONAL([NETCF_USE_INITSCRIPTS], test "$with_sysinit" = "initscripts")
++AM_CONDITIONAL([NETCF_USE_SYSTEMD], test "$with_sysinit" = "systemd")
++AM_CONDITIONAL([NETCF_TRANSACTION_SUPPORT], "$with_sysinit" != "none")
++AC_MSG_RESULT($with_sysinit)
++if test "$with_sysinit" != "none" && test "$with_driver" != "redhat"; then
++  AC_MSG_ERROR([netcf does not have support for $with_sysinit combined with the $with_driver driver])
++fi
+ 
+ AC_ARG_WITH([libnl1],
+             AS_HELP_STRING([--with-libnl1], [Force usage of libnl1 @<:@default=no@:>@]),
+diff --git a/netcf.spec.in b/netcf.spec.in
+index d243f1c..6ab3ee5 100644
+--- a/netcf.spec.in
++++ b/netcf.spec.in
+@@ -9,6 +9,22 @@ URL:            https://fedorahosted.org/netcf/
+ Source0:        https://fedorahosted.org/released/%{name}/%{name}-%{version}.tar.gz
+ BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+ 
++# Fedora 20 / RHEL-7 are where netcf first uses systemd. Although earlier
++# Fedora has systemd, netcf still used sysvinit there.
++%if 0%{?fedora} >= 20 || 0%{?rhel} >= 7
++    %define with_systemd 1
++%else
++    %define with_systemd 0
++%endif
++
++%if %{with_systemd}
++BuildRequires: systemd-units
++Requires(post): systemd-units
++Requires(post): systemd-sysv
++Requires(preun): systemd-units
++Requires(postun): systemd-units
++%endif
++
+ BuildRequires:  readline-devel augeas-devel >= 0.5.2
+ BuildRequires:  libxml2-devel libxslt-devel
+ 
+@@ -60,22 +76,53 @@ The libraries for %{name}.
+ %if %{with_libnl1}
+ %define _with_libnl1 --with-libnl1
+ %endif
++%if %{with_systemd}
++    %define sysinit --with-sysinit=systemd
++%else
++    %define sysinit --with-sysinit=initscripts
++%endif
++
+ 
+ %configure --disable-static \
+-           %{?_with_libnl1}
++           %{?_with_libnl1} \
++           %{sysinit}
+ make %{?_smp_mflags}
+ 
+ %install
+ rm -rf $RPM_BUILD_ROOT
+-make install DESTDIR=$RPM_BUILD_ROOT INSTALL="%{__install} -p"
++make install DESTDIR=$RPM_BUILD_ROOT SYSTEMD_UNIT_DIR=%{_unitdir} \
++     INSTALL="%{__install} -p"
+ find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
+ 
+ %clean
+ rm -rf $RPM_BUILD_ROOT
+ 
+-%post libs -p /sbin/ldconfig
++%preun libs
+ 
+-%postun libs -p /sbin/ldconfig
++%if %{with_systemd}
++    %systemd_preun netcf-transaction.service
++%else
++if [ $1 = 0 ]; then
++    /sbin/chkconfig --del netcf-transaction
++fi
++%endif
++
++%post libs
++
++/sbin/ldconfig
++%if %{with_systemd}
++    %systemd_post netcf-transaction.service
++    /bin/systemctl --no-reload enable netcf-transaction.service >/dev/null 2>&1 || :
++%else
++/sbin/chkconfig --add netcf-transaction
++%endif
++
++%postun libs
++
++/sbin/ldconfig
++%if %{with_systemd}
++    %systemd_postun netcf-transaction.service
++%endif
+ 
+ %files
+ %defattr(-,root,root,-)
+@@ -86,7 +133,12 @@ rm -rf $RPM_BUILD_ROOT
+ %defattr(-,root,root,-)
+ %{_datadir}/netcf
+ %{_libdir}/*.so.*
++%if %{with_systemd}
++%{_unitdir}/netcf-transaction.service
++%else
+ %{_sysconfdir}/rc.d/init.d/netcf-transaction
++%endif
++%attr(0755, root, root) %{_libexecdir}/netcf-transaction.sh
+ %doc AUTHORS COPYING NEWS
+ 
+ %files devel
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 9963402..2f76614 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -16,7 +16,9 @@ include_HEADERS = netcf.h
+ lib_LTLIBRARIES = libnetcf.la
+ 
+ bin_PROGRAMS = ncftool
+-
++if NETCF_TRANSACTION_SUPPORT
++libexec_SCRIPTS = netcf-transaction.sh
++endif
+ if ! NETCF_DRIVER_MSWINDOWS
+ noinst_PROGRAMS = ncftransform
+ endif
+@@ -31,7 +33,6 @@ DRIVER_SOURCES_SUSE = drv_suse.c
+ 
+ EXTRA_DIST = netcf_public.syms \
+ 	netcf_private.syms \
+-	netcf-transaction.init.sh \
+ 	$(DRIVER_SOURCES_COMMON) \
+ 	$(DRIVER_SOURCES_POSIX) \
+ 	$(DRIVER_SOURCES_LINUX) \
+@@ -112,35 +113,78 @@ internal.h: datadir.h
+ datadir.h: $(top_builddir)/config.status
+ 	echo '#define NETCF_DATADIR "$(datadir)"' > datadir.h
+ 
+-install-data-local: install-init
++EXTRA_DIST += netcf-transaction.sh.in \
++	      netcf-transaction.init.in \
++	      netcf-transaction.service.in
++
++if NETCF_DRIVER_REDHAT
++
++install-data-local: install-sysinit
++
++uninstall-local: uninstall-sysinit
++
++# This is for the shell script that handles network config change
++# transactions. It is used by both the initscripts and systemd
++# flavors, as well as by libnetcf.so itself
++netcf-transaction.sh: netcf-transaction.sh.in $(top_builddir)/config.status
++	$(AM_V_GEN)sed					\
++	    -e 's![@]localstatedir[@]!$(localstatedir)!g'	\
++	    -e 's![@]sysconfdir[@]!$(sysconfdir)!g'	\
++	    < $< > $@-t &&				\
++	    chmod a+x $@-t &&				\
++	    mv $@-t $@
+ 
+-uninstall-local: uninstall-init
++BUILT_SOURCES += netcf-transaction.sh
+ 
+-if NETCF_INIT_SCRIPT_RED_HAT
+-# This is for the initscript that handles network config change
+-# transactions.
+-install-init: netcf-transaction.init
+-	mkdir -p $(DESTDIR)$(sysconfdir)/rc.d/init.d
++if NETCF_USE_INITSCRIPTS
++install-sysinit: netcf-transaction.init
++	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/rc.d/init.d
+ 	$(INSTALL_SCRIPT) netcf-transaction.init \
+ 	  $(DESTDIR)$(sysconfdir)/rc.d/init.d/netcf-transaction
+ 
+-uninstall-init:
++uninstall-sysinit:
+ 	rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/netcf-transaction \
+ 	  $(DESTDIR)$(sysconfdir)/sysconfig/netcf-transaction
+ 
++netcf-transaction.init: netcf-transaction.init.in \
++                        $(top_builddir)/config.status
++	$(AM_V_GEN)sed \
++		-e 's![@]localstatedir[@]!$(localstatedir)!g' \
++		-e 's|[@]libexecdir[@]|$(libexecdir)|g'     \
++	< $< > $@-t &&                                      \
++	chmod a+x $@-t &&                                   \
++	mv $@-t $@
++
+ BUILT_SOURCES += netcf-transaction.init
+ 
+-netcf-transaction.init: netcf-transaction.init.sh $(top_builddir)/config.status
+-	$(AM_V_GEN)sed					\
+-	    -e 's!\@localstatedir\@!$(localstatedir)!g'	\
+-	    -e 's!\@sysconfdir\@!$(sysconfdir)!g'	\
+-	    < $< > $@-t &&				\
+-	    chmod a+x $@-t &&				\
++else ! NETCF_USE_INITSCRIPTS
++
++if NETCF_USE_SYSTEMD
++SYSTEMD_UNIT_DIR = $(prefix)/lib/systemd/system
++
++install-sysinit: netcf-transaction.service
++	$(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
++	$(INSTALL_DATA) netcf-transaction.service \
++	  $(DESTDIR)$(SYSTEMD_UNIT_DIR)/netcf-transaction.service
++
++uninstall-sysinit:
++	rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/netcf-transaction.service
++	rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) ||:
++
++netcf-transaction.service: netcf-transaction.service.in \
++                           $(top_builddir)/config.status
++	$(AM_V_GEN)sed						\
++	    -e 's|[@]libexecdir[@]|$(libexecdir)|g'		\
++	    < $< > $@-t &&					\
+ 	    mv $@-t $@
+-else
+-install-init:
+-uninstall-init:
+-netcf-transaction.init:
+-endif # NETCF_INIT_SCRIPT_RED_HAT
++
++BUILT_SOURCES += netcf-transaction.service
++
++else ! NETCF_USE_SYSTEMD
++install-sysinit:
++uninstall-sysinit:
++endif ! NETCF_USE_SYSTEMD
++endif ! NETCF_USE_INITSCRIPTS
++endif NETCF_DRIVER_REDHAT
+ 
+ DISTCLEANFILES += $(BUILT_SOURCES)
+diff --git a/src/netcf-transaction.init.in b/src/netcf-transaction.init.in
+new file mode 100644
+index 0000000..36beb53
+--- /dev/null
++++ b/src/netcf-transaction.init.in
+@@ -0,0 +1,31 @@
++#!/bin/sh
++
++# the following is the LSB init header
++#
++### BEGIN INIT INFO
++# Provides: netcf-transaction
++# Required-Start: $local_fs
++# Default-Start: 2 3 4 5
++# Short-Description: save/restore network configuration files
++# Description: This script can save the current state of network config,
++#              and later revert to that config, or commit the new config
++#              (by deleting the snapshot). At boot time, if there are
++#              uncommitted changes to the network config, they are
++#              reverted (and the discarded changes are archived in
++#              @localstatedir@/lib/netcf/network-rollback-*).
++#
++### END INIT INFO
++
++# the following is chkconfig init header
++#
++# netcf-transaction: save/restore current network interface configuration
++#
++# chkconfig:   - 09 91
++# description: This script can save the current state of network config, \
++#              and later revert to that config, or commit the new config \
++#              (by deleting the snapshot). At boot time, if there are \
++#              uncommitted changes to the network config, they are \
++#              reverted (and the discarded changes are archived in \
++#              @localstatedir@/lib/netcf/network-rollback-*).
++
++exec @libexecdir@/netcf-transaction.sh "$@"
+diff --git a/src/netcf-transaction.service.in b/src/netcf-transaction.service.in
+new file mode 100644
+index 0000000..6e17627
+--- /dev/null
++++ b/src/netcf-transaction.service.in
+@@ -0,0 +1,15 @@
++[Unit]
++Description=Rollback uncommitted netcf network config change transactions
++Before=network.target
++Before=NetworkManager.service
++
++[Service]
++# call common script that is also used by initscript-based service
++# and libnetcf.so
++ExecStart=@libexecdir@/netcf-transaction.sh start
++Type=oneshot
++RemainAfterExit=yes
++StandardOutput=journal+console
++
++[Install]
++WantedBy=multi-user.target
+diff --git a/src/netcf-transaction.init.sh b/src/netcf-transaction.sh.in
+old mode 100755
+new mode 100644
+similarity index 88%
+rename from src/netcf-transaction.init.sh
+rename to src/netcf-transaction.sh.in
+index 1465b8a..c9aafdf
+--- a/src/netcf-transaction.init.sh
++++ b/src/netcf-transaction.sh.in
+@@ -1,27 +1,29 @@
+ #!/bin/sh
+ #
+-# netcf-transaction: save/restore current network interface configuration
++# netcf-transaction.sh: save/restore current network interface configuration
++#
++# Copyright (C) 2011, 2014 Red Hat, Inc.
++#
++# This library is free software; you can redistribute it and/or
++# modify it under the terms of the GNU Lesser General Public
++# License as published by the Free Software Foundation; either
++# version 2.1 of the License, or (at your option) any later version.
++#
++# This library is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++# Lesser General Public License for more details.
++#
++# You should have received a copy of the GNU Lesser General Public
++# License along with this library.  If not, see
++# <http://www.gnu.org/licenses/>.
+ #
+-# chkconfig:   - 09 91
+-# description: This script can save the current state of network config, \
+-#              and later revert to that config, or commit the new config \
+-#              (by deleting the snapshot). At boot time, if there are \
+-#              uncommitted changes to the network config, they are \
+-#              reverted (and the discarded changes are archived in \
+-#              /var/lib/netcf/network-rollback-*).
+-
+-### BEGIN INIT INFO
+-# Provides: netcf-transaction
+-# Required-Start: $local_fs
+-# Short-Description: save/restore network configuration files
+ # Description: This script can save the current state of network config,
+ #              and later revert to that config, or commit the new config
+ #              (by deleting the snapshot). At boot time, if there are
+ #              uncommitted changes to the network config, they are
+ #              reverted (and the discarded changes are archived in
+-#              /var/lib/netcf/network-rollback-*).
+-#
+-### END INIT INFO
++#              @localstatedir@/lib/netcf/network-rollback-*).
+ 
+ # special exit code that means a command was issued that is invalid for the
+ # current state (e.g. change-begin when there is already an open transaction)
+-- 
+1.8.3.1
+
diff --git a/SOURCES/netcf-transform-STP-value-from-yes-no-to-on-off-in-redhat-.patch b/SOURCES/netcf-transform-STP-value-from-yes-no-to-on-off-in-redhat-.patch
new file mode 100644
index 0000000..f03cbc1
--- /dev/null
+++ b/SOURCES/netcf-transform-STP-value-from-yes-no-to-on-off-in-redhat-.patch
@@ -0,0 +1,54 @@
+From c0f9207b474ffa4c68151f6351434da51c49cb84 Mon Sep 17 00:00:00 2001
+From: Martin Wilck <martin.wilck@ts.fujitsu.com>
+Date: Mon, 18 Nov 2013 12:35:15 +0100
+Subject: [PATCH] transform STP value from "yes/no" to "on/off" in
+ redhat-put.xsl
+
+https://bugzilla.redhat.com/show_bug.cgi?id=1060076
+https://bugzilla.redhat.com/show_bug.cgi?id=1031053
+
+Some tools (e.g. NetworkManager) use "yes"/"no" in config files
+rather than "on/off". netcf needs to transform this in order to conform
+with the schema.
+
+(cherry picked from commit 048d13afcc91f4a16a80012aa34b9a024d95368e)
+---
+ AUTHORS                 |  1 +
+ data/xml/redhat-put.xsl | 12 +++++++++++-
+ 2 files changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/AUTHORS b/AUTHORS
+index 2512ac8..f38e939 100644
+--- a/AUTHORS
++++ b/AUTHORS
+@@ -20,3 +20,4 @@ Contributions by:
+   Ed Maste         <emaste@freebsd.org>
+   Hendrik Schwartke <hendrik@os-t.de>
+   Satoru SATOH     <ssato@redhat.com>
++  Martin Wilck     <martin.wilck@ts.fujitsu.com>
+diff --git a/data/xml/redhat-put.xsl b/data/xml/redhat-put.xsl
+index 267d9cd..88e6d73 100644
+--- a/data/xml/redhat-put.xsl
++++ b/data/xml/redhat-put.xsl
+@@ -77,7 +77,17 @@
+       <xsl:call-template name="interface-addressing"/>
+       <bridge>
+         <xsl:if test="node[@label = 'STP']">
+-          <xsl:attribute name="stp"><xsl:value-of select="node[@label = 'STP']/@value"/></xsl:attribute>
++          <xsl:choose>
++            <xsl:when test="node[@label = 'STP']/@value = 'yes'">
++              <xsl:attribute name="stp">on</xsl:attribute>
++            </xsl:when>
++            <xsl:when test="node[@label = 'STP']/@value = 'no'">
++              <xsl:attribute name="stp">off</xsl:attribute>
++            </xsl:when>
++            <xsl:otherwise>
++              <xsl:attribute name="stp"><xsl:value-of select="node[@label = 'STP']/@value"/></xsl:attribute>
++            </xsl:otherwise>
++          </xsl:choose>
+         </xsl:if>
+         <xsl:if test="node[@label = 'DELAY']">
+           <xsl:attribute name="delay"><xsl:value-of select="node[@label = 'DELAY']/@value"/></xsl:attribute>
+-- 
+1.8.3.1
+
diff --git a/SOURCES/netcf-wait-for-IFF_UP-and-IFF_RUNNING-after-calling-ifup.patch b/SOURCES/netcf-wait-for-IFF_UP-and-IFF_RUNNING-after-calling-ifup.patch
new file mode 100644
index 0000000..980ca0c
--- /dev/null
+++ b/SOURCES/netcf-wait-for-IFF_UP-and-IFF_RUNNING-after-calling-ifup.patch
@@ -0,0 +1,152 @@
+From 04df67ae69d98b0f77f94bf5f7c1514907dd003a Mon Sep 17 00:00:00 2001
+From: Laine Stump <laine@laine.org>
+Date: Wed, 15 May 2013 14:13:09 -0400
+Subject: [PATCH] wait for IFF_UP and IFF_RUNNING after calling ifup
+
+This fixes https://bugzilla.redhat.com/show_bug.cgi?id=961184
+
+Apparently one or the other of IFF_UP and IFF_RUNNING are not always
+set by the time /sbin/ifup returns control to netcf, so the subsequent
+check to verify that the interface is up may fail. This patch adds a
+loop to re-check the status of the interface every 250msec for up to
+2.5 seconds (or until both flags are set). If timeout is reached, it
+still fails the operation.
+
+(cherry picked from commit 14af66fa2b119f47a23c9a4043ae8fe2441379fc)
+---
+ bootstrap.conf   |  3 ++-
+ src/drv_debian.c | 13 ++++++++++---
+ src/drv_redhat.c | 11 +++++++++--
+ src/drv_suse.c   | 13 ++++++++++---
+ 4 files changed, 31 insertions(+), 9 deletions(-)
+
+diff --git a/bootstrap.conf b/bootstrap.conf
+index fd1c8f7..4736009 100644
+--- a/bootstrap.conf
++++ b/bootstrap.conf
+@@ -1,6 +1,6 @@
+ # Bootstrap configuration.
+ 
+-# Copyright (C) 2010-2012 Red Hat, Inc.
++# Copyright (C) 2010-2013 Red Hat, Inc.
+ 
+ # This library is free software; you can redistribute it and/or
+ # modify it under the terms of the GNU Lesser General Public
+@@ -43,6 +43,7 @@ sys_ioctl
+ sys_socket
+ sys_wait
+ unistd
++usleep
+ vasprintf
+ waitpid
+ warnings
+diff --git a/src/drv_debian.c b/src/drv_debian.c
+index ceeed94..d762a5d 100644
+--- a/src/drv_debian.c
++++ b/src/drv_debian.c
+@@ -1,7 +1,7 @@
+ /*
+- * drv_initscripts.c: the initscripts backend for netcf
++ * drv_debian.c: the debian backend for netcf
+  *
+- * Copyright (C) 2009-2012 Red Hat Inc.
++ * Copyright (C) 2009-2013 Red Hat Inc.
+  *
+  * This library is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Lesser General Public
+@@ -1056,10 +1056,17 @@ int drv_if_up(struct netcf_if *nif) {
+     static const char *const ifup = IFUP;
+     struct netcf *ncf = nif->ncf;
+     int result = -1;
++    int is_active, retries;
+ 
+     run1(ncf, ifup, nif->name);
+     ERR_BAIL(ncf);
+-    ERR_THROW(!if_is_active(ncf, nif->name), ncf, EOTHER,
++
++    for (retries = 0; retries < 10; retries++) {
++        if ((is_active = if_is_active(ncf, nif->name)))
++            break;
++        usleep(250000);
++    }
++    ERR_THROW(!is_active, ncf, EOTHER,
+               "interface %s failed to become active - "
+               "possible disconnected cable.", nif->name);
+     result = 0;
+diff --git a/src/drv_redhat.c b/src/drv_redhat.c
+index 4040f5e..b5b8694 100644
+--- a/src/drv_redhat.c
++++ b/src/drv_redhat.c
+@@ -1,7 +1,7 @@
+ /*
+  * drv_redhat.c: the Red Hat distro family backend for netcf
+  *
+- * Copyright (C) 2009-2012 Red Hat Inc.
++ * Copyright (C) 2009-2013 Red Hat Inc.
+  *
+  * This library is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Lesser General Public
+@@ -1021,6 +1021,7 @@ int drv_if_up(struct netcf_if *nif) {
+     char **slaves = NULL;
+     int nslaves = 0;
+     int result = -1;
++    int is_active, retries;
+ 
+     if (is_bridge(ncf, nif->name)) {
+         /* Bring up bridge slaves before the bridge */
+@@ -1034,7 +1035,13 @@ int drv_if_up(struct netcf_if *nif) {
+     }
+     run1(ncf, ifup, nif->name);
+     ERR_BAIL(ncf);
+-    ERR_THROW(!if_is_active(ncf, nif->name), ncf, EOTHER,
++
++    for (retries = 0; retries < 10; retries++) {
++        if ((is_active = if_is_active(ncf, nif->name)))
++            break;
++        usleep(250000);
++    }
++    ERR_THROW(!is_active, ncf, EOTHER,
+               "interface %s failed to become active - "
+               "possible disconnected cable.", nif->name);
+     result = 0;
+diff --git a/src/drv_suse.c b/src/drv_suse.c
+index 0d4a0af..e59d7d3 100644
+--- a/src/drv_suse.c
++++ b/src/drv_suse.c
+@@ -1,8 +1,8 @@
+ /*
+- * drv_suse.c: the suse backend for suse
++ * drv_suse.c: the suse backend for netcf
+  *
+  * Copyright (C) 2010 Novell Inc.
+- * Copyright (C) 2009-2012 Red Hat Inc.
++ * Copyright (C) 2009-2013 Red Hat Inc.
+  *
+  * This library is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Lesser General Public
+@@ -1164,6 +1164,7 @@ int drv_if_up(struct netcf_if *nif) {
+     char **slaves = NULL;
+     int nslaves = 0;
+     int result = -1;
++    int is_active, retries;
+ 
+     if (is_bridge(ncf, nif->name)) {
+         /* Bring up bridge slaves before the bridge */
+@@ -1177,7 +1178,13 @@ int drv_if_up(struct netcf_if *nif) {
+     }
+     run1(ncf, ifup, nif->name);
+     ERR_BAIL(ncf);
+-    ERR_THROW(!if_is_active(ncf, nif->name), ncf, EOTHER,
++
++    for (retries = 0; retries < 10; retries++) {
++        if ((is_active = if_is_active(ncf, nif->name)))
++            break;
++        usleep(250000);
++    }
++    ERR_THROW(!is_active, ncf, EOTHER,
+               "interface %s failed to become active - "
+               "possible disconnected cable.", nif->name);
+     result = 0;
+-- 
+1.8.3.1
+
diff --git a/SPECS/netcf.spec b/SPECS/netcf.spec
index a7f02a7..83835f9 100644
--- a/SPECS/netcf.spec
+++ b/SPECS/netcf.spec
@@ -1,6 +1,6 @@
 Name:           netcf
 Version:        0.2.3
-Release:        4%{?dist}%{?extra_release}
+Release:        8%{?dist}%{?extra_release}
 Summary:        Cross-platform network configuration library
 
 Group:          System Environment/Libraries
@@ -9,6 +9,45 @@ URL:            https://fedorahosted.org/netcf/
 Source0:        https://fedorahosted.org/released/%{name}/%{name}-%{version}.tar.gz
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
+# Patches
+Patch1: netcf-wait-for-IFF_UP-and-IFF_RUNNING-after-calling-ifup.patch
+Patch2: netcf-remove-extraneous-quotes-from-BONDING_OPTS.patch
+Patch3: netcf-eliminate-use-of-uninitialized-data-when-getting-mac.patch
+Patch4: netcf-support-systemd-based-netcf-transaction.patch
+Patch5: netcf-fix-autogen-build-error.patch
+Patch6: netcf-transform-STP-value-from-yes-no-to-on-off-in-redhat-.patch
+Patch7: netcf-Require-bridge-utils-for-netcf-libs-in-the-specfile.patch
+
+# Default to skipping autoreconf.  Distros can change just this one
+# line (or provide a command-line override) if they backport any
+# patches that touch configure.ac or Makefile.am.
+# THIS HAS BEEN ENABLED FOR RHEL7.0 because Patch4 modifies configure.ac
+# and src/Makefile.am.
+%{!?enable_autotools:%define enable_autotools 1}
+
+# Fedora 20 / RHEL-7 are where netcf first uses systemd. Although earlier
+# Fedora has systemd, netcf still used sysvinit there.
+%if 0%{?fedora} >= 20 || 0%{?rhel} >= 7
+    %define with_systemd 1
+%else
+    %define with_systemd 0
+%endif
+
+%if %{with_systemd}
+BuildRequires: systemd-units
+Requires(post): systemd-units
+Requires(post): systemd-sysv
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+%endif
+%if 0%{?enable_autotools}
+BuildRequires: autoconf
+BuildRequires: automake
+BuildRequires: gettext-devel
+BuildRequires: libtool
+BuildRequires: /usr/bin/pod2man
+%endif
+
 BuildRequires:  readline-devel augeas-devel >= 0.5.2
 BuildRequires:  libxml2-devel libxslt-devel
 
@@ -50,32 +89,78 @@ developing applications that use %{name}.
 Summary:        Libraries for %{name}
 Group:          System Environment/Libraries
 
+# bridge-utils is needed because /sbin/ifup calls brctl
+# if you create a bridge device
+Requires:       bridge-utils
+
 %description    libs
 The libraries for %{name}.
 
 %prep
 %setup -q
 
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+
 %build
 %if %{with_libnl1}
 %define _with_libnl1 --with-libnl1
 %endif
+%if %{with_systemd}
+    %define sysinit --with-sysinit=systemd
+%else
+    %define sysinit --with-sysinit=initscripts
+%endif
+
+%if 0%{?enable_autotools}
+ autoreconf -if
+%endif
 
 %configure --disable-static \
-           %{?_with_libnl1}
+           %{?_with_libnl1} \
+           %{sysinit}
 make %{?_smp_mflags}
 
 %install
 rm -rf $RPM_BUILD_ROOT
-make install DESTDIR=$RPM_BUILD_ROOT INSTALL="%{__install} -p"
+make install DESTDIR=$RPM_BUILD_ROOT SYSTEMD_UNIT_DIR=%{_unitdir} \
+     INSTALL="%{__install} -p"
 find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-%post libs -p /sbin/ldconfig
+%preun libs
 
-%postun libs -p /sbin/ldconfig
+%if %{with_systemd}
+    %systemd_preun netcf-transaction.service
+%else
+if [ $1 = 0 ]; then
+    /sbin/chkconfig --del netcf-transaction
+fi
+%endif
+
+%post libs
+
+/sbin/ldconfig
+%if %{with_systemd}
+    %systemd_post netcf-transaction.service
+    /bin/systemctl --no-reload enable netcf-transaction.service >/dev/null 2>&1 || :
+%else
+/sbin/chkconfig --add netcf-transaction
+%endif
+
+%postun libs
+
+/sbin/ldconfig
+%if %{with_systemd}
+    %systemd_postun netcf-transaction.service
+%endif
 
 %files
 %defattr(-,root,root,-)
@@ -86,7 +171,12 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(-,root,root,-)
 %{_datadir}/netcf
 %{_libdir}/*.so.*
+%if %{with_systemd}
+%{_unitdir}/netcf-transaction.service
+%else
 %{_sysconfdir}/rc.d/init.d/netcf-transaction
+%endif
+%attr(0755, root, root) %{_libexecdir}/netcf-transaction.sh
 %doc AUTHORS COPYING NEWS
 
 %files devel
@@ -97,6 +187,28 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/pkgconfig/netcf.pc
 
 %changelog
+* Tue Feb 11 2014 Laine Stump <laine@redhat.com> - 0.2.3-8
+- resolves rhbz 1060076
+- Transform STP value from yes/no to on/off
+- resolves rhbz 1060317
+- Require bridge-utils for netcf-libs in the specfile
+
+* Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 0.2.3-7
+- Mass rebuild 2014-01-24
+
+* Wed Jan 22 2014 Laine Stump <laine@redhat.com> - 0.2.3-6
+- resolves rhbz#961184
+- wait for IFF_UP and IFF_RUNNING after calling ifup
+- resolves rhbz#1020204
+- remove extraneous quotes from BONDING_OPTS
+- resolves rhbz#1044681
+- eliminate use of uninitialized data when getting mac
+- resolves rhbz#1046594
+- support systemd based netcf transaction
+
+* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 0.2.3-5
+- Mass rebuild 2013-12-27
+
 * Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.3-4
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild