From b37ed68e183d0b0a642ae96ab3cc21830819c5b3 Mon Sep 17 00:00:00 2001 From: Armin K Date: Mon, 2 Jul 2012 12:31:32 +0200 Subject: [PATCH] backends: add Linux From Scratch (LFS) support (bgo #679202) --- configure.ac | 10 +++++-- src/backends/Makefile.am | 4 +++ src/backends/NetworkManagerLFS.c | 50 ++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 src/backends/NetworkManagerLFS.c diff --git a/configure.ac b/configure.ac index ed491dea8..80389c781 100644 --- a/configure.ac +++ b/configure.ac @@ -107,7 +107,7 @@ dnl Make sha1.c happy on big endian systems 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 @@ if test "z$with_distro" = "z"; then 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 @@ if test "z$with_distro" = "z"; then exit 1 else case $with_distro in - redhat|suse|gentoo|debian|slackware|arch|paldo|frugalware|mandriva|pardus|linexa|exherbo|generic) ;; + redhat|suse|gentoo|debian|slackware|arch|paldo|frugalware|mandriva|pardus|linexa|exherbo|lfs|generic) ;; *) echo "Your distribution (${with_distro}) is not yet supported! (patches welcome)" exit 1 @@ -205,6 +206,11 @@ if test x"$with_distro" = xexherbo; then 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 Linux From Scratch]) +fi + dnl dnl Distribution version string dnl diff --git a/src/backends/Makefile.am b/src/backends/Makefile.am index 11a154a0d..647e5e5b3 100644 --- a/src/backends/Makefile.am +++ b/src/backends/Makefile.am @@ -64,6 +64,10 @@ if TARGET_EXHERBO 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 --git a/src/backends/NetworkManagerLFS.c b/src/backends/NetworkManagerLFS.c new file mode 100644 index 000000000..7df2031cf --- /dev/null +++ b/src/backends/NetworkManagerLFS.c @@ -0,0 +1,50 @@ +/* NetworkManager -- Network link manager + * + * Backend implementation for the Linux From Scratch http://www.linuxfromscratch.org/ + * + * Wayne Blaszczyk + * Armin K. + * + * Heavily based on NetworkManagerRedhat.c by Dan Williams + * + * 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 Tom Parker + * (C) Copyright 2004 Matthew Garrett + * (C) Copyright 2004 - 2012 Red Hat, Inc. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "NetworkManagerGeneric.h" +#include "NetworkManagerUtils.h" + +void nm_backend_enable_loopback (void) +{ + nm_generic_enable_loopback (); +} + +void nm_backend_update_dns (void) +{ + if (g_file_test("/var/run/nscd/nscd.pid", G_FILE_TEST_EXISTS)) + nm_spawn_process ("/usr/sbin/nscd -i hosts"); +} + +int nm_backend_ipv6_use_tempaddr (void) +{ + return nm_generic_ipv6_use_tempaddr (); +}