summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormis2021-09-11 11:56:05 (GMT)
committerJan Rękorajski2021-09-11 11:56:05 (GMT)
commitfb625e1822f3f6c8cb9d275b9c7af52eab9f7815 (patch)
tree4eaad87de6333d3943231abf20451a9e9d08dbf4
parenta91073533505e510084c01a09648200e0488e94b (diff)
downloadrc-scripts-fb625e1822f3f6c8cb9d275b9c7af52eab9f7815.zip
rc-scripts-fb625e1822f3f6c8cb9d275b9c7af52eab9f7815.tar.gz
Container related fixes
- check lsmod existence before use - check if loopback has assigned address already (lxd initializes loopback upfront)
-rw-r--r--lib/functions3
-rw-r--r--lib/functions.network3
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/functions b/lib/functions
index 3b97077..d1b6c1e 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 867c2d6..3cd4878 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