[packages/rc-scripts] container related fixes: - check lsmod existence before use - check if loopback has assigned addre

mis mis at pld-linux.org
Fri Mar 13 12:59:31 CET 2020


commit 24583301ba709583dd18b4a087ca1682d39c46a0
Author: mis <mis at pld-linux.org>
Date:   Fri Mar 13 12:22:22 2020 +0100

    container related fixes:
     - check lsmod existence before use
     - check if loopback has assigned address already (lxd initializes
       loopback upfront)

 lsmod-fix.patch    | 12 ++++++++++++
 lxd-loopback.patch | 12 ++++++++++++
 rc-scripts.spec    |  6 +++++-
 3 files changed, 29 insertions(+), 1 deletion(-)
---
diff --git a/rc-scripts.spec b/rc-scripts.spec
index 0ffd424..4dfad04 100644
--- a/rc-scripts.spec
+++ b/rc-scripts.spec
@@ -11,7 +11,7 @@ Summary(pl.UTF-8):	inittab i skrypty startowe z katalogu /etc/rc.d
 Summary(tr.UTF-8):	inittab ve /etc/rc.d dosyaları
 Name:		rc-scripts
 Version:	0.4.19
-Release:	1
+Release:	2
 License:	GPL v2
 Group:		Base
 #Source0:	ftp://distfiles.pld-linux.org/src/%{name}-%{version}.tar.gz
@@ -20,6 +20,8 @@ Source0:	%{name}-%{version}.tar.gz
 Source1:	rc-local.service
 Source2:	sys-chroots.service
 Source3:	%{name}.tmpfiles
+Patch0:		lsmod-fix.patch
+Patch1:		lxd-loopback.patch
 URL:		http://svn.pld-linux.org/trac/svn/wiki/packages/rc-scripts
 BuildRequires:	autoconf
 BuildRequires:	automake
@@ -139,6 +141,8 @@ po cichu ignorowane.
 
 %prep
 %setup -q
+%patch0 -p0
+%patch1 -p0
 
 # hack, currently this results in errno@@GLIBC_PRIVATE symbol in ppp-watch:
 #GLIB_LIBS="-Wl,-static `$PKG_CONFIG --libs --static glib-2.0` -Wl,-Bdynamic"
diff --git a/lsmod-fix.patch b/lsmod-fix.patch
new file mode 100644
index 0000000..5491296
--- /dev/null
+++ b/lsmod-fix.patch
@@ -0,0 +1,12 @@
+--- lib/functions	2020-02-08 10:48:07.000000000 +0100
++++ lib/functions.lsmod	2020-03-13 10:59:06.029459498 +0100
+@@ -1106,6 +1106,9 @@
+
+ # module is needed (ie. is requested, is available and isn't loaded already)
+ is_module() {
++	# return false if /sbin/lsmod not exists (like in containers)
++	[ -x /sbin/lsmod ] || return 0
++
+ 	# module name without .o at end
+ 	if ! lsmod | grep -q "$1"; then
+ 		if ls -1R /lib/modules/$(uname -r)/ 2> /dev/null | grep -q "^${1}.\(\|k\)o\(\|.gz\)"; then
diff --git a/lxd-loopback.patch b/lxd-loopback.patch
new file mode 100644
index 0000000..daeb475
--- /dev/null
+++ b/lxd-loopback.patch
@@ -0,0 +1,12 @@
+--- lib/functions.network	2020-02-08 10:48:07.000000000 +0100
++++ lib/functions.network.loopback	2020-03-13 11:19:35.602818930 +0100
+@@ -345,7 +345,8 @@
+ # Add ONLY IPv4 address (IPv6 address is added automaticly)
+ set_up_loopback()
+ {
+-	if is_yes "$IPV4_NETWORKING"; then
++	# test if addr is assigned already as lxd(lxc?) initializes loopback upfront
++	if is_yes "$IPV4_NETWORKING" && ! ip addr show lo | grep -q "127\.0\.0\.1"; then
+ 		ip addr add 127.0.0.1/8 dev lo
+ 	fi
+ 	ip link set dev lo up
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rc-scripts.git/commitdiff/24583301ba709583dd18b4a087ca1682d39c46a0



More information about the pld-cvs-commit mailing list