Submitted By: Ken Moffat <ken at linuxfromscratch dot org>
Date: 2012-01-10
Initial Package Version: 0.8.998
Upstream Status: Not submitted
Origin: Wayne Blaszcz
Description: Since Wayne hasn't committed this himself, I've
added his details to the NetworkManagerLFS.c file because he
altered the nm_system_update_dns function to be more appropriate
(we probably don't run nscd, but we might).

diff -Naur NetworkManager-0.9.2.0.orig/config.h.in NetworkManager-0.9.2.0/config.h.in
--- NetworkManager-0.9.2.0.orig/config.h.in	2011-11-09 18:24:06.000000000 +0000
+++ NetworkManager-0.9.2.0/config.h.in	2012-01-10 01:35:47.328158952 +0000
@@ -174,6 +174,9 @@
 /* Define if you have Gentoo */
 #undef TARGET_GENTOO
 
+/* Define if you have LFS */
+#undef TARGET_LFS
+
 /* Define if you have linexa */
 #undef TARGET_LINEXA
 
diff -Naur NetworkManager-0.9.2.0.orig/configure NetworkManager-0.9.2.0/configure
--- NetworkManager-0.9.2.0.orig/configure	2011-11-09 18:23:46.000000000 +0000
+++ NetworkManager-0.9.2.0/configure	2012-01-10 01:35:47.336158728 +0000
@@ -713,6 +713,8 @@
 PKG_CONFIG
 LIBDL
 LIBM
+TARGET_LFS_FALSE
+TARGET_LFS_TRUE
 TARGET_EXHERBO_FALSE
 TARGET_EXHERBO_TRUE
 TARGET_LINEXA_FALSE
@@ -1661,7 +1663,7 @@
   --with-docs             Build NetworkManager documentation
   --with-distro=DISTRO    Specify the Linux distribution to target: One of
                           redhat, suse, gentoo, debian, arch, slackware,
-                          paldo, mandriva, pardus, linexa or exherbo
+                          paldo, mandriva, pardus, linexa, exherbo or lfs
   --with-dist-version=<NM-distribution-version>
                           Define the NM's distribution version string
   --with-udev-dir=DIR     where the udev base directory is
@@ -19562,6 +19564,25 @@
   with_distro="exherbo"
 fi
 
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /etc/lfs-release" >&5
+$as_echo_n "checking for /etc/lfs-release... " >&6; }
+if test "${ac_cv_file__etc_lfs_release+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  test "$cross_compiling" = yes &&
+  as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
+if test -r "/etc/lfs-release"; then
+  ac_cv_file__etc_lfs_release=yes
+else
+  ac_cv_file__etc_lfs_release=no
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__etc_lfs_release" >&5
+$as_echo "$ac_cv_file__etc_lfs_release" >&6; }
+if test "x$ac_cv_file__etc_lfs_release" = x""yes; then :
+  with_distro="lfs"
+fi
+
 	if test "z$with_distro" = "z"; then
 		with_distro=`lsb_release -is`
 	fi
@@ -19573,7 +19594,7 @@
 	exit 1
 else
 	case $with_distro in
-		redhat|suse|gentoo|debian|slackware|arch|paldo|frugalware|mandriva|pardus|linexa|exherbo) ;;
+		redhat|suse|gentoo|debian|slackware|arch|paldo|frugalware|mandriva|pardus|linexa|exherbo|lfs) ;;
 		*)
 			echo "Your distribution (${with_distro}) is not yet supported!  (patches welcome)"
 			exit 1
@@ -19749,6 +19770,20 @@
 
 fi
 
+ if test x"$with_distro" = xlfs; then
+  TARGET_LFS_TRUE=
+  TARGET_LFS_FALSE='#'
+else
+  TARGET_LFS_TRUE='#'
+  TARGET_LFS_FALSE=
+fi
+
+if test x"$with_distro" = xlfs; then
+
+$as_echo "#define TARGET_LFS 1" >>confdefs.h
+
+fi
+
 
 # Check whether --with-dist-version was given.
 if test "${with_dist_version+set}" = set; then :
@@ -22823,6 +22858,10 @@
   as_fn_error $? "conditional \"TARGET_EXHERBO\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${TARGET_LFS_TRUE}" && test -z "${TARGET_LFS_FALSE}"; then
+  as_fn_error $? "conditional \"TARGET_LFS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${HAVE_INTROSPECTION_TRUE}" && test -z "${HAVE_INTROSPECTION_FALSE}"; then
   as_fn_error $? "conditional \"HAVE_INTROSPECTION\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff -Naur NetworkManager-0.9.2.0.orig/configure.ac NetworkManager-0.9.2.0/configure.ac
