diff options
Diffstat (limited to 'meta-openembedded/meta-networking/recipes-support/nis')
8 files changed, 374 insertions, 0 deletions
diff --git a/meta-openembedded/meta-networking/recipes-support/nis/files/ypbind.init b/meta-openembedded/meta-networking/recipes-support/nis/files/ypbind.init new file mode 100644 index 0000000000..669c19ca08 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/nis/files/ypbind.init @@ -0,0 +1,107 @@ +#! /bin/sh +# Copyright (c) 2004 Author: Thorsten Kukuk <kukuk@suse.de> +# +# /etc/init.d/ypbind +# +# and symbolic its link +# +# /usr/sbin/rcypbind +# +# System startup script for the ypbind daemon +# +### BEGIN INIT INFO +# Provides: ypbind +# Required-Start: $remote_fs $portmap +# Should-Start: ypserv slpd +# Required-Stop: portmap +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Start ypbind (necessary for a NIS client) +# Description: ypbind finds the server for NIS domains and maintains +# the NIS binding information. +### END INIT INFO + +# Need to use status function +. /etc/init.d/functions + +YPBIND_BIN=/usr/sbin/ypbind +pidfile=/var/run/ypbind.pid +YPDOMAINNAME_bin=/usr/bin/ypdomainname + +[ -f /etc/default/ypbind ] && . /etc/default/ypbind + +case "$1" in + start) + echo -n "Starting ypbind" + ## If the domainname is not set, skip starting of ypbind + ## and return with "program not configured" + $YPDOMAINNAME_bin >/dev/null 2>&1 + if [ $? -ne 0 -o -z "`$YPDOMAINNAME_bin 2>/dev/null`" ]; then + if [ -f /etc/defaultdomain ]; then + XDOMAINNAME=`cat /etc/defaultdomain` + $YPDOMAINNAME_bin "$XDOMAINNAME" + fi + $YPDOMAINNAME_bin >/dev/null 2>&1 + if [ $? -ne 0 -o -z "`$YPDOMAINNAME_bin 2>/dev/null`" ]; then + # Tell the user this has skipped + echo -n " . . . . . . . . . . No domainname set" + # service is not configured + exit 1 + fi + fi + + ## If we don't have a /etc/yp.conf file, skip starting of + ## ypbind and return with "program not configured" + ## if you add the -broadcast Option later, comment this out. + if [ ! -f /etc/yp.conf -a "$YPBIND_BROADCAST" != "yes" ] ; then + # Tell the user this has skipped + echo -n " . . . . . . . . . . ${attn}/etc/yp.conf not found${norm}" + # service is not configured + exit 1 + fi + + # evaluate the OPTIONS for ypbind-mt + OPTIONS="" + test "$YPBIND_LOCAL_ONLY" = "yes" && OPTIONS="-local-only $OPTIONS" + test "$YPBIND_BROADCAST" = "yes" && OPTIONS="-broadcast $OPTIONS" + test "$YPBIND_BROKEN_SERVER" = "yes" && OPTIONS="-broken-server $OPTIONS" + + start-stop-daemon --start --quiet --pidfile $pidfile --exec $YPBIND_BIN -- $YPBIND_OPTIONS $OPTIONS + if [ $? -eq 0 ]; then + notfound=1 + for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do + ypwhich >/dev/null 2>&1 && { notfound=0 ; break; }; + echo -n " ." + sleep 1; + done + if [ $notfound -eq 1 ]; then + echo -n " ${warn}No NIS server found${norm}"; + fi + else + exit 1 + fi + ;; + stop) + echo -n "Shutting down ypbind" + start-stop-daemon --stop --quiet --pidfile $pidfile + # Remove static data, else glibc will continue to use NIS + rm -f /var/yp/binding/* /var/run/ypbind.pid + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + reload | force-reload) + echo -n "Reload service ypbind" + start-stop-daemon --stop --quiet --signal 1 --pidfile $pidfile + ;; + status) + echo -n "Checking for ypbind: " + status $YPBIND_BIN + ;; + *) + echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" + exit 1 + ;; +esac diff --git a/meta-openembedded/meta-networking/recipes-support/nis/nis.inc b/meta-openembedded/meta-networking/recipes-support/nis/nis.inc new file mode 100644 index 0000000000..200eaf74d4 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/nis/nis.inc @@ -0,0 +1,31 @@ +# This include file contains global definitions for the +# various NIS packages. +# +# These packages will only function correctly with glibc - +# the rpcsvc functionality is not present in uclibc +DESCRIPTION = "NIS Server and Tools" +HOMEPAGE = "http://www.linux-nis.org/nis/" +SECTION = "net" +LICENSE = "GPL-2.0" +LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" + +inherit autotools gettext pkgconfig + +# install is broken because src/Makefile heroically adds '-s' +# to the install flags - passing -s to the build /usr/bin/install! +# install-strip gets it right but installs ypbind -m <default>, +# not -m 555. In an OE build this is not, so far as I can see, +# a security problem (and this fix to the build problem is *much* +# easier and more maintainable.) +do_install() { + oe_runmake 'DESTDIR=${D}' install-strip +} + +# An attempt to build on uclibc will fail, causing annoyance, +# so force the package to be skipped here (this will cause a +# 'nothing provides' error) +python () { + os = d.getVar("TARGET_OS", True) + if os == "linux-uclibc": + raise bb.parse.SkipRecipe("NIS functionality requires rpcsvc/yp.h, uClibC does not provide this") +} diff --git a/meta-openembedded/meta-networking/recipes-support/nis/yp-tools/domainname.service b/meta-openembedded/meta-networking/recipes-support/nis/yp-tools/domainname.service new file mode 100644 index 0000000000..21aa92cb36 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/nis/yp-tools/domainname.service @@ -0,0 +1,12 @@ +[Unit] +Description=NIS Domainname + +[Service] +Type=oneshot +EnvironmentFile=/etc/nisdomainname +ExecStart=/usr/bin/domainname $NISDOMAINNAME +RemainAfterExit=true + +[Install] +WantedBy=multi-user.target + diff --git a/meta-openembedded/meta-networking/recipes-support/nis/yp-tools_2.14.bb b/meta-openembedded/meta-networking/recipes-support/nis/yp-tools_2.14.bb new file mode 100644 index 0000000000..8c6837bac9 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/nis/yp-tools_2.14.bb @@ -0,0 +1,34 @@ +# This package builds tools to manage NIS +# The source package is utils/net/NIS/yp-tools +# +require nis.inc + +SUMMARY = "NIS client programs" +DESCRIPTION = " \ +Network Information Service tools. \ +This package contains ypcat, ypmatch, ypset, \ +ypwhich, yppasswd, domainname, nisdomainname \ +and ypdomainname. \ +\ +This is the final IPv4-only version of yp-tools. \ +" + +SRC_URI = "http://www.linux-nis.org/download/yp-tools/${BP}.tar.bz2 \ + file://domainname.service \ +" +SRC_URI[md5sum] = "ba1f121c17e3ad65368be173b977cd13" +SRC_URI[sha256sum] = "d01f70fadc643a55107a0edc47c6be99d0306bcc4f66df56f65e74238b0124c9" + +inherit systemd +SYSTEMD_SERVICE_${PN} = "domainname.service" + +RPROVIDES_${PN} += "${PN}-systemd" +RREPLACES_${PN} += "${PN}-systemd" +RCONFLICTS_${PN} += "${PN}-systemd" + +CACHED_CONFIGUREVARS += "ac_cv_prog_STRIP=/bin/true" + +do_install_append() { + install -d ${D}${systemd_unitdir}/system + install -m 0644 ${WORKDIR}/domainname.service ${D}${systemd_unitdir}/system +} diff --git a/meta-openembedded/meta-networking/recipes-support/nis/yp-tools_4.2.3.bb b/meta-openembedded/meta-networking/recipes-support/nis/yp-tools_4.2.3.bb new file mode 100644 index 0000000000..4e27e32d48 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/nis/yp-tools_4.2.3.bb @@ -0,0 +1,47 @@ +# This package builds tools to manage NIS +# The source package is utils/net/NIS/yp-tools +# +require nis.inc + +SUMMARY = "NIS client programs" +DESCRIPTION = " \ +Network Information Service tools. \ +This package contains ypcat, ypmatch, ypset, \ +ypwhich, yppasswd, domainname, nisdomainname \ +and ypdomainname. \ +" + +# v4.2.3 +SRCREV = "1bfda29c342a81b97cb1995ffd9e8da5de63e7ab" + +SRC_URI = "git://github.com/thkukuk/yp-tools \ + file://domainname.service \ + " + +S = "${WORKDIR}/git" + +DEPENDS = "libtirpc libnsl2" + +inherit autotools systemd +SYSTEMD_SERVICE_${PN} = "domainname.service" + +RPROVIDES_${PN} += "${PN}-systemd" +RREPLACES_${PN} += "${PN}-systemd" +RCONFLICTS_${PN} += "${PN}-systemd" + +CACHED_CONFIGUREVARS += "ac_cv_prog_STRIP=/bin/true" + +EXTRA_OECONF = " \ + --disable-rpath --disable-domainname \ + " +CFLAGS_append_libc-musl = " -Wno-error=cpp" + +FILES_${PN} += " ${libdir}/yp-nis/*.so.*.* ${libdir}/yp-nis/pkgconfig/" +FILES_${PN}-dbg += " ${libdir}/yp-nis/.debug" +FILES_${PN}-dev += " ${libdir}/yp-nis/*.so ${libdir}/yp-nis/*.so.[12] ${libdir}/yp-nis/*.la" +FILES_${PN}-staticdev += " ${libdir}/yp-nis/*.a" + +do_install_append() { + install -d ${D}${systemd_unitdir}/system + install -m 0644 ${WORKDIR}/domainname.service ${D}${systemd_unitdir}/system +} diff --git a/meta-openembedded/meta-networking/recipes-support/nis/ypbind-mt/0001-dns_hosts-Fix-build-with-musl.patch b/meta-openembedded/meta-networking/recipes-support/nis/ypbind-mt/0001-dns_hosts-Fix-build-with-musl.patch new file mode 100644 index 0000000000..643b0a9405 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/nis/ypbind-mt/0001-dns_hosts-Fix-build-with-musl.patch @@ -0,0 +1,67 @@ +From 5452961750275b1e3f7c95e9528338f0ee0357ad Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Thu, 14 Sep 2017 09:17:35 -0700 +Subject: [PATCH] dns_hosts: Fix build with musl + +Add NETDB_* defines which are not available in musl +remove need for sys/cdefs.h by remove __P +Add _GNU_SOURCE for missing u_char definition + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Pending + + lib/Makefile.am | 2 +- + lib/dns_hosts.c | 9 ++++++++- + 2 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/lib/Makefile.am b/lib/Makefile.am +index 977a8db..35cb5b3 100644 +--- a/lib/Makefile.am ++++ b/lib/Makefile.am +@@ -8,7 +8,7 @@ + noinst_LIBRARIES = libcompat.a + noinst_HEADERS = ypbind3_binding.h + +-AM_CFLAGS = -D_REENTRANT=1 @WARNFLAGS@ ++AM_CFLAGS = -D_GNU_SOURCE -D_REENTRANT=1 @WARNFLAGS@ + AM_CPPFLAGS = -I$(srcdir) @TIRPC_CFLAGS@ @NSL_CFLAGS@ -DLOCALEDIR=\"$(localedir)\" + + libcompat_a_SOURCES = dns_hosts.c res_options.h ypbind3_binding_dup.c \ +diff --git a/lib/dns_hosts.c b/lib/dns_hosts.c +index fd421fd..6067879 100644 +--- a/lib/dns_hosts.c ++++ b/lib/dns_hosts.c +@@ -64,6 +64,7 @@ + + #include <sys/param.h> + #include <sys/socket.h> ++#include <sys/types.h> + #include <netinet/in.h> + #include <arpa/inet.h> + #include <arpa/nameser.h> +@@ -84,6 +85,12 @@ extern struct hostent *_gethtbyaddr(const char *, int, int); + #ifndef LOG_AUTH + # define LOG_AUTH 0 + #endif ++#ifndef NETDB_SUCCESS ++# define NETDB_SUCCESS 0 ++#endif ++#ifndef NETDB_INTERNAL ++# define NETDB_INTERNAL -1 ++#endif + + #define MULTI_PTRS_ARE_ALIASES 1 /* XXX - experimental */ + +@@ -101,7 +108,7 @@ static char hostbuf[8*1024]; + static struct in_addr host_addr; + + #ifdef RESOLVSORT +-static void addrsort __P((char **, int)); ++static void addrsort (char **, int); + #endif + + #if PACKETSZ > 1024 +-- +2.14.1 + diff --git a/meta-openembedded/meta-networking/recipes-support/nis/ypbind-mt/ypbind.service b/meta-openembedded/meta-networking/recipes-support/nis/ypbind-mt/ypbind.service new file mode 100644 index 0000000000..1f8df42af5 --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/nis/ypbind-mt/ypbind.service @@ -0,0 +1,14 @@ +[Unit] +Description=YP Bind +Requires=domainname.service +After=domainname.service network.target +Before=systemd-user-sessions.service + +[Service] +Type=forking +PIDFile=/var/run/ypbind.pid +ExecStart=/usr/sbin/ypbind + +[Install] +WantedBy=multi-user.target + diff --git a/meta-openembedded/meta-networking/recipes-support/nis/ypbind-mt_2.4.bb b/meta-openembedded/meta-networking/recipes-support/nis/ypbind-mt_2.4.bb new file mode 100644 index 0000000000..9822f455ec --- /dev/null +++ b/meta-openembedded/meta-networking/recipes-support/nis/ypbind-mt_2.4.bb @@ -0,0 +1,62 @@ +# This package builds the NIS ypbind daemon +# The source package is utils/net/NIS/ypbind-mt +# +require nis.inc + +DESCRIPTION = " \ +Multithreaded NIS bind service (ypbind-mt). \ +ypbind-mt is a complete new implementation of a NIS \ +binding daemon for Linux. It has the following \ +features. Supports ypbind protocol V1 and V2. \ +Uses threads for better response. Supports multiple \ +domain bindings. Supports /var/yp/binding/* file \ +for Linux libc 4/5 and glibc 2.x. Supports a list \ +of known secure NIS server (/etc/yp.conf) Binds to \ +the server which answered as first. \ +\ +This is the final IPv4-only version of ypbind-mt. \ +" +HOMEPAGE = "http://www.linux-nis.org/nis/ypbind-mt/index.html" +DEPENDS = " \ + yp-tools \ + ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \ + " +DEPENDS_append_libc-musl = " bsd-headers nss" +RDEPENDS_${PN} += "yp-tools" + +# ypbind-mt now provides all the functionality of ypbind +# and is used in place of it. +PROVIDES += "ypbind" + +SRC_URI = "http://www.linux-nis.org/download/ypbind-mt/${BP}.tar.bz2 \ + file://ypbind.init \ + file://ypbind.service \ + file://0001-dns_hosts-Fix-build-with-musl.patch \ + " +SRC_URI[md5sum] = "1aeccd0d11c064d5d59c56941bca682b" +SRC_URI[sha256sum] = "a2e1fa8fc992a12b289c229e00e38c20d59070c3bcf08babf40c692515c340e0" + +inherit systemd update-rc.d + +SYSTEMD_SERVICE_${PN} = "ypbind.service" +INITSCRIPT_NAME = "ypbind" +INITSCRIPT_PARAMS = "start 44 3 5 . stop 70 0 1 2 6 ." + +CACHED_CONFIGUREVARS = "ac_cv_prog_STRIP=/bin/true" + +CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/nss3" + +do_install_append () { + install -d ${D}${sysconfdir}/init.d + install -d ${D}${sysconfdir}/rcS.d + + install -m 0755 ${WORKDIR}/ypbind.init ${D}${sysconfdir}/init.d/ypbind + + install -d ${D}${systemd_unitdir}/system + install -m 0644 ${WORKDIR}/ypbind.service ${D}${systemd_unitdir}/system +} + + +RPROVIDES_${PN} += "${PN}-systemd" +RREPLACES_${PN} += "${PN}-systemd" +RCONFLICTS_${PN} += "${PN}-systemd" |