* [PATCH] connman: ignore the networking device which nfs for rootfs is working on
@ 2013-10-15 8:12 rongqing.li
2013-10-15 10:10 ` Koen Kooi
0 siblings, 1 reply; 13+ messages in thread
From: rongqing.li @ 2013-10-15 8:12 UTC (permalink / raw)
To: openembedded-core
From: Roy Li <rongqing.li@windriver.com>
Otherwise system will hang since nfs is not disconnected
and remove the judgement of initscript DISTRO_FEATURE when install init
script connman, because inherit systemd will remove init script
Signed-off-by: Roy Li <rongqing.li@windriver.com>
---
meta/recipes-connectivity/connman/connman.inc | 12 ++++--
.../connman/connman/connman-nfs | 42 ++++++++++++++++++++
.../connman/connman/connman-nfs.service | 14 +++++++
meta/recipes-connectivity/connman/connman_1.17.bb | 2 +
4 files changed, 66 insertions(+), 4 deletions(-)
create mode 100644 meta/recipes-connectivity/connman/connman/connman-nfs
create mode 100644 meta/recipes-connectivity/connman/connman/connman-nfs.service
diff --git a/meta/recipes-connectivity/connman/connman.inc b/meta/recipes-connectivity/connman/connman.inc
index 37ce3ec..51c2bfb 100644
--- a/meta/recipes-connectivity/connman/connman.inc
+++ b/meta/recipes-connectivity/connman/connman.inc
@@ -84,10 +84,14 @@ do_compile_append() {
}
do_install_append() {
- if ${@base_contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
- install -d ${D}${sysconfdir}/init.d
- install -m 0755 ${WORKDIR}/connman ${D}${sysconfdir}/init.d/connman
- sed -i s%@LIBDIR@%${libdir}% ${D}${sysconfdir}/init.d/connman
+ install -d ${D}${sysconfdir}/init.d
+ install -m 0755 ${WORKDIR}/connman ${D}${sysconfdir}/init.d/connman
+ sed -i s%@LIBDIR@%${libdir}% ${D}${sysconfdir}/init.d/connman
+
+ if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+ install -d ${D}${bindir}/
+ install -m 0755 ${WORKDIR}/connman-nfs ${D}${bindir}/
+ install -T -m 0644 ${WORKDIR}/connman-nfs.service ${D}/lib/systemd/system/connman.service
fi
install -d ${D}${bindir}
diff --git a/meta/recipes-connectivity/connman/connman/connman-nfs b/meta/recipes-connectivity/connman/connman/connman-nfs
new file mode 100644
index 0000000..1058787
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman/connman-nfs
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+nfsroot=0
+
+exec 9<&0 < /proc/mounts
+while read dev mtpt fstype rest; do
+ if test $mtpt = "/" ; then
+ case $fstype in
+ nfs | nfs4)
+ nfsroot=1
+ break
+ ;;
+ *)
+ ;;
+ esac
+ fi
+done
+
+EXTRA_PARAM=""
+if test $nfsroot -eq 1 ; then
+ NET_DEVS=`cat /proc/net/dev | sed -ne 's/^\([a-zA-Z0-9 ]*\):.*$/\1/p'`
+ NET_ADDR=`cat /proc/cmdline | sed -ne 's/^.*ip=\([^ :]*\).*$/\1/p'`
+
+ if [ ! -z "$NET_ADDR" ]; then
+ if [ "$NET_ADDR" = dhcp ]; then
+ ethn=`ifconfig | grep "^eth" | sed -e "s/\(eth[0-9]\)\(.*\)/\1/"`
+ if [ ! -z "$ethn" ]; then
+ EXTRA_PARAM="-I $ethn"
+ fi
+ else
+ for i in $NET_DEVS; do
+ ADDR=`ifconfig $i | sed 's/addr://g' | sed -ne 's/^.*inet \([0-9.]*\) .*$/\1/p'`
+ if [ "$NET_ADDR" = "$ADDR" ]; then
+ EXTRA_PARAM="-I $i"
+ break
+ fi
+ done
+ fi
+ fi
+fi
+
+/usr/sbin/connmand -n $EXTRA_PARAM
diff --git a/meta/recipes-connectivity/connman/connman/connman-nfs.service b/meta/recipes-connectivity/connman/connman/connman-nfs.service
new file mode 100644
index 0000000..9f9b690
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman/connman-nfs.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Connection service
+After=syslog.target
+
+[Service]
+Type=dbus
+BusName=net.connman
+Restart=on-failure
+ExecStartPre=-/usr/lib64/connman/wired-setup
+ExecStart=/usr/bin/connman-nfs
+StandardOutput=null
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta/recipes-connectivity/connman/connman_1.17.bb b/meta/recipes-connectivity/connman/connman_1.17.bb
index 461157f..f3a4849 100644
--- a/meta/recipes-connectivity/connman/connman_1.17.bb
+++ b/meta/recipes-connectivity/connman/connman_1.17.bb
@@ -4,6 +4,8 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/network/${BPN}/${BP}.tar.xz \
file://0001-plugin.h-Change-visibility-to-default-for-debug-symb.patch \
file://add_xuser_dbus_permission.patch \
file://connman \
+ file://connman-nfs \
+ file://connman-nfs.service \
"
SRC_URI[md5sum] = "dd4a13f789de1b69fcddf0cf613f2d5b"
--
1.7.10.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] connman: ignore the networking device which nfs for rootfs is working on
2013-10-15 8:12 [PATCH] connman: ignore the networking device which nfs for rootfs is working on rongqing.li
@ 2013-10-15 10:10 ` Koen Kooi
2013-10-16 0:46 ` Rongqing Li
0 siblings, 1 reply; 13+ messages in thread
From: Koen Kooi @ 2013-10-15 10:10 UTC (permalink / raw)
To: rongqing.li; +Cc: openembedded-core
Op 15 okt. 2013, om 10:12 heeft rongqing.li@windriver.com het volgende geschreven:
> From: Roy Li <rongqing.li@windriver.com>
>
> Otherwise system will hang since nfs is not disconnected
>
> and remove the judgement of initscript DISTRO_FEATURE when install init
> script connman, because inherit systemd will remove init script
> Signed-off-by: Roy Li <rongqing.li@windriver.com>
> ---
[..]
> diff --git a/meta/recipes-connectivity/connman/connman/connman-nfs.service b/meta/recipes-connectivity/connman/connman/connman-nfs.service
> new file mode 100644
> index 0000000..9f9b690
> --- /dev/null
> +++ b/meta/recipes-connectivity/connman/connman/connman-nfs.service
> @@ -0,0 +1,14 @@
> +[Unit]
> +Description=Connection service
> +After=syslog.target
> +
> +[Service]
> +Type=dbus
> +BusName=net.connman
> +Restart=on-failure
> +ExecStartPre=-/usr/lib64/connman/wired-setup
> +ExecStart=/usr/bin/connman-nfs
Those hardcoded paths aren't going to work. And isn't:
ConditionKernelCommandLine!=root=/dev/nfs
A lot cleaner to use in systemd?
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] connman: ignore the networking device which nfs for rootfs is working on
2013-10-15 10:10 ` Koen Kooi
@ 2013-10-16 0:46 ` Rongqing Li
2013-10-16 8:54 ` Koen Kooi
0 siblings, 1 reply; 13+ messages in thread
From: Rongqing Li @ 2013-10-16 0:46 UTC (permalink / raw)
To: Koen Kooi; +Cc: openembedded-core
On 10/15/2013 06:10 PM, Koen Kooi wrote:
>
> Op 15 okt. 2013, om 10:12 heeft rongqing.li@windriver.com het volgende geschreven:
>
>> From: Roy Li <rongqing.li@windriver.com>
>>
>> Otherwise system will hang since nfs is not disconnected
>>
>> and remove the judgement of initscript DISTRO_FEATURE when install init
>> script connman, because inherit systemd will remove init script
>
>> Signed-off-by: Roy Li <rongqing.li@windriver.com>
>> ---
>
> [..]
>
>> diff --git a/meta/recipes-connectivity/connman/connman/connman-nfs.service b/meta/recipes-connectivity/connman/connman/connman-nfs.service
>> new file mode 100644
>> index 0000000..9f9b690
>> --- /dev/null
>> +++ b/meta/recipes-connectivity/connman/connman/connman-nfs.service
>> @@ -0,0 +1,14 @@
>> +[Unit]
>> +Description=Connection service
>> +After=syslog.target
>> +
>> +[Service]
>> +Type=dbus
>> +BusName=net.connman
>> +Restart=on-failure
>> +ExecStartPre=-/usr/lib64/connman/wired-setup
>> +ExecStart=/usr/bin/connman-nfs
>
> Those hardcoded paths aren't going to work. And isn't:
>
Thanks, I will fix it.
> ConditionKernelCommandLine!=root=/dev/nfs
>
What is your meaning?
-Roy
> A lot cleaner to use in systemd?
>
--
Best Reagrds,
Roy | RongQing Li
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] connman: ignore the networking device which nfs for rootfs is working on
2013-10-16 0:46 ` Rongqing Li
@ 2013-10-16 8:54 ` Koen Kooi
2013-10-16 9:10 ` Rongqing Li
0 siblings, 1 reply; 13+ messages in thread
From: Koen Kooi @ 2013-10-16 8:54 UTC (permalink / raw)
To: Rongqing Li; +Cc: openembedded-core
Op 16 okt. 2013, om 02:46 heeft Rongqing Li <rongqing.li@windriver.com> het volgende geschreven:
>
>
> On 10/15/2013 06:10 PM, Koen Kooi wrote:
>>
>> Op 15 okt. 2013, om 10:12 heeft rongqing.li@windriver.com het volgende geschreven:
>>
>>> From: Roy Li <rongqing.li@windriver.com>
>>>
>>> Otherwise system will hang since nfs is not disconnected
>>>
>>> and remove the judgement of initscript DISTRO_FEATURE when install init
>>> script connman, because inherit systemd will remove init script
>>
>>> Signed-off-by: Roy Li <rongqing.li@windriver.com>
>>> ---
>>
>> [..]
>>
>>> diff --git a/meta/recipes-connectivity/connman/connman/connman-nfs.service b/meta/recipes-connectivity/connman/connman/connman-nfs.service
>>> new file mode 100644
>>> index 0000000..9f9b690
>>> --- /dev/null
>>> +++ b/meta/recipes-connectivity/connman/connman/connman-nfs.service
>>> @@ -0,0 +1,14 @@
>>> +[Unit]
>>> +Description=Connection service
>>> +After=syslog.target
>>> +
>>> +[Service]
>>> +Type=dbus
>>> +BusName=net.connman
>>> +Restart=on-failure
>>> +ExecStartPre=-/usr/lib64/connman/wired-setup
>>> +ExecStart=/usr/bin/connman-nfs
>>
>> Those hardcoded paths aren't going to work. And isn't:
>>
>
> Thanks, I will fix it.
>
>> ConditionKernelCommandLine!=root=/dev/nfs
>>
>
> What is your meaning?
That's you are creating a huge script that does something built into systemd.
>
> -Roy
>
>
>> A lot cleaner to use in systemd?
>>
>
> --
> Best Reagrds,
> Roy | RongQing Li
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] connman: ignore the networking device which nfs for rootfs is working on
2013-10-16 8:54 ` Koen Kooi
@ 2013-10-16 9:10 ` Rongqing Li
2013-10-16 9:13 ` Koen Kooi
2013-10-16 10:08 ` Enrico Scholz
0 siblings, 2 replies; 13+ messages in thread
From: Rongqing Li @ 2013-10-16 9:10 UTC (permalink / raw)
To: Koen Kooi; +Cc: openembedded-core
On 10/16/2013 04:54 PM, Koen Kooi wrote:
>>> ConditionKernelCommandLine!=root=/dev/nfs
>>> >>
>> >
>> >What is your meaning?
> That's you are creating a huge script that does something built into systemd.
>
Yes, I can not find a way to avoid to that,
Do you have any advice?
-Roy
--
Best Reagrds,
Roy | RongQing Li
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] connman: ignore the networking device which nfs for rootfs is working on
2013-10-16 9:10 ` Rongqing Li
@ 2013-10-16 9:13 ` Koen Kooi
2013-10-16 10:08 ` Enrico Scholz
1 sibling, 0 replies; 13+ messages in thread
From: Koen Kooi @ 2013-10-16 9:13 UTC (permalink / raw)
To: Rongqing Li; +Cc: openembedded-core
Op 16 okt. 2013, om 11:10 heeft Rongqing Li <rongqing.li@windriver.com> het volgende geschreven:
>
>
> On 10/16/2013 04:54 PM, Koen Kooi wrote:
>>>> ConditionKernelCommandLine!=root=/dev/nfs
>>>> >>
>>> >
>>> >What is your meaning?
>> That's you are creating a huge script that does something built into systemd.
>>
>
>
> Yes, I can not find a way to avoid to that,
>
> Do you have any advice?
Yes, as I said a few mails earlier: ConditionKernelCommandLine!=root=/dev/nfs
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] connman: ignore the networking device which nfs for rootfs is working on
2013-10-16 9:10 ` Rongqing Li
2013-10-16 9:13 ` Koen Kooi
@ 2013-10-16 10:08 ` Enrico Scholz
2013-10-17 3:29 ` Rongqing Li
1 sibling, 1 reply; 13+ messages in thread
From: Enrico Scholz @ 2013-10-16 10:08 UTC (permalink / raw)
To: openembedded-core
Rongqing Li <rongqing.li-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
writes:
>>>> ConditionKernelCommandLine!=root=/dev/nfs
>>>> >>
>>> >
>>> >What is your meaning?
>> That's you are creating a huge script that does something built into systemd.
>>
>
>
> Yes, I can not find a way to avoid to that,
>
> Do you have any advice?
I would split the cmdline generation into a dedicated one-shot service;
e.g. modify the original connman.service to have something like
[Service]
EnvironmentFile = -/run/connmand.env
ExecStart=/usr/sbin/connmand -n ${CONNMAND_OPTS}
The '/run/connmand.env' is created by a service with
[Unit]
Before = connman.service
ConditionKernelCommandLine!=root=/dev/nfs
[Service]
Type = oneshot
ExecStart = /usr/sbin/create-run-connmand.env
[Install]
WantedBy = connman.service
Enrico
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] connman: ignore the networking device which nfs for rootfs is working on
2013-10-16 10:08 ` Enrico Scholz
@ 2013-10-17 3:29 ` Rongqing Li
2013-10-17 10:34 ` Enrico Scholz
0 siblings, 1 reply; 13+ messages in thread
From: Rongqing Li @ 2013-10-17 3:29 UTC (permalink / raw)
To: Enrico Scholz, Patches and discussions about the oe-core layer
On 10/16/2013 06:08 PM, Enrico Scholz wrote:
> Rongqing Li <rongqing.li-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
> writes:
>
>>>>> ConditionKernelCommandLine!=root=/dev/nfs
>>>>>>>
>>>>>
>>>>> What is your meaning?
>>> That's you are creating a huge script that does something built into systemd.
>>>
>>
>>
>> Yes, I can not find a way to avoid to that,
>>
>> Do you have any advice?
>
> I would split the cmdline generation into a dedicated one-shot service;
> e.g. modify the original connman.service to have something like
>
> [Service]
> EnvironmentFile = -/run/connmand.env
> ExecStart=/usr/sbin/connmand -n ${CONNMAND_OPTS}
>
>
> The '/run/connmand.env' is created by a service with
>
> [Unit]
> Before = connman.service
> ConditionKernelCommandLine!=root=/dev/nfs
>
> [Service]
> Type = oneshot
> ExecStart = /usr/sbin/create-run-connmand.env
>
> [Install]
> WantedBy = connman.service
>
>
>
I test your method, but failed to start connmand,
it always report "hand over timeout", I think
it is caused by which the script run slow.
But I will follow your method, create two service.
the connman.service is run only when
ConditionKernelCommandLine!=root=/dev/nfs
other connman-nfs.service, which will start the
script to compute the ignored interface, is run
when ConditionKernelCommandLine=root=/dev/nfs
-Roy
> Enrico
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
>
--
Best Reagrds,
Roy | RongQing Li
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH] connman: ignore the networking device which nfs for rootfs is working on
@ 2013-10-17 8:12 rongqing.li
2013-10-17 8:24 ` Rongqing Li
2013-10-17 10:14 ` Koen Kooi
0 siblings, 2 replies; 13+ messages in thread
From: rongqing.li @ 2013-10-17 8:12 UTC (permalink / raw)
To: openembedded-core
From: Roy Li <rongqing.li@windriver.com>
Create connmand-nfs.service, which will run a script to ignore the
networking device when root is nfs.
Connmand-nfs.service will be run only when root is not nfs
Signed-off-by: Roy Li <rongqing.li@windriver.com>
---
meta/recipes-connectivity/connman/connman.inc | 17 +++++---
.../connman/connman/connmand-nfs | 42 ++++++++++++++++++++
.../connman/connman/nfs-connman.service | 15 +++++++
meta/recipes-connectivity/connman/connman_1.17.bb | 2 +
4 files changed, 70 insertions(+), 6 deletions(-)
create mode 100644 meta/recipes-connectivity/connman/connman/connmand-nfs
create mode 100644 meta/recipes-connectivity/connman/connman/nfs-connman.service
diff --git a/meta/recipes-connectivity/connman/connman.inc b/meta/recipes-connectivity/connman/connman.inc
index 37ce3ec..ebfef35 100644
--- a/meta/recipes-connectivity/connman/connman.inc
+++ b/meta/recipes-connectivity/connman/connman.inc
@@ -64,7 +64,7 @@ python __anonymous () {
d.setVar('SYSTEMD_PACKAGES', systemd_packages)
}
-SYSTEMD_SERVICE_${PN} = "connman.service"
+SYSTEMD_SERVICE_${PN} = "connman.service nfs-connman.service"
SYSTEMD_SERVICE_${PN}-vpn = "connman-vpn.service"
SYSTEMD_WIRED_SETUP = "ExecStartPre=-${libdir}/connman/wired-setup"
@@ -84,10 +84,15 @@ do_compile_append() {
}
do_install_append() {
- if ${@base_contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
- install -d ${D}${sysconfdir}/init.d
- install -m 0755 ${WORKDIR}/connman ${D}${sysconfdir}/init.d/connman
- sed -i s%@LIBDIR@%${libdir}% ${D}${sysconfdir}/init.d/connman
+ install -d ${D}${sysconfdir}/init.d
+ install -m 0755 ${WORKDIR}/connman ${D}${sysconfdir}/init.d/connman
+ sed -i s%@LIBDIR@%${libdir}% ${D}${sysconfdir}/init.d/connman
+
+ if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+ install -m 0755 ${WORKDIR}/connmand-nfs ${D}${sbindir}/
+ install -m 0644 ${WORKDIR}/nfs-connman.service ${D}/${systemd_unitdir}/system/
+ sed -i "3 i ConditionKernelCommandLine=!root=/dev/nfs" \
+ ${D}${systemd_unitdir}/system/connman.service
fi
install -d ${D}${bindir}
@@ -165,7 +170,7 @@ FILES_${PN} = "${bindir}/* ${sbindir}/* ${libexecdir}/* ${libdir}/lib*.so.* \
${libdir}/connman/plugins \
${sysconfdir} ${sharedstatedir} ${localstatedir} \
${base_bindir}/* ${base_sbindir}/* ${base_libdir}/*.so* ${datadir}/${PN} \
- ${datadir}/dbus-1/system-services/*"
+ ${datadir}/dbus-1/system-services/* ${systemd_unitdir}/system/nfs-connman.service"
FILES_${PN}-dbg += "${libdir}/connman/*/.debug"
diff --git a/meta/recipes-connectivity/connman/connman/connmand-nfs b/meta/recipes-connectivity/connman/connman/connmand-nfs
new file mode 100644
index 0000000..1058787
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman/connmand-nfs
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+nfsroot=0
+
+exec 9<&0 < /proc/mounts
+while read dev mtpt fstype rest; do
+ if test $mtpt = "/" ; then
+ case $fstype in
+ nfs | nfs4)
+ nfsroot=1
+ break
+ ;;
+ *)
+ ;;
+ esac
+ fi
+done
+
+EXTRA_PARAM=""
+if test $nfsroot -eq 1 ; then
+ NET_DEVS=`cat /proc/net/dev | sed -ne 's/^\([a-zA-Z0-9 ]*\):.*$/\1/p'`
+ NET_ADDR=`cat /proc/cmdline | sed -ne 's/^.*ip=\([^ :]*\).*$/\1/p'`
+
+ if [ ! -z "$NET_ADDR" ]; then
+ if [ "$NET_ADDR" = dhcp ]; then
+ ethn=`ifconfig | grep "^eth" | sed -e "s/\(eth[0-9]\)\(.*\)/\1/"`
+ if [ ! -z "$ethn" ]; then
+ EXTRA_PARAM="-I $ethn"
+ fi
+ else
+ for i in $NET_DEVS; do
+ ADDR=`ifconfig $i | sed 's/addr://g' | sed -ne 's/^.*inet \([0-9.]*\) .*$/\1/p'`
+ if [ "$NET_ADDR" = "$ADDR" ]; then
+ EXTRA_PARAM="-I $i"
+ break
+ fi
+ done
+ fi
+ fi
+fi
+
+/usr/sbin/connmand -n $EXTRA_PARAM
diff --git a/meta/recipes-connectivity/connman/connman/nfs-connman.service b/meta/recipes-connectivity/connman/connman/nfs-connman.service
new file mode 100644
index 0000000..1cb82b8
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman/nfs-connman.service
@@ -0,0 +1,15 @@
+[Unit]
+Description=Connection service when root is /dev/nfs
+ConditionKernelCommandLine=root=/dev/nfs
+After=syslog.target
+
+[Service]
+Type=dbus
+BusName=net.connman
+Restart=on-failure
+ExecStartPre=-/usr/lib64/connman/wired-setup
+ExecStart=/bin/sh /usr/sbin/connmand-nfs
+StandardOutput=null
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta/recipes-connectivity/connman/connman_1.17.bb b/meta/recipes-connectivity/connman/connman_1.17.bb
index 461157f..9e8112c 100644
--- a/meta/recipes-connectivity/connman/connman_1.17.bb
+++ b/meta/recipes-connectivity/connman/connman_1.17.bb
@@ -4,6 +4,8 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/network/${BPN}/${BP}.tar.xz \
file://0001-plugin.h-Change-visibility-to-default-for-debug-symb.patch \
file://add_xuser_dbus_permission.patch \
file://connman \
+ file://connmand-nfs \
+ file://nfs-connman.service \
"
SRC_URI[md5sum] = "dd4a13f789de1b69fcddf0cf613f2d5b"
--
1.7.10.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] connman: ignore the networking device which nfs for rootfs is working on
2013-10-17 8:12 rongqing.li
@ 2013-10-17 8:24 ` Rongqing Li
2013-10-17 10:14 ` Koen Kooi
1 sibling, 0 replies; 13+ messages in thread
From: Rongqing Li @ 2013-10-17 8:24 UTC (permalink / raw)
To: rongqing.li; +Cc: openembedded-core
Drop it, the commit header is wrong
On 10/17/2013 04:12 PM, rongqing.li@windriver.com wrote:
> From: Roy Li <rongqing.li@windriver.com>
>
> Create connmand-nfs.service, which will run a script to ignore the
> networking device when root is nfs.
> Connmand-nfs.service will be run only when root is not nfs
>
> Signed-off-by: Roy Li <rongqing.li@windriver.com>
> ---
> meta/recipes-connectivity/connman/connman.inc | 17 +++++---
> .../connman/connman/connmand-nfs | 42 ++++++++++++++++++++
> .../connman/connman/nfs-connman.service | 15 +++++++
> meta/recipes-connectivity/connman/connman_1.17.bb | 2 +
> 4 files changed, 70 insertions(+), 6 deletions(-)
> create mode 100644 meta/recipes-connectivity/connman/connman/connmand-nfs
> create mode 100644 meta/recipes-connectivity/connman/connman/nfs-connman.service
>
> diff --git a/meta/recipes-connectivity/connman/connman.inc b/meta/recipes-connectivity/connman/connman.inc
> index 37ce3ec..ebfef35 100644
> --- a/meta/recipes-connectivity/connman/connman.inc
> +++ b/meta/recipes-connectivity/connman/connman.inc
> @@ -64,7 +64,7 @@ python __anonymous () {
> d.setVar('SYSTEMD_PACKAGES', systemd_packages)
> }
>
> -SYSTEMD_SERVICE_${PN} = "connman.service"
> +SYSTEMD_SERVICE_${PN} = "connman.service nfs-connman.service"
> SYSTEMD_SERVICE_${PN}-vpn = "connman-vpn.service"
> SYSTEMD_WIRED_SETUP = "ExecStartPre=-${libdir}/connman/wired-setup"
>
> @@ -84,10 +84,15 @@ do_compile_append() {
> }
>
> do_install_append() {
> - if ${@base_contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
> - install -d ${D}${sysconfdir}/init.d
> - install -m 0755 ${WORKDIR}/connman ${D}${sysconfdir}/init.d/connman
> - sed -i s%@LIBDIR@%${libdir}% ${D}${sysconfdir}/init.d/connman
> + install -d ${D}${sysconfdir}/init.d
> + install -m 0755 ${WORKDIR}/connman ${D}${sysconfdir}/init.d/connman
> + sed -i s%@LIBDIR@%${libdir}% ${D}${sysconfdir}/init.d/connman
> +
> + if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then
> + install -m 0755 ${WORKDIR}/connmand-nfs ${D}${sbindir}/
> + install -m 0644 ${WORKDIR}/nfs-connman.service ${D}/${systemd_unitdir}/system/
> + sed -i "3 i ConditionKernelCommandLine=!root=/dev/nfs" \
> + ${D}${systemd_unitdir}/system/connman.service
> fi
>
> install -d ${D}${bindir}
> @@ -165,7 +170,7 @@ FILES_${PN} = "${bindir}/* ${sbindir}/* ${libexecdir}/* ${libdir}/lib*.so.* \
> ${libdir}/connman/plugins \
> ${sysconfdir} ${sharedstatedir} ${localstatedir} \
> ${base_bindir}/* ${base_sbindir}/* ${base_libdir}/*.so* ${datadir}/${PN} \
> - ${datadir}/dbus-1/system-services/*"
> + ${datadir}/dbus-1/system-services/* ${systemd_unitdir}/system/nfs-connman.service"
>
> FILES_${PN}-dbg += "${libdir}/connman/*/.debug"
>
> diff --git a/meta/recipes-connectivity/connman/connman/connmand-nfs b/meta/recipes-connectivity/connman/connman/connmand-nfs
> new file mode 100644
> index 0000000..1058787
> --- /dev/null
> +++ b/meta/recipes-connectivity/connman/connman/connmand-nfs
> @@ -0,0 +1,42 @@
> +#!/bin/sh
> +
> +nfsroot=0
> +
> +exec 9<&0 < /proc/mounts
> +while read dev mtpt fstype rest; do
> + if test $mtpt = "/" ; then
> + case $fstype in
> + nfs | nfs4)
> + nfsroot=1
> + break
> + ;;
> + *)
> + ;;
> + esac
> + fi
> +done
> +
> +EXTRA_PARAM=""
> +if test $nfsroot -eq 1 ; then
> + NET_DEVS=`cat /proc/net/dev | sed -ne 's/^\([a-zA-Z0-9 ]*\):.*$/\1/p'`
> + NET_ADDR=`cat /proc/cmdline | sed -ne 's/^.*ip=\([^ :]*\).*$/\1/p'`
> +
> + if [ ! -z "$NET_ADDR" ]; then
> + if [ "$NET_ADDR" = dhcp ]; then
> + ethn=`ifconfig | grep "^eth" | sed -e "s/\(eth[0-9]\)\(.*\)/\1/"`
> + if [ ! -z "$ethn" ]; then
> + EXTRA_PARAM="-I $ethn"
> + fi
> + else
> + for i in $NET_DEVS; do
> + ADDR=`ifconfig $i | sed 's/addr://g' | sed -ne 's/^.*inet \([0-9.]*\) .*$/\1/p'`
> + if [ "$NET_ADDR" = "$ADDR" ]; then
> + EXTRA_PARAM="-I $i"
> + break
> + fi
> + done
> + fi
> + fi
> +fi
> +
> +/usr/sbin/connmand -n $EXTRA_PARAM
> diff --git a/meta/recipes-connectivity/connman/connman/nfs-connman.service b/meta/recipes-connectivity/connman/connman/nfs-connman.service
> new file mode 100644
> index 0000000..1cb82b8
> --- /dev/null
> +++ b/meta/recipes-connectivity/connman/connman/nfs-connman.service
> @@ -0,0 +1,15 @@
> +[Unit]
> +Description=Connection service when root is /dev/nfs
> +ConditionKernelCommandLine=root=/dev/nfs
> +After=syslog.target
> +
> +[Service]
> +Type=dbus
> +BusName=net.connman
> +Restart=on-failure
> +ExecStartPre=-/usr/lib64/connman/wired-setup
> +ExecStart=/bin/sh /usr/sbin/connmand-nfs
> +StandardOutput=null
> +
> +[Install]
> +WantedBy=multi-user.target
> diff --git a/meta/recipes-connectivity/connman/connman_1.17.bb b/meta/recipes-connectivity/connman/connman_1.17.bb
> index 461157f..9e8112c 100644
> --- a/meta/recipes-connectivity/connman/connman_1.17.bb
> +++ b/meta/recipes-connectivity/connman/connman_1.17.bb
> @@ -4,6 +4,8 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/network/${BPN}/${BP}.tar.xz \
> file://0001-plugin.h-Change-visibility-to-default-for-debug-symb.patch \
> file://add_xuser_dbus_permission.patch \
> file://connman \
> + file://connmand-nfs \
> + file://nfs-connman.service \
> "
>
> SRC_URI[md5sum] = "dd4a13f789de1b69fcddf0cf613f2d5b"
>
--
Best Reagrds,
Roy | RongQing Li
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] connman: ignore the networking device which nfs for rootfs is working on
2013-10-17 8:12 rongqing.li
2013-10-17 8:24 ` Rongqing Li
@ 2013-10-17 10:14 ` Koen Kooi
1 sibling, 0 replies; 13+ messages in thread
From: Koen Kooi @ 2013-10-17 10:14 UTC (permalink / raw)
To: rongqing.li; +Cc: openembedded-core
Op 17 okt. 2013, om 10:12 heeft rongqing.li@windriver.com het volgende geschreven:
> From: Roy Li <rongqing.li@windriver.com>
>
> Create connmand-nfs.service, which will run a script to ignore the
> networking device when root is nfs.
> Connmand-nfs.service will be run only when root is not nfs
You when it *is* on nfs, since the it tests for root=/dev/nfs being present
> diff --git a/meta/recipes-connectivity/connman/connman/nfs-connman.service b/meta/recipes-connectivity/connman/connman/nfs-connman.service
> new file mode 100644
> index 0000000..1cb82b8
> --- /dev/null
> +++ b/meta/recipes-connectivity/connman/connman/nfs-connman.service
> @@ -0,0 +1,15 @@
> +[Unit]
> +Description=Connection service when root is /dev/nfs
> +ConditionKernelCommandLine=root=/dev/nfs
> +After=syslog.target
> +
> +[Service]
> +Type=dbus
> +BusName=net.connman
> +Restart=on-failure
> +ExecStartPre=-/usr/lib64/connman/wired-setup
> +ExecStart=/bin/sh /usr/sbin/connmand-nfs
And as I said before, these hardcoded paths are not going to work.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] connman: ignore the networking device which nfs for rootfs is working on
2013-10-17 3:29 ` Rongqing Li
@ 2013-10-17 10:34 ` Enrico Scholz
0 siblings, 0 replies; 13+ messages in thread
From: Enrico Scholz @ 2013-10-17 10:34 UTC (permalink / raw)
To: Rongqing Li; +Cc: Patches and discussions about the oe-core layer
Rongqing Li <rongqing.li@windriver.com> writes:
>>> Do you have any advice?
>>
>> I would split the cmdline generation into a dedicated one-shot service;
>> e.g. modify the original connman.service to have something like
> ...
> I test your method, but failed to start connmand,
> it always report "hand over timeout", I think
> it is caused by which the script run slow.
strange; I just tested it with
--- connman.service ---
[Unit]
Description=Connection service
After=syslog.target
Wants = connman-env.service
[Service]
Type=dbus
BusName=net.connman
EnvironmentFile = -/run/connmand.env
ExecStart=/usr/sbin/connmand -n $CONNMAND_OPTS
[Install]
WantedBy=multi-user.target
--- connman-env.service ---
[Unit]
Before = connman.service
ConditionKernelCommandLine = root=/dev/nfs
[Service]
Type = oneshot
ExecStart = /bin/sh -c 'echo CONNMAND_OPTS=\\"--noipconfig=eth0\\" > /run/connmand.env'
[Install]
WantedBy = connman.service
which works fine. Of course, this is just a quick hack and needs some changes
(replacement of inline shell script, perhaps setting RemainAfterExit, using
'systemctl enable' instead of 'Wants = connman-env.service')
Enrico
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH] connman: ignore the networking device which nfs for rootfs is working on
@ 2013-10-18 9:20 rongqing.li
0 siblings, 0 replies; 13+ messages in thread
From: rongqing.li @ 2013-10-18 9:20 UTC (permalink / raw)
To: openembedded-core
From: Roy Li <rongqing.li@windriver.com>
Create connman-evn.service, which will run a script to compute the networking
device when nfs root is on, and pass the result to connman.service
Copy Connmand.service from source code, add ExecStartPre into it to release
do_configure_append work, use the options which is passed by connman-evn.service
Signed-off-by: Roy Li <rongqing.li@windriver.com>
---
meta/recipes-connectivity/connman/connman.inc | 18 ++++++++------
.../connman/connman/connman-env.service | 13 ++++++++++
.../connman/connman/connman.service | 14 +++++++++++
.../connman/connman/connmand-env | 25 ++++++++++++++++++++
meta/recipes-connectivity/connman/connman_1.18.bb | 3 +++
5 files changed, 66 insertions(+), 7 deletions(-)
create mode 100644 meta/recipes-connectivity/connman/connman/connman-env.service
create mode 100644 meta/recipes-connectivity/connman/connman/connman.service
create mode 100644 meta/recipes-connectivity/connman/connman/connmand-env
diff --git a/meta/recipes-connectivity/connman/connman.inc b/meta/recipes-connectivity/connman/connman.inc
index 12f3edd..c2d71e0 100644
--- a/meta/recipes-connectivity/connman/connman.inc
+++ b/meta/recipes-connectivity/connman/connman.inc
@@ -64,15 +64,9 @@ python __anonymous () {
SYSTEMD_SERVICE_${PN} = "connman.service"
SYSTEMD_SERVICE_${PN}-vpn = "connman-vpn.service"
-SYSTEMD_WIRED_SETUP = "ExecStartPre=-${libdir}/connman/wired-setup"
inherit autotools gtk-doc pkgconfig systemd update-rc.d
-do_configure_append () {
- sed -i "s#ExecStart=#${SYSTEMD_WIRED_SETUP}\nExecStart=#" ${S}/src/connman.service
-
-}
-
# This allows *everyone* to access ConnMan over DBus, without any access
# control. Really the at_console flag should work, which would mean that
# both this and the xuser patch can be dropped.
@@ -88,6 +82,16 @@ do_install_append() {
sed -i s%@LIBDIR@%${libdir}% ${D}${sysconfdir}/init.d/connman
fi
+ if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+ install -m 0755 ${WORKDIR}/connmand-env ${D}${sbindir}/
+ install -m 0644 ${WORKDIR}/connman-env.service ${D}/${systemd_unitdir}/system/
+ install -m 0644 ${WORKDIR}/connman.service ${D}/${systemd_unitdir}/system/
+ sed -i -e 's,@SBINDIR@,${sbindir},g' \
+ -e 's,@LIBDIR@,${libdir},g' \
+ -e 's,@LOCALSTATEDIR@,${localstatedir},g' \
+ ${D}${systemd_unitdir}/system/*.service
+ fi
+
install -d ${D}${bindir}
install -m 0755 ${S}/tools/*-test ${D}${bindir}
if [ -e ${S}/tools/wispr ]; then
@@ -163,7 +167,7 @@ FILES_${PN} = "${bindir}/* ${sbindir}/* ${libexecdir}/* ${libdir}/lib*.so.* \
${libdir}/connman/plugins \
${sysconfdir} ${sharedstatedir} ${localstatedir} \
${base_bindir}/* ${base_sbindir}/* ${base_libdir}/*.so* ${datadir}/${PN} \
- ${datadir}/dbus-1/system-services/*"
+ ${datadir}/dbus-1/system-services/* ${systemd_unitdir}/system/connman-env.service"
FILES_${PN}-dbg += "${libdir}/connman/*/.debug"
diff --git a/meta/recipes-connectivity/connman/connman/connman-env.service b/meta/recipes-connectivity/connman/connman/connman-env.service
new file mode 100644
index 0000000..c4dc278
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman/connman-env.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Generate options for connection service
+Before=connman.service
+ConditionKernelCommandLine=root=/dev/nfs
+After=syslog.target
+
+[Service]
+Type=oneshot
+ExecStart=@SBINDIR@/connmand-env
+StandardOutput=null
+
+[Install]
+WantedBy=connman.service
diff --git a/meta/recipes-connectivity/connman/connman/connman.service b/meta/recipes-connectivity/connman/connman/connman.service
new file mode 100644
index 0000000..aa0e49a
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman/connman.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Connection service
+After=syslog.target
+Wants=connman-env.service
+
+[Service]
+Type=dbus
+BusName=net.connman
+EnvironmentFile=-@LOCALSTATEDIR@/run/connmand.env
+ExecStartPre=-@LIBDIR@/connman/wired-setup
+ExecStart=@SBINDIR@/connmand -n $CONNMAND_OPTS
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta/recipes-connectivity/connman/connman/connmand-env b/meta/recipes-connectivity/connman/connman/connmand-env
new file mode 100644
index 0000000..e047754
--- /dev/null
+++ b/meta/recipes-connectivity/connman/connman/connmand-env
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+EXTRA_PARAM=""
+
+NET_DEVS=`cat /proc/net/dev | sed -ne 's/^\([a-zA-Z0-9 ]*\):.*$/\1/p'`
+NET_ADDR=`cat /proc/cmdline | sed -ne 's/^.*ip=\([^ :]*\).*$/\1/p'`
+
+if [ ! -z "$NET_ADDR" ]; then
+ if [ "$NET_ADDR" = dhcp ]; then
+ ethn=`ifconfig | grep "^eth" | sed -e "s/\(eth[0-9]\)\(.*\)/\1/"`
+ if [ ! -z "$ethn" ]; then
+ EXTRA_PARAM="-I $ethn"
+ fi
+ else
+ for i in $NET_DEVS; do
+ ADDR=`ifconfig $i | sed 's/addr://g' | sed -ne 's/^.*inet \([0-9.]*\) .*$/\1/p'`
+ if [ "$NET_ADDR" = "$ADDR" ]; then
+ EXTRA_PARAM="-I $i"
+ break
+ fi
+ done
+ fi
+fi
+
+echo "CONNMAND_OPTS=$EXTRA_PARAM">/run/connmand.env
diff --git a/meta/recipes-connectivity/connman/connman_1.18.bb b/meta/recipes-connectivity/connman/connman_1.18.bb
index 44a4a07..eee8116 100644
--- a/meta/recipes-connectivity/connman/connman_1.18.bb
+++ b/meta/recipes-connectivity/connman/connman_1.18.bb
@@ -4,6 +4,9 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/network/${BPN}/${BP}.tar.xz \
file://0001-plugin.h-Change-visibility-to-default-for-debug-symb.patch \
file://add_xuser_dbus_permission.patch \
file://connman \
+ file://connmand-env \
+ file://connman.service \
+ file://connman-env.service \
"
SRC_URI[md5sum] = "7578ec8f0422d34f5a4ba51b605fe576"
--
1.7.10.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
end of thread, other threads:[~2013-10-18 9:20 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-15 8:12 [PATCH] connman: ignore the networking device which nfs for rootfs is working on rongqing.li
2013-10-15 10:10 ` Koen Kooi
2013-10-16 0:46 ` Rongqing Li
2013-10-16 8:54 ` Koen Kooi
2013-10-16 9:10 ` Rongqing Li
2013-10-16 9:13 ` Koen Kooi
2013-10-16 10:08 ` Enrico Scholz
2013-10-17 3:29 ` Rongqing Li
2013-10-17 10:34 ` Enrico Scholz
-- strict thread matches above, loose matches on Subject: below --
2013-10-17 8:12 rongqing.li
2013-10-17 8:24 ` Rongqing Li
2013-10-17 10:14 ` Koen Kooi
2013-10-18 9:20 rongqing.li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox