[projects/rc-scripts] Container related fixes
baggins
baggins at pld-linux.org
Sat Sep 11 19:58:22 CEST 2021
commit fb625e1822f3f6c8cb9d275b9c7af52eab9f7815
Author: mis <mis at pld-linux.org>
Date: Sat Sep 11 13:56:05 2021 +0200
Container related fixes
- check lsmod existence before use
- check if loopback has assigned address already (lxd initializes loopback upfront)
lib/functions | 3 +++
lib/functions.network | 3 ++-
2 files changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/lib/functions b/lib/functions
index 3b97077b..d1b6c1eb 100644
--- a/lib/functions
+++ b/lib/functions
@@ -1093,6 +1093,9 @@ confirm() {
# module is needed (ie. is requested, is available and isn't loaded already)
is_module() {
+ # fail if /sbin/lsmod does not exists (ex. in containers)
+ [ -x /sbin/lsmod ] || return 1
+
# 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/lib/functions.network b/lib/functions.network
index 867c2d6e..3cd48786 100644
--- a/lib/functions.network
+++ b/lib/functions.network
@@ -345,7 +345,8 @@ setup_routes()
# 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/projects/rc-scripts.git/commitdiff/fb625e1822f3f6c8cb9d275b9c7af52eab9f7815
More information about the pld-cvs-commit
mailing list