- from PLD with systemd stuff removed
authorMarcin Krol <hawk@tld-linux.org>
Fri, 26 Jan 2018 14:39:15 +0000 (14:39 +0000)
committerMarcin Krol <hawk@tld-linux.org>
Fri, 26 Jan 2018 14:39:15 +0000 (14:39 +0000)
netcf-pld_interfaces.patch [new file with mode: 0644]
netcf-systemd.patch [new file with mode: 0644]
netcf.spec [new file with mode: 0644]

diff --git a/netcf-pld_interfaces.patch b/netcf-pld_interfaces.patch
new file mode 100644 (file)
index 0000000..04bd4a0
--- /dev/null
@@ -0,0 +1,69 @@
+--- netcf-0.2.2/src/drv_redhat.c.orig  2012-08-01 05:12:43.000000000 +0200
++++ netcf-0.2.2/src/drv_redhat.c       2012-08-29 19:49:20.078576458 +0200
+@@ -52,14 +52,14 @@
+     "/files/etc/sysconfig/network-scripts";
+ static const char *const ifcfg_path =
+-    "/files/etc/sysconfig/network-scripts/*";
++    "/files/etc/sysconfig/interfaces/*";
+ /* Augeas should only load the files we are interested in */
+ static const struct augeas_pv augeas_xfm_common_pv[] = {
+     /* Ifcfg files */
+     { "/augeas/load/Ifcfg/lens", "Sysconfig.lns" },
+     { "/augeas/load/Ifcfg/incl",
+-      "/etc/sysconfig/network-scripts/ifcfg-*" },
++      "/etc/sysconfig/interfaces/ifcfg-*" },
+     { "/augeas/load/Ifcfg/excl[1]", "*~" },
+     { "/augeas/load/Ifcfg/excl[2]", "*.bak" },
+     { "/augeas/load/Ifcfg/excl[3]", "*.orig" },
+--- netcf-0.2.4/src/netcf-transaction.sh.in.orig       2011-05-20 20:40:22.000000000 +0200
++++ netcf-0.2.4/src/netcf-transaction.sh.in    2011-08-13 09:14:09.519761783 +0200
+@@ -30,13 +30,12 @@
+ sysconfdir="@sysconfdir@"
+ localstatedir="@localstatedir@"
+-netconfdir="$sysconfdir"/sysconfig/network-scripts
++netconfdir="$sysconfdir"/sysconfig/interfaces
+ snapshotdir="$localstatedir"/lib/netcf/network-snapshot
+ rollbackdirbase="$localstatedir"/lib/netcf/network-rollback
+ # Source function library.
+-test ! -r "$sysconfdir"/rc.d/init.d/functions ||
+-    . "$sysconfdir"/rc.d/init.d/functions
++. "$sysconfdir"/rc.d/init.d/functions
+ # take a snapshot of current network configuration scripts
+ change_begin ()
+@@ -195,8 +194,8 @@
+ # usage [val]
+ # Display usage string, then exit with VAL (defaults to 2).
+ usage() {
+-    echo $"Usage: $0 {change-begin|change-commit|change-rollback|snapshot-dir|start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
+-    exit ${1-2}
++    msg_usage "$0 {change-begin|change-commit|change-rollback|snapshot-dir|start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
++    exit ${1:-2}
+ }
+ # See how we were called.
+@@ -208,7 +207,7 @@
+ case "$1" in
+     # commands required in all Fedora initscripts
+     start|restart|reload|force-reload|condrestart|try-restart)
+-        echo -n $"Running $prog $1: "
++        nls "Forcing network configuration rollback"
+         change_rollback
+         # ignore the "no pending transaction" error
+         test "$retval" != "$EINVALID_IN_THIS_STATE" && retval=$?
+@@ -217,9 +216,9 @@
+     stop|status)
+         if test -d "$snapshotdir"
+         then
+-            echo $"There is an open transaction"
++            nls "There is an open transaction"
+         else
+-            echo $"No open transaction"
++            nls "No open transaction"
+         fi
+         ;;
diff --git a/netcf-systemd.patch b/netcf-systemd.patch
new file mode 100644 (file)
index 0000000..a7206f2
--- /dev/null
@@ -0,0 +1,108 @@
+--- netcf-0.2.4/configure.ac.orig      2014-05-14 12:01:08.000000000 +0200
++++ netcf-0.2.4/configure.ac   2014-05-24 07:27:55.530147003 +0200
+@@ -104,7 +104,7 @@
+ 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,
++    [Style of init script to install: initscripts, systemd, both,
+      check, none @<:@default=check@:>@])],
+   [],[with_sysinit=check])
+@@ -113,6 +113,8 @@
+        ;;
+     initscripts)
+        ;;
++    both)
++       ;;
+     none)
+        ;;
+     check)
+@@ -135,8 +137,8 @@
+   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_USE_INITSCRIPTS], test "$with_sysinit" = "initscripts" -o "$with_sysinit" = "both")
++AM_CONDITIONAL([NETCF_USE_SYSTEMD], test "$with_sysinit" = "systemd" -o "$with_sysinit" = "both")
+ AM_CONDITIONAL([NETCF_TRANSACTION_SUPPORT], test "$with_sysinit" != "none")
+ AC_MSG_RESULT($with_sysinit)
+ if test "$with_sysinit" != "none" && test "$with_driver" != "redhat"; then
+--- netcf-0.2.4/src/Makefile.am.orig   2014-05-09 13:37:17.000000000 +0200
++++ netcf-0.2.4/src/Makefile.am        2014-05-24 07:51:17.630117778 +0200
+@@ -119,10 +119,6 @@
+ 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
+@@ -136,13 +132,19 @@
+ BUILT_SOURCES += netcf-transaction.sh
++INSTALL_TARGETS =
++UNINSTALL_TARGETS =
++
+ if NETCF_USE_INITSCRIPTS
+-install-sysinit: netcf-transaction.init
++INSTALL_TARGETS += install-sysinit-init
++UNINSTALL_TARGETS += uninstall-sysinit-init
++
++install-sysinit-init: 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-sysinit:
++uninstall-sysinit-init:
+       rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/netcf-transaction \
+         $(DESTDIR)$(sysconfdir)/sysconfig/netcf-transaction
+@@ -157,17 +159,20 @@
+ BUILT_SOURCES += netcf-transaction.init
+-else ! NETCF_USE_INITSCRIPTS
++endif NETCF_USE_INITSCRIPTS
+ if NETCF_USE_SYSTEMD
++INSTALL_TARGETS += install-sysinit-systemd
++UNINSTALL_TARGETS += uninstall-sysinit-systemd
++
+ SYSTEMD_UNIT_DIR = $(prefix)/lib/systemd/system
+-install-sysinit: netcf-transaction.service
++install-sysinit-systemd: netcf-transaction.service
+       $(MKDIR_P) $(DESTDIR)$(SYSTEMD_UNIT_DIR)
+       $(INSTALL_DATA) netcf-transaction.service \
+         $(DESTDIR)$(SYSTEMD_UNIT_DIR)/netcf-transaction.service
+-uninstall-sysinit:
++uninstall-sysinit-systemd:
+       rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/netcf-transaction.service
+       rmdir $(DESTDIR)$(SYSTEMD_UNIT_DIR) ||:
+@@ -180,11 +185,12 @@
+ BUILT_SOURCES += netcf-transaction.service
+-else ! NETCF_USE_SYSTEMD
+-install-sysinit:
+-uninstall-sysinit:
+-endif ! NETCF_USE_SYSTEMD
+-endif ! NETCF_USE_INITSCRIPTS
++endif NETCF_USE_SYSTEMD
++
++install-data-local: $(INSTALL_TARGETS)
++
++uninstall-local: $(UNINSTALL_TARGETS)
++
+ endif NETCF_DRIVER_REDHAT
+ DISTCLEANFILES += $(BUILT_SOURCES)
diff --git a/netcf.spec b/netcf.spec
new file mode 100644 (file)
index 0000000..5369337
--- /dev/null
@@ -0,0 +1,126 @@
+# TODO: enhance pld_interfaces patch, including PLDifing netcf-transaction (or disabling it)
+#  maybe create drv_pld.c?
+Summary:       netcf - a cross-platform network configuration library
+Summary(pl.UTF-8):     netcf - wieloplatformowa biblioteka do konfiguracji sieci
+Name:          netcf
+Version:       0.2.8
+Release:       3
+License:       GPL v2
+Group:         Administration/System
+Source0:       http://releases.pagure.org/netcf/%{name}-%{version}.tar.gz
+# Source0-md5: 8edfc9a5856468ae4f8ee97415a3dbf3
+Patch0:                %{name}-pld_interfaces.patch
+Patch1:                %{name}-systemd.patch
+URL:           https://pagure.io/netcf/
+BuildRequires: autoconf >= 2.50
+BuildRequires: automake >= 1:1.11
+BuildRequires: augeas-devel >= 0.5.0
+BuildRequires: libnl-devel >= 3.2
+BuildRequires: libtool
+BuildRequires: libxml2-devel >= 2.0
+BuildRequires: libxslt-devel
+Requires:      augeas >= 0.5.0
+BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+netcf is a cross-platform network configuration library.
+
+%description -l pl.UTF-8
+netcf to wieloplatformowa biblioteka do konfiguracji sieci.
+
+%package libs
+Summary:       Netcf library
+Summary(pl.UTF-8):     Biblioteka netcf
+Group:         Libraries
+Requires:      augeas-libs >= 0.5.0
+
+%description libs
+This package contains the netcf shared library.
+
+%description libs -l pl.UTF-8
+Ten pakiet zawiera bibliotekę współdzieloną netcf.
+
+%package devel
+Summary:       Netcf development files
+Summary(pl.UTF-8):     Pliki programistyczne netcf
+Group:         Development/Libraries
+Requires:      %{name}-libs = %{version}-%{release}
+Requires:      augeas-devel >= 0.5.0
+Requires:      libxml2-devel >= 2.0
+Requires:      libxslt-devel
+
+%description devel
+This package contains the include files used to develop using netcf
+APIs.
+
+%description devel -l pl.UTF-8
+Ten pakiet zawiera pliki nagłówkow służące do programowania z użyciem
+API netcf.
+
+%package static
+Summary:       The netcf static library
+Summary(pl.UTF-8):     Statyczna biblioteka netcf
+Group:         Development/Libraries
+Requires:      %{name}-devel = %{version}-%{release}
+
+%description static
+This package contains the netcf static library.
+
+%description static -l pl.UTF-8
+Ten pakiet zawiera statyczną bibliotekę netcf.
+
+%prep
+%setup -q
+%patch0 -p1
+%patch1 -p1 -b .orig
+
+%build
+%{__libtoolize}
+%{__aclocal} -I gnulib/m4
+%{__autoconf}
+%{__autoheader}
+%{__automake}
+%configure \
+       --disable-silent-rules \
+       --with-driver=redhat \
+       --with-sysinit=both
+
+%{__make}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+%{__make} install \
+       DESTDIR=$RPM_BUILD_ROOT
+
+# obsoleted by pkg-config
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/libnetcf.la
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post  libs -p /sbin/ldconfig
+%postun        libs -p /sbin/ldconfig
+
+%files
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/ncftool
+%attr(754,root,root) /etc/rc.d/init.d/netcf-transaction
+%attr(754,root,root) %{_libexecdir}/netcf-transaction.sh
+%{_datadir}/netcf   
+%{_mandir}/man1/ncftool.1*
+
+%files libs
+%defattr(644,root,root,755)
+%doc AUTHORS NEWS README
+%attr(755,root,root) %{_libdir}/libnetcf.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libnetcf.so.1
+
+%files devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libnetcf.so
+%{_includedir}/netcf.h
+%{_pkgconfigdir}/netcf.pc
+
+%files static
+%defattr(644,root,root,755)
+%{_libdir}/libnetcf.a