* [PATCH 1/2] ypbind-mt: get parameters from dhcp
@ 2015-07-28 2:36 rongqing.li
2015-07-28 2:36 ` [PATCH 2/2] ntp: " rongqing.li
2015-07-30 16:57 ` [PATCH 1/2] ypbind-mt: " Joe MacDonald
0 siblings, 2 replies; 7+ messages in thread
From: rongqing.li @ 2015-07-28 2:36 UTC (permalink / raw)
To: openembedded-devel
From: Li Wang <li.wang@windriver.com>
adopt a script nis.sh from
https://git.centos.org/raw/rpms!ypbind.git/5a592e88374f067679276488430ebdf51152c358/SOURCES!nis.sh
it is dhclient-script plugin for NIS settings.
Signed-off-by: Li Wang <li.wang@windriver.com>
Signed-off-by: Roy Li <rongqing.li@windriver.com>
---
.../recipes-support/nis/ypbind-mt/nis.sh | 108 +++++++++++++++++++++
.../recipes-support/nis/ypbind-mt_1.38.bb | 4 +
.../recipes-support/nis/ypbind-mt_2.2.bb | 4 +
3 files changed, 116 insertions(+)
create mode 100755 meta-networking/recipes-support/nis/ypbind-mt/nis.sh
diff --git a/meta-networking/recipes-support/nis/ypbind-mt/nis.sh b/meta-networking/recipes-support/nis/ypbind-mt/nis.sh
new file mode 100755
index 0000000..a1e338c
--- /dev/null
+++ b/meta-networking/recipes-support/nis/ypbind-mt/nis.sh
@@ -0,0 +1,108 @@
+#!/bin/sh
+#
+# nis.sh: dhclient-script plugin for NIS settings,
+# place in /etc/dhcp/dhclient.d and 'chmod +x nis.sh' to enable
+#
+# Copyright (C) 2008 Red Hat, Inc.
+#
+# 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, see <http://www.gnu.org/licenses/>.
+#
+# Author(s): David Cantrell <dcantrell@redhat.com>
+
+CONF=/etc/yp.conf
+SAVECONF=${SAVEDIR}/${CONF##*/}.predhclient.${interface}
+
+fix_context() {
+ if [ -x /sbin/restorecon ]; then
+ /sbin/restorecon ${1} >/dev/null 2>&1
+ fi
+}
+
+save_config_file() {
+ if [ ! -d ${SAVEDIR} ]; then
+ mkdir -p ${SAVEDIR}
+ fi
+
+ if [ -e ${CONF} ]; then
+ # cp+rm instead of mv: preserve SELinux context
+ # rhbz#509240
+ # Do not rely on restorecon.
+ cp -c ${CONF} ${SAVECONF}
+ rm ${CONF}
+ else
+ echo > ${SAVECONF}
+ # Try restorecon
+ fix_context ${SAVECONF}
+ fi
+}
+
+nis_config() {
+ if [ ! "${PEERNIS}" = "no" ]; then
+ if [ -n "${new_nis_domain}" ]; then
+ domainname "${new_nis_domain}"
+ save_config_file
+ let contents=0
+ echo '# generated by /sbin/dhclient-script' > ${CONF}
+ fix_context ${CONF}
+
+ if [ -n "${new_nis_servers}" ]; then
+ for i in ${new_nis_servers} ; do
+ echo "domain ${new_nis_domain} server ${i}" >> ${CONF}
+ let contents=contents+1
+ done
+ else
+ echo "domain ${new_nis_domain} broadcast" >> ${CONF}
+ let contents=contents+1
+ fi
+
+ if [ ${contents} -gt 0 ]; then
+ service ypbind condrestart >/dev/null 2>&1
+ fi
+ elif [ -n "${new_nis_servers}" ]; then
+ save_config_file
+ echo '# generated by /sbin/dhclient-script' > ${CONF}
+ fix_context ${CONF}
+ let contents=0
+
+ for i in ${new_nis_servers} ; do
+ echo "ypserver ${i}" >> ${CONF}
+ let contents=contents+1
+ done
+
+ if [ $contents -gt 0 ]; then
+ service ypbind condrestart >/dev/null 2>&1
+ fi
+ fi
+ fi
+}
+
+nis_restore() {
+ if [ ! "${PEERNIS}" = "no" ]; then
+ if [ -f ${SAVECONF} ]; then
+ rm -f ${CONF}
+ # cp+rm instead of mv: preserve SELinux context
+ # rhbz#509240
+ cp -c ${SAVECONF} ${CONF}
+ rm ${SAVECONF}
+ fix_context ${CONF} # Restorecon again to be sure.
+ service ypbind condrestart >/dev/null 2>&1
+ fi
+ fi
+}
+
+# Local Variables:
+# indent-tabs-mode: nil
+# sh-basic-offset: 4
+# show-trailing-whitespace: t
+# End:
diff --git a/meta-networking/recipes-support/nis/ypbind-mt_1.38.bb b/meta-networking/recipes-support/nis/ypbind-mt_1.38.bb
index d25ef5c..5391b5b 100644
--- a/meta-networking/recipes-support/nis/ypbind-mt_1.38.bb
+++ b/meta-networking/recipes-support/nis/ypbind-mt_1.38.bb
@@ -28,6 +28,7 @@ PROVIDES += "ypbind"
SRC_URI = "http://www.linux-nis.org/download/ypbind-mt/${BP}.tar.bz2 \
file://ypbind-yocto.init \
file://ypbind.service \
+ file://nis.sh \
"
SRC_URI[md5sum] = "094088c0e282fa7f3b3dd6cc51d0a4e1"
SRC_URI[sha256sum] = "1930ce19f6ccfe10400f3497b31867f71690d2bcd3f5b575199fa915559b7746"
@@ -48,6 +49,9 @@ do_install_append () {
install -d ${D}${systemd_unitdir}/system
install -m 0644 ${WORKDIR}/ypbind.service ${D}${systemd_unitdir}/system
+
+ install -d ${D}/${sysconfdir}/dhcp/dhclient.d
+ install -m 755 ${WORKDIR}/nis.sh ${D}/${sysconfdir}/dhcp/dhclient.d/
}
diff --git a/meta-networking/recipes-support/nis/ypbind-mt_2.2.bb b/meta-networking/recipes-support/nis/ypbind-mt_2.2.bb
index 4f8bf48..6d5ab2d 100644
--- a/meta-networking/recipes-support/nis/ypbind-mt_2.2.bb
+++ b/meta-networking/recipes-support/nis/ypbind-mt_2.2.bb
@@ -23,6 +23,7 @@ PNBLACKLIST[ypbind-mt] ?= "BROKEN: Depends on broken yp-tools"
SRC_URI = "http://www.linux-nis.org/download/ypbind-mt/${BP}.tar.bz2 \
file://ypbind-yocto.init \
file://ypbind.service \
+ file://nis.sh \
"
SRC_URI[md5sum] = "54e2040d8266ae7d302d081ca310c8a8"
SRC_URI[sha256sum] = "dc2f7d97c94dcab0acfdcd115cd8b464eb8c427e4bb0fe68404ae7465f517cd3"
@@ -45,6 +46,9 @@ do_install_append () {
install -d ${D}${systemd_unitdir}/system
install -m 0644 ${WORKDIR}/ypbind.service ${D}${systemd_unitdir}/system
+
+ install -d ${D}/${sysconfdir}/dhcp/dhclient.d
+ install -m 755 ${WORKDIR}/nis.sh ${D}/${sysconfdir}/dhcp/dhclient.d/
}
--
2.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] ntp: get parameters from dhcp
2015-07-28 2:36 [PATCH 1/2] ypbind-mt: get parameters from dhcp rongqing.li
@ 2015-07-28 2:36 ` rongqing.li
2015-07-30 16:59 ` Joe MacDonald
2015-07-30 16:57 ` [PATCH 1/2] ypbind-mt: " Joe MacDonald
1 sibling, 1 reply; 7+ messages in thread
From: rongqing.li @ 2015-07-28 2:36 UTC (permalink / raw)
To: openembedded-devel
From: Li Wang <li.wang@windriver.com>
the script ntp.sh is called by dhcp client,
it can get some parameters from dhcp.
Signed-off-by: Li Wang <li.wang@windriver.com>
Signed-off-by: Roy Li <rongqing.li@windriver.com>
---
meta-networking/recipes-support/ntp/files/ntp.sh | 61 ++++++++++++++++++++++
meta-networking/recipes-support/ntp/ntp_4.2.8p2.bb | 5 ++
2 files changed, 66 insertions(+)
create mode 100755 meta-networking/recipes-support/ntp/files/ntp.sh
diff --git a/meta-networking/recipes-support/ntp/files/ntp.sh b/meta-networking/recipes-support/ntp/files/ntp.sh
new file mode 100755
index 0000000..ca53a97
--- /dev/null
+++ b/meta-networking/recipes-support/ntp/files/ntp.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# ntp.sh: dhclient-script plugin for NTP settings,
+# place in /etc/dhcp/dhclient.d and 'chmod +x ntp.sh' to enable
+#
+# Copyright (C) 2008 Red Hat, Inc.
+#
+# 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, see <http://www.gnu.org/licenses/>.
+#
+# Author(s): David Cantrell <dcantrell@redhat.com>
+# Miroslav Lichvar <mlichvar@redhat.com>
+#
+
+CONF=/etc/ntp.conf
+SAVECONF=${SAVEDIR}/${CONF##*/}.predhclient.${interface}
+
+ntp_replace_conf() {
+ echo "$1" | diff -q ${CONF} - > /dev/null 2>&1
+ if [ $? -eq 1 ]; then
+ echo "$1" > ${CONF}
+ if [ -x /sbin/restorecon ]; then
+ restorecon ${CONF} >/dev/null 2>&1
+ fi
+ service ntpd restart >/dev/null 2>&1
+ fi
+}
+
+ntp_config() {
+ if [ ! "${PEERNTP}" = "no" ] && [ -n "${new_ntp_servers}" ] &&
+ [ -e ${CONF} ] && [ -d ${SAVEDIR} ]; then
+ local conf=$(grep -v '^server .* # added by /sbin/dhclient-script$' < ${CONF})
+
+ conf=$(echo "$conf"
+ for s in ${new_ntp_servers}; do
+ echo "server ${s} ${NTPSERVERARGS} # added by /sbin/dhclient-script"
+ done)
+
+ [ -f ${SAVECONF} ] || touch ${SAVECONF}
+ ntp_replace_conf "$conf"
+ fi
+}
+
+ntp_restore() {
+ if [ -e ${CONF} ] && [ -f ${SAVECONF} ]; then
+ local conf=$(grep -v '^server .* # added by /sbin/dhclient-script$' < ${CONF})
+
+ ntp_replace_conf "$conf"
+ rm -f ${SAVECONF}
+ fi
+}
diff --git a/meta-networking/recipes-support/ntp/ntp_4.2.8p2.bb b/meta-networking/recipes-support/ntp/ntp_4.2.8p2.bb
index c54da43..b963584 100644
--- a/meta-networking/recipes-support/ntp/ntp_4.2.8p2.bb
+++ b/meta-networking/recipes-support/ntp/ntp_4.2.8p2.bb
@@ -21,6 +21,7 @@ SRC_URI = "http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-${PV}.tar.g
file://sntp.service \
file://sntp \
file://ntpd.list \
+ file://ntp.sh \
"
SRC_URI[md5sum] = "fa37049383316322d060ec9061ac23a9"
@@ -93,6 +94,9 @@ do_install_append() {
install -d ${D}${systemd_unitdir}/ntp-units.d
install -m 0644 ${WORKDIR}/ntpd.list ${D}${systemd_unitdir}/ntp-units.d/60-ntpd.list
+
+ install -d ${D}/${sysconfdir}/dhcp/dhclient.d
+ install -m 755 ${WORKDIR}/ntp.sh ${D}/${sysconfdir}/dhcp/dhclient.d/
}
PACKAGES += "ntpdate sntp ${PN}-tickadj ${PN}-utils"
@@ -124,6 +128,7 @@ RSUGGESTS_${PN} = "iana-etc"
FILES_${PN} = "${sbindir}/ntpd ${sysconfdir}/ntp.conf ${sysconfdir}/init.d/ntpd ${libdir} \
${NTP_USER_HOME} \
${systemd_unitdir}/ntp-units.d/60-ntpd.list \
+ ${sysconfdir}/dhcp/dhclient.d/ntp.sh \
"
FILES_${PN}-tickadj = "${sbindir}/tickadj"
FILES_${PN}-utils = "${sbindir} ${datadir}/ntp/lib"
--
2.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ypbind-mt: get parameters from dhcp
2015-07-28 2:36 [PATCH 1/2] ypbind-mt: get parameters from dhcp rongqing.li
2015-07-28 2:36 ` [PATCH 2/2] ntp: " rongqing.li
@ 2015-07-30 16:57 ` Joe MacDonald
2015-07-31 1:04 ` Rongqing Li
1 sibling, 1 reply; 7+ messages in thread
From: Joe MacDonald @ 2015-07-30 16:57 UTC (permalink / raw)
To: rongqing.li; +Cc: openembedded-devel
[-- Attachment #1: Type: text/plain, Size: 7158 bytes --]
[[oe] [PATCH 1/2] ypbind-mt: get parameters from dhcp] On 15.07.28 (Tue 10:36) rongqing.li@windriver.com wrote:
> From: Li Wang <li.wang@windriver.com>
>
> adopt a script nis.sh from
> https://git.centos.org/raw/rpms!ypbind.git/5a592e88374f067679276488430ebdf51152c358/SOURCES!nis.sh
> it is dhclient-script plugin for NIS settings.
>
> Signed-off-by: Li Wang <li.wang@windriver.com>
> Signed-off-by: Roy Li <rongqing.li@windriver.com>
> ---
> .../recipes-support/nis/ypbind-mt/nis.sh | 108 +++++++++++++++++++++
> .../recipes-support/nis/ypbind-mt_1.38.bb | 4 +
> .../recipes-support/nis/ypbind-mt_2.2.bb | 4 +
> 3 files changed, 116 insertions(+)
> create mode 100755 meta-networking/recipes-support/nis/ypbind-mt/nis.sh
>
> diff --git a/meta-networking/recipes-support/nis/ypbind-mt/nis.sh b/meta-networking/recipes-support/nis/ypbind-mt/nis.sh
> new file mode 100755
> index 0000000..a1e338c
> --- /dev/null
> +++ b/meta-networking/recipes-support/nis/ypbind-mt/nis.sh
> @@ -0,0 +1,108 @@
> +#!/bin/sh
> +#
> +# nis.sh: dhclient-script plugin for NIS settings,
> +# place in /etc/dhcp/dhclient.d and 'chmod +x nis.sh' to enable
> +#
> +# Copyright (C) 2008 Red Hat, Inc.
> +#
> +# 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, see <http://www.gnu.org/licenses/>.
> +#
> +# Author(s): David Cantrell <dcantrell@redhat.com>
> +
> +CONF=/etc/yp.conf
This should probably be substituted with @SYSCONFDIR@ so it's still
functional for anyone who changes ${sysconfdir}. Just thinking out loud
now, but what's the systemd equivalent here? Do we already have one?
That's not a barrier to accepting this patch, either way. I'd just like
to see this hard-coded path be slightly less hard-coded.
-J.
> +SAVECONF=${SAVEDIR}/${CONF##*/}.predhclient.${interface}
> +
> +fix_context() {
> + if [ -x /sbin/restorecon ]; then
> + /sbin/restorecon ${1} >/dev/null 2>&1
> + fi
> +}
> +
> +save_config_file() {
> + if [ ! -d ${SAVEDIR} ]; then
> + mkdir -p ${SAVEDIR}
> + fi
> +
> + if [ -e ${CONF} ]; then
> + # cp+rm instead of mv: preserve SELinux context
> + # rhbz#509240
> + # Do not rely on restorecon.
> + cp -c ${CONF} ${SAVECONF}
> + rm ${CONF}
> + else
> + echo > ${SAVECONF}
> + # Try restorecon
> + fix_context ${SAVECONF}
> + fi
> +}
> +
> +nis_config() {
> + if [ ! "${PEERNIS}" = "no" ]; then
> + if [ -n "${new_nis_domain}" ]; then
> + domainname "${new_nis_domain}"
> + save_config_file
> + let contents=0
> + echo '# generated by /sbin/dhclient-script' > ${CONF}
> + fix_context ${CONF}
> +
> + if [ -n "${new_nis_servers}" ]; then
> + for i in ${new_nis_servers} ; do
> + echo "domain ${new_nis_domain} server ${i}" >> ${CONF}
> + let contents=contents+1
> + done
> + else
> + echo "domain ${new_nis_domain} broadcast" >> ${CONF}
> + let contents=contents+1
> + fi
> +
> + if [ ${contents} -gt 0 ]; then
> + service ypbind condrestart >/dev/null 2>&1
> + fi
> + elif [ -n "${new_nis_servers}" ]; then
> + save_config_file
> + echo '# generated by /sbin/dhclient-script' > ${CONF}
> + fix_context ${CONF}
> + let contents=0
> +
> + for i in ${new_nis_servers} ; do
> + echo "ypserver ${i}" >> ${CONF}
> + let contents=contents+1
> + done
> +
> + if [ $contents -gt 0 ]; then
> + service ypbind condrestart >/dev/null 2>&1
> + fi
> + fi
> + fi
> +}
> +
> +nis_restore() {
> + if [ ! "${PEERNIS}" = "no" ]; then
> + if [ -f ${SAVECONF} ]; then
> + rm -f ${CONF}
> + # cp+rm instead of mv: preserve SELinux context
> + # rhbz#509240
> + cp -c ${SAVECONF} ${CONF}
> + rm ${SAVECONF}
> + fix_context ${CONF} # Restorecon again to be sure.
> + service ypbind condrestart >/dev/null 2>&1
> + fi
> + fi
> +}
> +
> +# Local Variables:
> +# indent-tabs-mode: nil
> +# sh-basic-offset: 4
> +# show-trailing-whitespace: t
> +# End:
> diff --git a/meta-networking/recipes-support/nis/ypbind-mt_1.38.bb b/meta-networking/recipes-support/nis/ypbind-mt_1.38.bb
> index d25ef5c..5391b5b 100644
> --- a/meta-networking/recipes-support/nis/ypbind-mt_1.38.bb
> +++ b/meta-networking/recipes-support/nis/ypbind-mt_1.38.bb
> @@ -28,6 +28,7 @@ PROVIDES += "ypbind"
> SRC_URI = "http://www.linux-nis.org/download/ypbind-mt/${BP}.tar.bz2 \
> file://ypbind-yocto.init \
> file://ypbind.service \
> + file://nis.sh \
> "
> SRC_URI[md5sum] = "094088c0e282fa7f3b3dd6cc51d0a4e1"
> SRC_URI[sha256sum] = "1930ce19f6ccfe10400f3497b31867f71690d2bcd3f5b575199fa915559b7746"
> @@ -48,6 +49,9 @@ do_install_append () {
>
> install -d ${D}${systemd_unitdir}/system
> install -m 0644 ${WORKDIR}/ypbind.service ${D}${systemd_unitdir}/system
> +
> + install -d ${D}/${sysconfdir}/dhcp/dhclient.d
> + install -m 755 ${WORKDIR}/nis.sh ${D}/${sysconfdir}/dhcp/dhclient.d/
> }
>
>
> diff --git a/meta-networking/recipes-support/nis/ypbind-mt_2.2.bb b/meta-networking/recipes-support/nis/ypbind-mt_2.2.bb
> index 4f8bf48..6d5ab2d 100644
> --- a/meta-networking/recipes-support/nis/ypbind-mt_2.2.bb
> +++ b/meta-networking/recipes-support/nis/ypbind-mt_2.2.bb
> @@ -23,6 +23,7 @@ PNBLACKLIST[ypbind-mt] ?= "BROKEN: Depends on broken yp-tools"
> SRC_URI = "http://www.linux-nis.org/download/ypbind-mt/${BP}.tar.bz2 \
> file://ypbind-yocto.init \
> file://ypbind.service \
> + file://nis.sh \
> "
> SRC_URI[md5sum] = "54e2040d8266ae7d302d081ca310c8a8"
> SRC_URI[sha256sum] = "dc2f7d97c94dcab0acfdcd115cd8b464eb8c427e4bb0fe68404ae7465f517cd3"
> @@ -45,6 +46,9 @@ do_install_append () {
>
> install -d ${D}${systemd_unitdir}/system
> install -m 0644 ${WORKDIR}/ypbind.service ${D}${systemd_unitdir}/system
> +
> + install -d ${D}/${sysconfdir}/dhcp/dhclient.d
> + install -m 755 ${WORKDIR}/nis.sh ${D}/${sysconfdir}/dhcp/dhclient.d/
> }
>
>
> --
> 2.1.4
>
--
-Joe MacDonald.
:wq
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 484 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] ntp: get parameters from dhcp
2015-07-28 2:36 ` [PATCH 2/2] ntp: " rongqing.li
@ 2015-07-30 16:59 ` Joe MacDonald
0 siblings, 0 replies; 7+ messages in thread
From: Joe MacDonald @ 2015-07-30 16:59 UTC (permalink / raw)
To: rongqing.li; +Cc: openembedded-devel
[-- Attachment #1: Type: text/plain, Size: 4647 bytes --]
[[oe] [PATCH 2/2] ntp: get parameters from dhcp] On 15.07.28 (Tue 10:36) rongqing.li@windriver.com wrote:
> From: Li Wang <li.wang@windriver.com>
>
> the script ntp.sh is called by dhcp client,
> it can get some parameters from dhcp.
>
> Signed-off-by: Li Wang <li.wang@windriver.com>
> Signed-off-by: Roy Li <rongqing.li@windriver.com>
> ---
> meta-networking/recipes-support/ntp/files/ntp.sh | 61 ++++++++++++++++++++++
> meta-networking/recipes-support/ntp/ntp_4.2.8p2.bb | 5 ++
> 2 files changed, 66 insertions(+)
> create mode 100755 meta-networking/recipes-support/ntp/files/ntp.sh
>
> diff --git a/meta-networking/recipes-support/ntp/files/ntp.sh b/meta-networking/recipes-support/ntp/files/ntp.sh
> new file mode 100755
> index 0000000..ca53a97
> --- /dev/null
> +++ b/meta-networking/recipes-support/ntp/files/ntp.sh
> @@ -0,0 +1,61 @@
> +#!/bin/sh
> +#
> +# ntp.sh: dhclient-script plugin for NTP settings,
> +# place in /etc/dhcp/dhclient.d and 'chmod +x ntp.sh' to enable
> +#
> +# Copyright (C) 2008 Red Hat, Inc.
> +#
> +# 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, see <http://www.gnu.org/licenses/>.
> +#
> +# Author(s): David Cantrell <dcantrell@redhat.com>
> +# Miroslav Lichvar <mlichvar@redhat.com>
> +#
> +
> +CONF=/etc/ntp.conf
Same comment here about the hard-coded CONF location rather than having
it reflect ${sysconfdir}.
-J.
> +SAVECONF=${SAVEDIR}/${CONF##*/}.predhclient.${interface}
> +
> +ntp_replace_conf() {
> + echo "$1" | diff -q ${CONF} - > /dev/null 2>&1
> + if [ $? -eq 1 ]; then
> + echo "$1" > ${CONF}
> + if [ -x /sbin/restorecon ]; then
> + restorecon ${CONF} >/dev/null 2>&1
> + fi
> + service ntpd restart >/dev/null 2>&1
> + fi
> +}
> +
> +ntp_config() {
> + if [ ! "${PEERNTP}" = "no" ] && [ -n "${new_ntp_servers}" ] &&
> + [ -e ${CONF} ] && [ -d ${SAVEDIR} ]; then
> + local conf=$(grep -v '^server .* # added by /sbin/dhclient-script$' < ${CONF})
> +
> + conf=$(echo "$conf"
> + for s in ${new_ntp_servers}; do
> + echo "server ${s} ${NTPSERVERARGS} # added by /sbin/dhclient-script"
> + done)
> +
> + [ -f ${SAVECONF} ] || touch ${SAVECONF}
> + ntp_replace_conf "$conf"
> + fi
> +}
> +
> +ntp_restore() {
> + if [ -e ${CONF} ] && [ -f ${SAVECONF} ]; then
> + local conf=$(grep -v '^server .* # added by /sbin/dhclient-script$' < ${CONF})
> +
> + ntp_replace_conf "$conf"
> + rm -f ${SAVECONF}
> + fi
> +}
> diff --git a/meta-networking/recipes-support/ntp/ntp_4.2.8p2.bb b/meta-networking/recipes-support/ntp/ntp_4.2.8p2.bb
> index c54da43..b963584 100644
> --- a/meta-networking/recipes-support/ntp/ntp_4.2.8p2.bb
> +++ b/meta-networking/recipes-support/ntp/ntp_4.2.8p2.bb
> @@ -21,6 +21,7 @@ SRC_URI = "http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-${PV}.tar.g
> file://sntp.service \
> file://sntp \
> file://ntpd.list \
> + file://ntp.sh \
> "
>
> SRC_URI[md5sum] = "fa37049383316322d060ec9061ac23a9"
> @@ -93,6 +94,9 @@ do_install_append() {
>
> install -d ${D}${systemd_unitdir}/ntp-units.d
> install -m 0644 ${WORKDIR}/ntpd.list ${D}${systemd_unitdir}/ntp-units.d/60-ntpd.list
> +
> + install -d ${D}/${sysconfdir}/dhcp/dhclient.d
> + install -m 755 ${WORKDIR}/ntp.sh ${D}/${sysconfdir}/dhcp/dhclient.d/
> }
>
> PACKAGES += "ntpdate sntp ${PN}-tickadj ${PN}-utils"
> @@ -124,6 +128,7 @@ RSUGGESTS_${PN} = "iana-etc"
> FILES_${PN} = "${sbindir}/ntpd ${sysconfdir}/ntp.conf ${sysconfdir}/init.d/ntpd ${libdir} \
> ${NTP_USER_HOME} \
> ${systemd_unitdir}/ntp-units.d/60-ntpd.list \
> + ${sysconfdir}/dhcp/dhclient.d/ntp.sh \
> "
> FILES_${PN}-tickadj = "${sbindir}/tickadj"
> FILES_${PN}-utils = "${sbindir} ${datadir}/ntp/lib"
> --
> 2.1.4
>
--
-Joe MacDonald.
:wq
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 484 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ypbind-mt: get parameters from dhcp
2015-07-30 16:57 ` [PATCH 1/2] ypbind-mt: " Joe MacDonald
@ 2015-07-31 1:04 ` Rongqing Li
2015-08-03 0:53 ` Joe MacDonald
2015-09-06 5:44 ` Rongqing Li
0 siblings, 2 replies; 7+ messages in thread
From: Rongqing Li @ 2015-07-31 1:04 UTC (permalink / raw)
To: Joe MacDonald; +Cc: openembedded-devel
On 2015年07月31日 00:57, Joe MacDonald wrote:
> [[oe] [PATCH 1/2] ypbind-mt: get parameters from dhcp] On 15.07.28 (Tue 10:36) rongqing.li@windriver.com wrote:
>
>> From: Li Wang <li.wang@windriver.com>
>>
>> adopt a script nis.sh from
>> https://git.centos.org/raw/rpms!ypbind.git/5a592e88374f067679276488430ebdf51152c358/SOURCES!nis.sh
>> it is dhclient-script plugin for NIS settings.
>>
>> Signed-off-by: Li Wang <li.wang@windriver.com>
>> Signed-off-by: Roy Li <rongqing.li@windriver.com>
>> ---
>> .../recipes-support/nis/ypbind-mt/nis.sh | 108 +++++++++++++++++++++
>> .../recipes-support/nis/ypbind-mt_1.38.bb | 4 +
>> .../recipes-support/nis/ypbind-mt_2.2.bb | 4 +
>> 3 files changed, 116 insertions(+)
>> create mode 100755 meta-networking/recipes-support/nis/ypbind-mt/nis.sh
>>
>> diff --git a/meta-networking/recipes-support/nis/ypbind-mt/nis.sh b/meta-networking/recipes-support/nis/ypbind-mt/nis.sh
>> new file mode 100755
>> index 0000000..a1e338c
>> --- /dev/null
>> +++ b/meta-networking/recipes-support/nis/ypbind-mt/nis.sh
>> @@ -0,0 +1,108 @@
>> +#!/bin/sh
>> +#
>> +# nis.sh: dhclient-script plugin for NIS settings,
>> +# place in /etc/dhcp/dhclient.d and 'chmod +x nis.sh' to enable
>> +#
>> +# Copyright (C) 2008 Red Hat, Inc.
>> +#
>> +# 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, see <http://www.gnu.org/licenses/>.
>> +#
>> +# Author(s): David Cantrell <dcantrell@redhat.com>
>> +
>> +CONF=/etc/yp.conf
>
> This should probably be substituted with @SYSCONFDIR@ so it's still
> functional for anyone who changes ${sysconfdir}. Just thinking out loud
thanks, Joe
I will change it
> now, but what's the systemd equivalent here? Do we already have one?
>
this script is not called by initvscript or systemd, it is called by
dhclient once dhclient run and gets configuration, so it is not related
to systemd
-Roy
> That's not a barrier to accepting this patch, either way. I'd just like
> to see this hard-coded path be slightly less hard-coded.
>
> -J.
>
>> +SAVECONF=${SAVEDIR}/${CONF##*/}.predhclient.${interface}
>> +
>> +fix_context() {
>> + if [ -x /sbin/restorecon ]; then
>> + /sbin/restorecon ${1} >/dev/null 2>&1
>> + fi
>> +}
>> +
>> +save_config_file() {
>> + if [ ! -d ${SAVEDIR} ]; then
>> + mkdir -p ${SAVEDIR}
>> + fi
>> +
>> + if [ -e ${CONF} ]; then
>> + # cp+rm instead of mv: preserve SELinux context
>> + # rhbz#509240
>> + # Do not rely on restorecon.
>> + cp -c ${CONF} ${SAVECONF}
>> + rm ${CONF}
>> + else
>> + echo > ${SAVECONF}
>> + # Try restorecon
>> + fix_context ${SAVECONF}
>> + fi
>> +}
>> +
>> +nis_config() {
>> + if [ ! "${PEERNIS}" = "no" ]; then
>> + if [ -n "${new_nis_domain}" ]; then
>> + domainname "${new_nis_domain}"
>> + save_config_file
>> + let contents=0
>> + echo '# generated by /sbin/dhclient-script' > ${CONF}
>> + fix_context ${CONF}
>> +
>> + if [ -n "${new_nis_servers}" ]; then
>> + for i in ${new_nis_servers} ; do
>> + echo "domain ${new_nis_domain} server ${i}" >> ${CONF}
>> + let contents=contents+1
>> + done
>> + else
>> + echo "domain ${new_nis_domain} broadcast" >> ${CONF}
>> + let contents=contents+1
>> + fi
>> +
>> + if [ ${contents} -gt 0 ]; then
>> + service ypbind condrestart >/dev/null 2>&1
>> + fi
>> + elif [ -n "${new_nis_servers}" ]; then
>> + save_config_file
>> + echo '# generated by /sbin/dhclient-script' > ${CONF}
>> + fix_context ${CONF}
>> + let contents=0
>> +
>> + for i in ${new_nis_servers} ; do
>> + echo "ypserver ${i}" >> ${CONF}
>> + let contents=contents+1
>> + done
>> +
>> + if [ $contents -gt 0 ]; then
>> + service ypbind condrestart >/dev/null 2>&1
>> + fi
>> + fi
>> + fi
>> +}
>> +
>> +nis_restore() {
>> + if [ ! "${PEERNIS}" = "no" ]; then
>> + if [ -f ${SAVECONF} ]; then
>> + rm -f ${CONF}
>> + # cp+rm instead of mv: preserve SELinux context
>> + # rhbz#509240
>> + cp -c ${SAVECONF} ${CONF}
>> + rm ${SAVECONF}
>> + fix_context ${CONF} # Restorecon again to be sure.
>> + service ypbind condrestart >/dev/null 2>&1
>> + fi
>> + fi
>> +}
>> +
>> +# Local Variables:
>> +# indent-tabs-mode: nil
>> +# sh-basic-offset: 4
>> +# show-trailing-whitespace: t
>> +# End:
>> diff --git a/meta-networking/recipes-support/nis/ypbind-mt_1.38.bb b/meta-networking/recipes-support/nis/ypbind-mt_1.38.bb
>> index d25ef5c..5391b5b 100644
>> --- a/meta-networking/recipes-support/nis/ypbind-mt_1.38.bb
>> +++ b/meta-networking/recipes-support/nis/ypbind-mt_1.38.bb
>> @@ -28,6 +28,7 @@ PROVIDES += "ypbind"
>> SRC_URI = "http://www.linux-nis.org/download/ypbind-mt/${BP}.tar.bz2 \
>> file://ypbind-yocto.init \
>> file://ypbind.service \
>> + file://nis.sh \
>> "
>> SRC_URI[md5sum] = "094088c0e282fa7f3b3dd6cc51d0a4e1"
>> SRC_URI[sha256sum] = "1930ce19f6ccfe10400f3497b31867f71690d2bcd3f5b575199fa915559b7746"
>> @@ -48,6 +49,9 @@ do_install_append () {
>>
>> install -d ${D}${systemd_unitdir}/system
>> install -m 0644 ${WORKDIR}/ypbind.service ${D}${systemd_unitdir}/system
>> +
>> + install -d ${D}/${sysconfdir}/dhcp/dhclient.d
>> + install -m 755 ${WORKDIR}/nis.sh ${D}/${sysconfdir}/dhcp/dhclient.d/
>> }
>>
>>
>> diff --git a/meta-networking/recipes-support/nis/ypbind-mt_2.2.bb b/meta-networking/recipes-support/nis/ypbind-mt_2.2.bb
>> index 4f8bf48..6d5ab2d 100644
>> --- a/meta-networking/recipes-support/nis/ypbind-mt_2.2.bb
>> +++ b/meta-networking/recipes-support/nis/ypbind-mt_2.2.bb
>> @@ -23,6 +23,7 @@ PNBLACKLIST[ypbind-mt] ?= "BROKEN: Depends on broken yp-tools"
>> SRC_URI = "http://www.linux-nis.org/download/ypbind-mt/${BP}.tar.bz2 \
>> file://ypbind-yocto.init \
>> file://ypbind.service \
>> + file://nis.sh \
>> "
>> SRC_URI[md5sum] = "54e2040d8266ae7d302d081ca310c8a8"
>> SRC_URI[sha256sum] = "dc2f7d97c94dcab0acfdcd115cd8b464eb8c427e4bb0fe68404ae7465f517cd3"
>> @@ -45,6 +46,9 @@ do_install_append () {
>>
>> install -d ${D}${systemd_unitdir}/system
>> install -m 0644 ${WORKDIR}/ypbind.service ${D}${systemd_unitdir}/system
>> +
>> + install -d ${D}/${sysconfdir}/dhcp/dhclient.d
>> + install -m 755 ${WORKDIR}/nis.sh ${D}/${sysconfdir}/dhcp/dhclient.d/
>> }
>>
>>
>> --
>> 2.1.4
>>
--
Best Reagrds,
Roy | RongQing Li
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ypbind-mt: get parameters from dhcp
2015-07-31 1:04 ` Rongqing Li
@ 2015-08-03 0:53 ` Joe MacDonald
2015-09-06 5:44 ` Rongqing Li
1 sibling, 0 replies; 7+ messages in thread
From: Joe MacDonald @ 2015-08-03 0:53 UTC (permalink / raw)
To: Rongqing Li; +Cc: openembedded-devel
[-- Attachment #1: Type: text/plain, Size: 8152 bytes --]
[Re: [oe] [PATCH 1/2] ypbind-mt: get parameters from dhcp] On 15.07.31 (Fri 09:04) Rongqing Li wrote:
>
>
> On 2015年07月31日 00:57, Joe MacDonald wrote:
> >[[oe] [PATCH 1/2] ypbind-mt: get parameters from dhcp] On 15.07.28 (Tue 10:36) rongqing.li@windriver.com wrote:
> >
> >>From: Li Wang <li.wang@windriver.com>
> >>
> >>adopt a script nis.sh from
> >>https://git.centos.org/raw/rpms!ypbind.git/5a592e88374f067679276488430ebdf51152c358/SOURCES!nis.sh
> >>it is dhclient-script plugin for NIS settings.
> >>
> >>Signed-off-by: Li Wang <li.wang@windriver.com>
> >>Signed-off-by: Roy Li <rongqing.li@windriver.com>
> >>---
> >> .../recipes-support/nis/ypbind-mt/nis.sh | 108 +++++++++++++++++++++
> >> .../recipes-support/nis/ypbind-mt_1.38.bb | 4 +
> >> .../recipes-support/nis/ypbind-mt_2.2.bb | 4 +
> >> 3 files changed, 116 insertions(+)
> >> create mode 100755 meta-networking/recipes-support/nis/ypbind-mt/nis.sh
> >>
> >>diff --git a/meta-networking/recipes-support/nis/ypbind-mt/nis.sh b/meta-networking/recipes-support/nis/ypbind-mt/nis.sh
> >>new file mode 100755
> >>index 0000000..a1e338c
> >>--- /dev/null
> >>+++ b/meta-networking/recipes-support/nis/ypbind-mt/nis.sh
> >>@@ -0,0 +1,108 @@
> >>+#!/bin/sh
> >>+#
> >>+# nis.sh: dhclient-script plugin for NIS settings,
> >>+# place in /etc/dhcp/dhclient.d and 'chmod +x nis.sh' to enable
> >>+#
> >>+# Copyright (C) 2008 Red Hat, Inc.
> >>+#
> >>+# 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, see <http://www.gnu.org/licenses/>.
> >>+#
> >>+# Author(s): David Cantrell <dcantrell@redhat.com>
> >>+
> >>+CONF=/etc/yp.conf
> >
> >This should probably be substituted with @SYSCONFDIR@ so it's still
> >functional for anyone who changes ${sysconfdir}. Just thinking out loud
>
> thanks, Joe
>
> I will change it
Great, thank you.
> >now, but what's the systemd equivalent here? Do we already have one?
> >
>
> this script is not called by initvscript or systemd, it is called by
> dhclient once dhclient run and gets configuration, so it is not related
> to systemd
Right, right, I wasn't thinking. Thanks, so obviously no changes
required there, just a little tweak to support different sysconfdir
locations.
Thanks Roy.
-J.
>
> -Roy
>
> >That's not a barrier to accepting this patch, either way. I'd just like
> >to see this hard-coded path be slightly less hard-coded.
> >
> >-J.
> >
> >>+SAVECONF=${SAVEDIR}/${CONF##*/}.predhclient.${interface}
> >>+
> >>+fix_context() {
> >>+ if [ -x /sbin/restorecon ]; then
> >>+ /sbin/restorecon ${1} >/dev/null 2>&1
> >>+ fi
> >>+}
> >>+
> >>+save_config_file() {
> >>+ if [ ! -d ${SAVEDIR} ]; then
> >>+ mkdir -p ${SAVEDIR}
> >>+ fi
> >>+
> >>+ if [ -e ${CONF} ]; then
> >>+ # cp+rm instead of mv: preserve SELinux context
> >>+ # rhbz#509240
> >>+ # Do not rely on restorecon.
> >>+ cp -c ${CONF} ${SAVECONF}
> >>+ rm ${CONF}
> >>+ else
> >>+ echo > ${SAVECONF}
> >>+ # Try restorecon
> >>+ fix_context ${SAVECONF}
> >>+ fi
> >>+}
> >>+
> >>+nis_config() {
> >>+ if [ ! "${PEERNIS}" = "no" ]; then
> >>+ if [ -n "${new_nis_domain}" ]; then
> >>+ domainname "${new_nis_domain}"
> >>+ save_config_file
> >>+ let contents=0
> >>+ echo '# generated by /sbin/dhclient-script' > ${CONF}
> >>+ fix_context ${CONF}
> >>+
> >>+ if [ -n "${new_nis_servers}" ]; then
> >>+ for i in ${new_nis_servers} ; do
> >>+ echo "domain ${new_nis_domain} server ${i}" >> ${CONF}
> >>+ let contents=contents+1
> >>+ done
> >>+ else
> >>+ echo "domain ${new_nis_domain} broadcast" >> ${CONF}
> >>+ let contents=contents+1
> >>+ fi
> >>+
> >>+ if [ ${contents} -gt 0 ]; then
> >>+ service ypbind condrestart >/dev/null 2>&1
> >>+ fi
> >>+ elif [ -n "${new_nis_servers}" ]; then
> >>+ save_config_file
> >>+ echo '# generated by /sbin/dhclient-script' > ${CONF}
> >>+ fix_context ${CONF}
> >>+ let contents=0
> >>+
> >>+ for i in ${new_nis_servers} ; do
> >>+ echo "ypserver ${i}" >> ${CONF}
> >>+ let contents=contents+1
> >>+ done
> >>+
> >>+ if [ $contents -gt 0 ]; then
> >>+ service ypbind condrestart >/dev/null 2>&1
> >>+ fi
> >>+ fi
> >>+ fi
> >>+}
> >>+
> >>+nis_restore() {
> >>+ if [ ! "${PEERNIS}" = "no" ]; then
> >>+ if [ -f ${SAVECONF} ]; then
> >>+ rm -f ${CONF}
> >>+ # cp+rm instead of mv: preserve SELinux context
> >>+ # rhbz#509240
> >>+ cp -c ${SAVECONF} ${CONF}
> >>+ rm ${SAVECONF}
> >>+ fix_context ${CONF} # Restorecon again to be sure.
> >>+ service ypbind condrestart >/dev/null 2>&1
> >>+ fi
> >>+ fi
> >>+}
> >>+
> >>+# Local Variables:
> >>+# indent-tabs-mode: nil
> >>+# sh-basic-offset: 4
> >>+# show-trailing-whitespace: t
> >>+# End:
> >>diff --git a/meta-networking/recipes-support/nis/ypbind-mt_1.38.bb b/meta-networking/recipes-support/nis/ypbind-mt_1.38.bb
> >>index d25ef5c..5391b5b 100644
> >>--- a/meta-networking/recipes-support/nis/ypbind-mt_1.38.bb
> >>+++ b/meta-networking/recipes-support/nis/ypbind-mt_1.38.bb
> >>@@ -28,6 +28,7 @@ PROVIDES += "ypbind"
> >> SRC_URI = "http://www.linux-nis.org/download/ypbind-mt/${BP}.tar.bz2 \
> >> file://ypbind-yocto.init \
> >> file://ypbind.service \
> >>+ file://nis.sh \
> >> "
> >> SRC_URI[md5sum] = "094088c0e282fa7f3b3dd6cc51d0a4e1"
> >> SRC_URI[sha256sum] = "1930ce19f6ccfe10400f3497b31867f71690d2bcd3f5b575199fa915559b7746"
> >>@@ -48,6 +49,9 @@ do_install_append () {
> >>
> >> install -d ${D}${systemd_unitdir}/system
> >> install -m 0644 ${WORKDIR}/ypbind.service ${D}${systemd_unitdir}/system
> >>+
> >>+ install -d ${D}/${sysconfdir}/dhcp/dhclient.d
> >>+ install -m 755 ${WORKDIR}/nis.sh ${D}/${sysconfdir}/dhcp/dhclient.d/
> >> }
> >>
> >>
> >>diff --git a/meta-networking/recipes-support/nis/ypbind-mt_2.2.bb b/meta-networking/recipes-support/nis/ypbind-mt_2.2.bb
> >>index 4f8bf48..6d5ab2d 100644
> >>--- a/meta-networking/recipes-support/nis/ypbind-mt_2.2.bb
> >>+++ b/meta-networking/recipes-support/nis/ypbind-mt_2.2.bb
> >>@@ -23,6 +23,7 @@ PNBLACKLIST[ypbind-mt] ?= "BROKEN: Depends on broken yp-tools"
> >> SRC_URI = "http://www.linux-nis.org/download/ypbind-mt/${BP}.tar.bz2 \
> >> file://ypbind-yocto.init \
> >> file://ypbind.service \
> >>+ file://nis.sh \
> >> "
> >> SRC_URI[md5sum] = "54e2040d8266ae7d302d081ca310c8a8"
> >> SRC_URI[sha256sum] = "dc2f7d97c94dcab0acfdcd115cd8b464eb8c427e4bb0fe68404ae7465f517cd3"
> >>@@ -45,6 +46,9 @@ do_install_append () {
> >>
> >> install -d ${D}${systemd_unitdir}/system
> >> install -m 0644 ${WORKDIR}/ypbind.service ${D}${systemd_unitdir}/system
> >>+
> >>+ install -d ${D}/${sysconfdir}/dhcp/dhclient.d
> >>+ install -m 755 ${WORKDIR}/nis.sh ${D}/${sysconfdir}/dhcp/dhclient.d/
> >> }
> >>
> >>
> >>--
> >>2.1.4
> >>
>
--
-Joe MacDonald.
:wq
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 484 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ypbind-mt: get parameters from dhcp
2015-07-31 1:04 ` Rongqing Li
2015-08-03 0:53 ` Joe MacDonald
@ 2015-09-06 5:44 ` Rongqing Li
1 sibling, 0 replies; 7+ messages in thread
From: Rongqing Li @ 2015-09-06 5:44 UTC (permalink / raw)
To: openembedded-devel, Joe MacDonald, Martin Jansa
Hi Joe/Martin:
Could you drop this patch from master-next?
Thanks
-Roy
On 2015年07月31日 09:04, Rongqing Li wrote:
>
>
> On 2015年07月31日 00:57, Joe MacDonald wrote:
>> [[oe] [PATCH 1/2] ypbind-mt: get parameters from dhcp] On 15.07.28
>> (Tue 10:36) rongqing.li@windriver.com wrote:
>>
>>> From: Li Wang <li.wang@windriver.com>
>>>
>>> adopt a script nis.sh from
>>> https://git.centos.org/raw/rpms!ypbind.git/5a592e88374f067679276488430ebdf51152c358/SOURCES!nis.sh
>>>
>>> it is dhclient-script plugin for NIS settings.
>>>
>>> Signed-off-by: Li Wang <li.wang@windriver.com>
>>> Signed-off-by: Roy Li <rongqing.li@windriver.com>
>>> ---
>>> .../recipes-support/nis/ypbind-mt/nis.sh | 108
>>> +++++++++++++++++++++
>>> .../recipes-support/nis/ypbind-mt_1.38.bb | 4 +
>>> .../recipes-support/nis/ypbind-mt_2.2.bb | 4 +
>>> 3 files changed, 116 insertions(+)
>>> create mode 100755
>>> meta-networking/recipes-support/nis/ypbind-mt/nis.sh
>>>
>>> diff --git a/meta-networking/recipes-support/nis/ypbind-mt/nis.sh
>>> b/meta-networking/recipes-support/nis/ypbind-mt/nis.sh
>>> new file mode 100755
>>> index 0000000..a1e338c
>>> --- /dev/null
>>> +++ b/meta-networking/recipes-support/nis/ypbind-mt/nis.sh
>>> @@ -0,0 +1,108 @@
>>> +#!/bin/sh
>>> +#
>>> +# nis.sh: dhclient-script plugin for NIS settings,
>>> +# place in /etc/dhcp/dhclient.d and 'chmod +x nis.sh' to enable
>>> +#
>>> +# Copyright (C) 2008 Red Hat, Inc.
>>> +#
>>> +# 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, see <http://www.gnu.org/licenses/>.
>>> +#
>>> +# Author(s): David Cantrell <dcantrell@redhat.com>
>>> +
>>> +CONF=/etc/yp.conf
>>
>> This should probably be substituted with @SYSCONFDIR@ so it's still
>> functional for anyone who changes ${sysconfdir}. Just thinking out loud
>
> thanks, Joe
>
> I will change it
>
>
>> now, but what's the systemd equivalent here? Do we already have one?
>>
>
> this script is not called by initvscript or systemd, it is called by
> dhclient once dhclient run and gets configuration, so it is not related
> to systemd
>
> -Roy
>
>> That's not a barrier to accepting this patch, either way. I'd just like
>> to see this hard-coded path be slightly less hard-coded.
>>
>> -J.
>>
>>> +SAVECONF=${SAVEDIR}/${CONF##*/}.predhclient.${interface}
>>> +
>>> +fix_context() {
>>> + if [ -x /sbin/restorecon ]; then
>>> + /sbin/restorecon ${1} >/dev/null 2>&1
>>> + fi
>>> +}
>>> +
>>> +save_config_file() {
>>> + if [ ! -d ${SAVEDIR} ]; then
>>> + mkdir -p ${SAVEDIR}
>>> + fi
>>> +
>>> + if [ -e ${CONF} ]; then
>>> + # cp+rm instead of mv: preserve SELinux context
>>> + # rhbz#509240
>>> + # Do not rely on restorecon.
>>> + cp -c ${CONF} ${SAVECONF}
>>> + rm ${CONF}
>>> + else
>>> + echo > ${SAVECONF}
>>> + # Try restorecon
>>> + fix_context ${SAVECONF}
>>> + fi
>>> +}
>>> +
>>> +nis_config() {
>>> + if [ ! "${PEERNIS}" = "no" ]; then
>>> + if [ -n "${new_nis_domain}" ]; then
>>> + domainname "${new_nis_domain}"
>>> + save_config_file
>>> + let contents=0
>>> + echo '# generated by /sbin/dhclient-script' > ${CONF}
>>> + fix_context ${CONF}
>>> +
>>> + if [ -n "${new_nis_servers}" ]; then
>>> + for i in ${new_nis_servers} ; do
>>> + echo "domain ${new_nis_domain} server ${i}" >>
>>> ${CONF}
>>> + let contents=contents+1
>>> + done
>>> + else
>>> + echo "domain ${new_nis_domain} broadcast" >> ${CONF}
>>> + let contents=contents+1
>>> + fi
>>> +
>>> + if [ ${contents} -gt 0 ]; then
>>> + service ypbind condrestart >/dev/null 2>&1
>>> + fi
>>> + elif [ -n "${new_nis_servers}" ]; then
>>> + save_config_file
>>> + echo '# generated by /sbin/dhclient-script' > ${CONF}
>>> + fix_context ${CONF}
>>> + let contents=0
>>> +
>>> + for i in ${new_nis_servers} ; do
>>> + echo "ypserver ${i}" >> ${CONF}
>>> + let contents=contents+1
>>> + done
>>> +
>>> + if [ $contents -gt 0 ]; then
>>> + service ypbind condrestart >/dev/null 2>&1
>>> + fi
>>> + fi
>>> + fi
>>> +}
>>> +
>>> +nis_restore() {
>>> + if [ ! "${PEERNIS}" = "no" ]; then
>>> + if [ -f ${SAVECONF} ]; then
>>> + rm -f ${CONF}
>>> + # cp+rm instead of mv: preserve SELinux context
>>> + # rhbz#509240
>>> + cp -c ${SAVECONF} ${CONF}
>>> + rm ${SAVECONF}
>>> + fix_context ${CONF} # Restorecon again to be sure.
>>> + service ypbind condrestart >/dev/null 2>&1
>>> + fi
>>> + fi
>>> +}
>>> +
>>> +# Local Variables:
>>> +# indent-tabs-mode: nil
>>> +# sh-basic-offset: 4
>>> +# show-trailing-whitespace: t
>>> +# End:
>>> diff --git a/meta-networking/recipes-support/nis/ypbind-mt_1.38.bb
>>> b/meta-networking/recipes-support/nis/ypbind-mt_1.38.bb
>>> index d25ef5c..5391b5b 100644
>>> --- a/meta-networking/recipes-support/nis/ypbind-mt_1.38.bb
>>> +++ b/meta-networking/recipes-support/nis/ypbind-mt_1.38.bb
>>> @@ -28,6 +28,7 @@ PROVIDES += "ypbind"
>>> SRC_URI = "http://www.linux-nis.org/download/ypbind-mt/${BP}.tar.bz2 \
>>> file://ypbind-yocto.init \
>>> file://ypbind.service \
>>> + file://nis.sh \
>>> "
>>> SRC_URI[md5sum] = "094088c0e282fa7f3b3dd6cc51d0a4e1"
>>> SRC_URI[sha256sum] =
>>> "1930ce19f6ccfe10400f3497b31867f71690d2bcd3f5b575199fa915559b7746"
>>> @@ -48,6 +49,9 @@ do_install_append () {
>>>
>>> install -d ${D}${systemd_unitdir}/system
>>> install -m 0644 ${WORKDIR}/ypbind.service
>>> ${D}${systemd_unitdir}/system
>>> +
>>> + install -d ${D}/${sysconfdir}/dhcp/dhclient.d
>>> + install -m 755 ${WORKDIR}/nis.sh
>>> ${D}/${sysconfdir}/dhcp/dhclient.d/
>>> }
>>>
>>>
>>> diff --git a/meta-networking/recipes-support/nis/ypbind-mt_2.2.bb
>>> b/meta-networking/recipes-support/nis/ypbind-mt_2.2.bb
>>> index 4f8bf48..6d5ab2d 100644
>>> --- a/meta-networking/recipes-support/nis/ypbind-mt_2.2.bb
>>> +++ b/meta-networking/recipes-support/nis/ypbind-mt_2.2.bb
>>> @@ -23,6 +23,7 @@ PNBLACKLIST[ypbind-mt] ?= "BROKEN: Depends on
>>> broken yp-tools"
>>> SRC_URI = "http://www.linux-nis.org/download/ypbind-mt/${BP}.tar.bz2 \
>>> file://ypbind-yocto.init \
>>> file://ypbind.service \
>>> + file://nis.sh \
>>> "
>>> SRC_URI[md5sum] = "54e2040d8266ae7d302d081ca310c8a8"
>>> SRC_URI[sha256sum] =
>>> "dc2f7d97c94dcab0acfdcd115cd8b464eb8c427e4bb0fe68404ae7465f517cd3"
>>> @@ -45,6 +46,9 @@ do_install_append () {
>>>
>>> install -d ${D}${systemd_unitdir}/system
>>> install -m 0644 ${WORKDIR}/ypbind.service
>>> ${D}${systemd_unitdir}/system
>>> +
>>> + install -d ${D}/${sysconfdir}/dhcp/dhclient.d
>>> + install -m 755 ${WORKDIR}/nis.sh
>>> ${D}/${sysconfdir}/dhcp/dhclient.d/
>>> }
>>>
>>>
>>> --
>>> 2.1.4
>>>
>
--
Best Reagrds,
Roy | RongQing Li
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-09-06 5:44 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-28 2:36 [PATCH 1/2] ypbind-mt: get parameters from dhcp rongqing.li
2015-07-28 2:36 ` [PATCH 2/2] ntp: " rongqing.li
2015-07-30 16:59 ` Joe MacDonald
2015-07-30 16:57 ` [PATCH 1/2] ypbind-mt: " Joe MacDonald
2015-07-31 1:04 ` Rongqing Li
2015-08-03 0:53 ` Joe MacDonald
2015-09-06 5:44 ` Rongqing Li
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.