slackware-current/source/n/network-scripts/0000-rc.inet1.new-lxc-additions.patch
Patrick J Volkerding 5f74398bf9 Thu Nov 11 20:36:12 UTC 2021
a/sdparm-1.12-x86_64-2.txz:  Rebuilt.
  Recompiled against sg3_utils-1.47.
a/sysvinit-scripts-15.0-noarch-6.txz:  Rebuilt.
  rc.{6,S,M}: merged changes for compatibility with LXC containers.
a/udisks-1.0.5-x86_64-10.txz:  Rebuilt.
  Recompiled against sg3_utils-1.47.
ap/lxc-4.0.11-x86_64-1.txz:  Upgraded.
  Requires libseccomp-2.5.3.
  No more local versions of rc.{6,S,M,inet1}: the regular versions work now.
l/elfutils-0.186-x86_64-1.txz:  Upgraded.
l/libgpod-0.8.3-x86_64-11.txz:  Rebuilt.
  Recompiled against sg3_utils-1.47.
l/libseccomp-2.5.3-x86_64-1.txz:  Added.
  This is needed by lxc-4.0.11. Thanks to Willy Sudiarto Raharjo.
l/sg3_utils-1.47-x86_64-1.txz:  Upgraded.
  Shared library .so-version bump.
n/network-scripts-15.0-noarch-17.txz:  Rebuilt.
  Merged changes in rc.inet1 to make it compatible with LXC containers.
  Patched netconfig to ensure the proper permissions on rc.networkmanager
  when NetworkManager is not chosen.
x/ibus-1.5.25-x86_64-4.txz:  Rebuilt.
  [PATCH] client/gtk2/ibusimcontext: Fix wrong cursor location in gtk3 apps.
  Thanks to Lockywolf.
2021-11-12 08:59:57 +01:00

39 lines
1.9 KiB
Diff

From 2ef0c19e3ebfd99c1c89bf13dee0ec198c5ef559 Mon Sep 17 00:00:00 2001
From: Patrick J. Volkerding <volkerdi@slackware.com>
Date: Wed, 10 Nov 2021 16:22:43 -0600
Subject: [PATCH] Skip bridge and bond configuration in LXC container
Add LXC detection at the beginning of the script to set container="lxc" if an
LXC container is detected. Later, use this to skip bridge and bond creation in
an LXC container. Patched script works in both LXC and on bare metal.
--- ./etc/rc.d/rc.inet1.new.orig 2021-03-08 18:13:50.484386646 -0600
+++ ./etc/rc.d/rc.inet1.new 2021-11-10 02:32:58.780223136 -0600
@@ -2,7 +2,14 @@
# /etc/rc.d/rc.inet1
# This script is used to bring up the various network interfaces.
#
-# @(#)/etc/rc.d/rc.inet1 10.2 Sun Jul 24 12:45:56 PDT 2005 (pjv)
+# @(#)/etc/rc.d/rc.inet1 15.0 Wed Nov 10 08:17:22 UTC 2021 (pjv)
+
+# If we are in an lxc container, set $container to skip parts of the script.
+# Thanks to Matteo Bernardini <ponce@slackbuilds.org> and Chris Willing for
+# the initial work making this script lxc compatible.
+if grep -aq container=lxc /proc/1/environ 2> /dev/null ; then
+ container="lxc"
+fi
############################
# READ NETWORK CONFIG FILE #
@@ -254,9 +261,9 @@
# bond or bridge, configure the interfaces with IPs of 0.0.0.0 and set the
# MAC address with HWADDR. Then, finally, define the bond or bridge.
# If the interface is a bond, create it.
- [ -n "${BONDNICS[$i]}" ] && bond_create $i
+ [ -n "${BONDNICS[$i]}" -a -z "$container" ] && bond_create $i
# If the interface is a bridge, create it.
- [ -n "${BRNICS[$i]}" ] && br_open $i
+ [ -n "${BRNICS[$i]}" -a -z "$container" ] && br_open $i
if [ -e /sys/class/net/${1%%[:.]*} ]; then # interface exists
if ! /sbin/ip address show scope global dev ${1} 2>/dev/null | grep -Ewq '(inet|inet6)' || \
! /sbin/ip link show dev ${1} | grep -wq "state UP"; then # interface not up or not configured