summaryrefslogtreecommitdiffstats
path: root/source/n/network-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'source/n/network-scripts')
-rw-r--r--source/n/network-scripts/0000-rc.inet1.new-lxc-additions.patch39
-rw-r--r--source/n/network-scripts/0001-netconfig-turn-off-rc.networkmanager-if-networkmanager-is-not-selected.patch20
-rwxr-xr-xsource/n/network-scripts/network-scripts.SlackBuild16
3 files changed, 73 insertions, 2 deletions
diff --git a/source/n/network-scripts/0000-rc.inet1.new-lxc-additions.patch b/source/n/network-scripts/0000-rc.inet1.new-lxc-additions.patch
new file mode 100644
index 000000000..d9c14d44b
--- /dev/null
+++ b/source/n/network-scripts/0000-rc.inet1.new-lxc-additions.patch
@@ -0,0 +1,39 @@
+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
diff --git a/source/n/network-scripts/0001-netconfig-turn-off-rc.networkmanager-if-networkmanager-is-not-selected.patch b/source/n/network-scripts/0001-netconfig-turn-off-rc.networkmanager-if-networkmanager-is-not-selected.patch
new file mode 100644
index 000000000..75700804e
--- /dev/null
+++ b/source/n/network-scripts/0001-netconfig-turn-off-rc.networkmanager-if-networkmanager-is-not-selected.patch
@@ -0,0 +1,20 @@
+From d5e9803b79f3bf909b01c3ff3a5cdb0d7594dba0 Mon Sep 17 00:00:00 2001
+From: Patrick J. Volkerding <volkerdi@slackware.com>
+Date: Wed, 10 Nov 2021 16:27:08 -0600
+Subject: [PATCH] Ensure proper rc.networkmanager permissions
+
+In case rc.networkmanager was made executable by the admin or with a previous
+run of netconfig, we need to disable it if networkmanager wasn't selected in
+this netconfig run.
+
+--- ./sbin/netconfig.orig 2021-04-16 13:51:20.261045081 -0500
++++ ./sbin/netconfig 2021-11-10 16:14:09.388939104 -0600
+@@ -1071,6 +1071,8 @@
+ write_config_files
+ if [ "$NETWORKMANAGER" = "yes" -a -r etc/rc.d/rc.networkmanager ]; then
+ chmod 755 etc/rc.d/rc.networkmanager
++ elif [ ! "$NETWORKMANAGER" = "yes" -a -x etc/rc.d/rc.networkmanager ]; then
++ chmod 644 etc/rc.d/rc.networkmanager
+ fi
+ dialog --msgbox "Settings accepted. Basic network configuration is complete." 6 40
+ else
diff --git a/source/n/network-scripts/network-scripts.SlackBuild b/source/n/network-scripts/network-scripts.SlackBuild
index 0476a7b8c..ea4bad779 100755
--- a/source/n/network-scripts/network-scripts.SlackBuild
+++ b/source/n/network-scripts/network-scripts.SlackBuild
@@ -25,7 +25,7 @@ cd $(dirname $0) ; CWD=$(pwd)
PKGNAM=network-scripts
VERSION=${VERSION:-15.0}
ARCH=noarch
-BUILD=${BUILD:-16}
+BUILD=${BUILD:-17}
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
# the name of the created package would be, and then exit. This information
@@ -84,6 +84,18 @@ mkdir -p $PKG/install
zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
cat $CWD/slack-desc > $PKG/install/slack-desc
+# Patch to fix rc.inet1.new for LXC:
+( cd $PKG
+ cat $CWD/0000-rc.inet1.new-lxc-additions.patch | patch -p1 --verbose || exit 1
+ rm -f etc/rc.d/rc.inet1.new.orig
+) || exit 1
+
+# Patch netconfig to fix leaving a previously enabled rc.networkmanager
+# executable even if networkmanager is no longer selected:
+( cd $PKG
+ cat $CWD/0001-netconfig-turn-off-rc.networkmanager-if-networkmanager-is-not-selected.patch | patch -p1 --verbose || exit 1
+ rm -f sbin/netconfig.orig
+)
+
cd $PKG
/sbin/makepkg -l y -c n $TMP/${PKGNAM}-$VERSION-$ARCH-$BUILD.txz
-