Package init

This commit is contained in:
dogsheng 2019-12-25 15:50:02 +08:00
parent aff0ec4895
commit 075d855b82
3 changed files with 111 additions and 1 deletions

View File

@ -0,0 +1,27 @@
From 4d6de26edd04640c326a5117032f9a088353be58 Mon Sep 17 00:00:00 2001
From: chenzhen <chenzhen44@huawei.com>
Date: Thu, 21 Nov 2019 12:13:27 -0500
Subject: [PATCH] exec udevadm settle when network start
---
etc/rc.d/init.d/network | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/etc/rc.d/init.d/network b/etc/rc.d/init.d/network
index fa371ca..dfe5b83 100755
--- a/etc/rc.d/init.d/network
+++ b/etc/rc.d/init.d/network
@@ -61,6 +61,10 @@ export DEPRECATION_WARNING_ISSUED='true'
# See how we were called.
case "$1" in
start)
+ if [ -x /usr/sbin/udevadm ]; then
+ /usr/sbin/udevadm settle
+ fi
+
[ "$EUID" != "0" ] && exit 4
rc=0
# IPv6 hook (pre IPv4 start)
--
2.19.1

View File

@ -20,7 +20,7 @@ Requires: gawk \
Name: initscripts Name: initscripts
Summary: Basic support for legacy System V init scripts Summary: Basic support for legacy System V init scripts
Version: 10.01 Version: 10.01
Release: 3 Release: 4
License: GPLv2 License: GPLv2
@ -92,6 +92,8 @@ Patch9002: bugfix-mod-network-function-when-NM-unmanage-devices.patch
Patch9003: bugfix-initscripts-set-PERSISTENT_DHCLIENT-default-to-yes.patch Patch9003: bugfix-initscripts-set-PERSISTENT_DHCLIENT-default-to-yes.patch
Patch9004: bugfix-network-need-chkconfig-on.patch Patch9004: bugfix-network-need-chkconfig-on.patch
Patch9005: bugfix-restart-network-warning.patch Patch9005: bugfix-restart-network-warning.patch
Patch9006: new-network-fork-to-start-dhcp.patch
Patch9007: exec-udevadm-settle-when-network-start.patch
%description %description
This package provides basic support for legacy System V init scripts, and some This package provides basic support for legacy System V init scripts, and some
@ -358,6 +360,12 @@ fi
# ============================================================================= # =============================================================================
%changelog %changelog
* Mon Dec 16 2019 openEuler Buildteam <buildteam@openeuler.org> - 10.01-4
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:execute udevadm settle when network starts and network fork to start dhcp process
* Mon Sep 23 2019 jiangchuangang <jiangchuangang@huawei.com> - 10.01-3 * Mon Sep 23 2019 jiangchuangang <jiangchuangang@huawei.com> - 10.01-3
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA

View File

@ -0,0 +1,75 @@
From ad95c2dae06794a37e500e07e13cee8328ddfb5d Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Tue, 24 Sep 2019 17:39:52 +0800
Subject: [PATCH] initscripts: add network start dhcp process background
reason:add network start dhcp process background
Signed-off-by: rpm-build <rpm-build>
---
etc/rc.d/init.d/network | 36 +++++++++++++++++++++++++++++++-----
1 file changed, 31 insertions(+), 5 deletions(-)
diff --git a/etc/rc.d/init.d/network b/etc/rc.d/init.d/network
index 97e6ed1..5f95ee0 100755
--- a/etc/rc.d/init.d/network
+++ b/etc/rc.d/init.d/network
@@ -49,6 +49,8 @@ interfaces=$(ls ifcfg-* | \
LC_ALL=C sed 's/ //')
rc=0
+godamon=0
+
net_log $"You are using 'network' service provided by 'network-scripts', which are now deprecated." warning network >&2
net_log $"'network-scripts' will be removed from distribution in near future." warning network >&2
net_log $"It is advised to switch to 'NetworkManager' instead for network management." warning network >&2
@@ -131,17 +133,41 @@ start)
is_available $i
continue
fi
- action $"Bringing up interface $i: " ./ifup $i boot
- [ $? -ne 0 ] && rc=1
+ if [ "$godamon" != "1" ] ; then
+ action $"Bringing up interface $i: " ./ifup $i boot
+ [ $? -ne 0 ] && rc=1
+ else
+ action $"Bringing up interface $i: " ./ifup $i boot &
+ fi
+
+
done
# Bring up xDSL and VPN interfaces
for i in $vlaninterfaces $bridgeinterfaces $xdslinterfaces $vpninterfaces ; do
if ! LANG=C grep -EL "^ONBOOT=['\"]?[Nn][Oo]['\"]?" ifcfg-$i >/dev/null 2>&1 ; then
- action $"Bringing up interface $i: " ./ifup $i boot
- [ $? -ne 0 ] && rc=1
- fi
+ if [ "$godamon" != "1" ] ; then
+ action $"Bringing up interface $i: " ./ifup $i boot
+ [ $? -ne 0 ] && rc=1
+ else
+ action $"Bringing up interface $i: " ./ifup $i boot &
+ fi
+ fi
done
+ # Waiting until all background process done
+ if [ "$godamon" = "1" ] ; then
+ for pid in $(jobs -p)
+ do
+ wait $pid
+ status=$?
+ if [ $status != 0 ] ;then
+ net_log "Unable to obtain DHCP addresas."
+ rc=1
+ continue
+ fi
+ rc=0
+ done
+ fi
# Add non interface-specific static-routes.
if [ -f /etc/sysconfig/static-routes ]; then
--
2.19.1