--- NetworkManager-0.9.2.0.orig/configure.ac	2011-11-09 18:23:38.000000000 +0000
+++ NetworkManager-0.9.2.0/configure.ac	2012-01-10 01:35:47.348158245 +0000
@@ -107,7 +107,7 @@
 dnl
 AC_C_BIGENDIAN
 
-AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO], [Specify the Linux distribution to target: One of redhat, suse, gentoo, debian, arch, slackware, paldo, mandriva, pardus, linexa or exherbo]))
+AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO], [Specify the Linux distribution to target: One of redhat, suse, gentoo, debian, arch, slackware, paldo, mandriva, pardus, linexa, exherbo or lfs]))
 if test "z$with_distro" = "z"; then
 	AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat")
 	AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
@@ -121,6 +121,7 @@
 	AC_CHECK_FILE(/etc/pardus-release,with_distro="pardus")
 	AC_CHECK_FILE(/etc/linexa-release,with_distro="linexa")
 	AC_CHECK_FILE(/etc/exherbo-release,with_distro="exherbo")
+	AC_CHECK_FILE(/etc/lfs-release,with_distro="lfs")
 	if test "z$with_distro" = "z"; then
 		with_distro=`lsb_release -is`
 	fi
@@ -132,7 +133,7 @@
 	exit 1
 else
 	case $with_distro in
-		redhat|suse|gentoo|debian|slackware|arch|paldo|frugalware|mandriva|pardus|linexa|exherbo) ;;
+		redhat|suse|gentoo|debian|slackware|arch|paldo|frugalware|mandriva|pardus|linexa|exherbo|lfs) ;;
 		*)
 			echo "Your distribution (${with_distro}) is not yet supported!  (patches welcome)"
 			exit 1
@@ -200,6 +201,11 @@
   AC_DEFINE(TARGET_EXHERBO, 1, [Define if you have Exherbo])
 fi
 
+AM_CONDITIONAL(TARGET_LFS, test x"$with_distro" = xlfs)
+if test x"$with_distro" = xlfs; then
+  AC_DEFINE(TARGET_LFS, 1, [Define if you have LFS])
+fi
+
 dnl
 dnl Distribution version string
 dnl
diff -Naur NetworkManager-0.9.2.0.orig/src/backends/Makefile.am NetworkManager-0.9.2.0/src/backends/Makefile.am
--- NetworkManager-0.9.2.0.orig/src/backends/Makefile.am	2011-07-21 23:46:18.000000000 +0100
+++ NetworkManager-0.9.2.0/src/backends/Makefile.am	2012-01-10 01:35:47.348158245 +0000
@@ -61,6 +61,10 @@
 libnmbackend_la_SOURCES += NetworkManagerExherbo.c
 endif
 
+if TARGET_LFS
+libnmbackend_la_SOURCES += NetworkManagerLFS.c
+endif
+
 libnmbackend_la_LIBADD += \
 	$(top_builddir)/src/logging/libnm-logging.la \
 	$(LIBNL_LIBS) \
diff -Naur NetworkManager-0.9.2.0.orig/src/backends/Makefile.in NetworkManager-0.9.2.0/src/backends/Makefile.in
--- NetworkManager-0.9.2.0.orig/src/backends/Makefile.in	2011-11-09 18:23:52.000000000 +0000
+++ NetworkManager-0.9.2.0/src/backends/Makefile.in	2012-01-10 01:35:47.348158245 +0000
@@ -47,6 +47,7 @@
 @TARGET_PARDUS_TRUE@am__append_11 = NetworkManagerPardus.c
 @TARGET_LINEXA_TRUE@am__append_12 = NetworkManagerLinexa.c
 @TARGET_EXHERBO_TRUE@am__append_13 = NetworkManagerExherbo.c
+@TARGET_LFS_TRUE@am__append_14 = NetworkManagerLFS.c
 subdir = src/backends
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -80,7 +81,7 @@
 	NetworkManagerArch.c NetworkManagerPaldo.c \
 	NetworkManagerFrugalware.c NetworkManagerMandriva.c \
 	NetworkManagerPardus.c NetworkManagerLinexa.c \
-	NetworkManagerExherbo.c
+	NetworkManagerExherbo.c NetworkManagerLFS.c
 @TARGET_REDHAT_TRUE@am__objects_1 =  \
 @TARGET_REDHAT_TRUE@	libnmbackend_la-NetworkManagerRedHat.lo
 @TARGET_SUSE_TRUE@am__objects_2 =  \
@@ -102,11 +103,14 @@
 @TARGET_LINEXA_TRUE@	libnmbackend_la-NetworkManagerLinexa.lo
 @TARGET_EXHERBO_TRUE@am__objects_12 =  \
 @TARGET_EXHERBO_TRUE@	libnmbackend_la-NetworkManagerExherbo.lo
+@TARGET_LFS_TRUE@am__objects_13 =  \
+@TARGET_LFS_TRUE@	libnmbackend_la-NetworkManagerLFS.lo
 am_libnmbackend_la_OBJECTS = libnmbackend_la-NetworkManagerGeneric.lo \
 	$(am__objects_1) $(am__objects_2) $(am__objects_3) \
 	$(am__objects_4) $(am__objects_5) $(am__objects_6) \
 	$(am__objects_7) $(am__objects_8) $(am__objects_9) \
-	$(am__objects_10) $(am__objects_11) $(am__objects_12)
+	$(am__objects_10) $(am__objects_11) $(am__objects_12) \
+	$(am__objects_13)
 libnmbackend_la_OBJECTS = $(am_libnmbackend_la_OBJECTS)
 AM_V_lt = $(am__v_lt_$(V))
 am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
@@ -371,7 +375,7 @@
 	$(am__append_3) $(am__append_4) $(am__append_5) \
 	$(am__append_6) $(am__append_7) $(am__append_8) \
 	$(am__append_10) $(am__append_11) $(am__append_12) \
-	$(am__append_13)
+	$(am__append_13) $(am__append_14)
 libnmbackend_la_LIBADD = $(am__append_9) \
 	$(top_builddir)/src/logging/libnm-logging.la $(LIBNL_LIBS) \
 	$(DBUS_LIBS) $(GLIB_LIBS)
@@ -442,6 +446,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnmbackend_la-NetworkManagerFrugalware.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnmbackend_la-NetworkManagerGeneric.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnmbackend_la-NetworkManagerGentoo.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnmbackend_la-NetworkManagerLFS.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnmbackend_la-NetworkManagerLinexa.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnmbackend_la-NetworkManagerMandriva.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnmbackend_la-NetworkManagerPaldo.Plo@am__quote@
@@ -581,6 +586,14 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnmbackend_la-NetworkManagerExherbo.lo `test -f 'NetworkManagerExherbo.c' || echo '$(srcdir)/'`NetworkManagerExherbo.c
 
+libnmbackend_la-NetworkManagerLFS.lo: NetworkManagerLFS.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnmbackend_la-NetworkManagerLFS.lo -MD -MP -MF $(DEPDIR)/libnmbackend_la-NetworkManagerLFS.Tpo -c -o libnmbackend_la-NetworkManagerLFS.lo `test -f 'NetworkManagerLFS.c' || echo '$(srcdir)/'`NetworkManagerLFS.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/libnmbackend_la-NetworkManagerLFS.Tpo $(DEPDIR)/libnmbackend_la-NetworkManagerLFS.Plo
+@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='NetworkManagerLFS.c' object='libnmbackend_la-NetworkManagerLFS.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnmbackend_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnmbackend_la-NetworkManagerLFS.lo `test -f 'NetworkManagerLFS.c' || echo '$(srcdir)/'`NetworkManagerLFS.c
+
 mostlyclean-libtool:
 	-rm -f *.lo
 
diff -Naur NetworkManager-0.9.2.0.orig/src/backends/NetworkManagerLFS.c NetworkManager-0.9.2.0/src/backends/NetworkManagerLFS.c
--- NetworkManager-0.9.2.0.orig/src/backends/NetworkManagerLFS.c	1970-01-01 01:00:00.000000000 +0100
+++ NetworkManager-0.9.2.0/src/backends/NetworkManagerLFS.c	2012-01-10 01:45:49.507273651 +0000
@@ -0,0 +1,68 @@
+/* NetworkManager -- Network link manager
+ *
+ * Backend implementation for Beyond Linux From Scratch
+ * http://www.linuxfromscratch.org/blfs/
+ *
+ * Wayne Blaszczyk <wblaszcz@bigpond.net.au>
+ *
+ * Heavily based on NetworkManagerPaldo.c by Jürg Billeter <juerg@paldo.org>
+ *
+ * Heavily based on NetworkManagerRedhat.c by Dan Williams <dcbw@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * (C) Copyright 2004 Red Hat, Inc.
+ * (C) Copyright 2006 Jürg Billeter
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "NetworkManagerGeneric.h"
+#include "nm-system.h"
+#include "NetworkManagerUtils.h"
+#include "nm-logging.h"
+
+/*
+ * nm_system_enable_loopback
+ *
+ * Bring up the loopback interface
+ *
+ */
+void nm_system_enable_loopback (void)
+{
+       nm_spawn_process ("/etc/rc.d/init.d/localnet restart");
+}
+
+/*
+ * nm_system_update_dns
+ *
+ * Invalidate the nscd host cache, if it exists, since
+ * we changed resolv.conf.
+ *
+ */
+void nm_system_update_dns (void)
+{
+        if (g_file_test("/var/run/nscd/nscd.pid", G_FILE_TEST_EXISTS))
+               nm_log_info (LOGD_DNS, "Clearing nscd hosts cache.");
+               nm_spawn_process ("/usr/sbin/nscd -i hosts");
+}
+
+
