aboutsummaryrefslogtreecommitdiffstats
path: root/main/openrc/networking.initd
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2020-01-16 19:04:00 +0100
committerJakub Jirutka <jakub@jirutka.cz>2020-01-16 19:08:06 +0100
commit0883c9ddd66fa981fe993434cb3bab2593e299e4 (patch)
tree7da6f3ac8124fe40f5fae08620a7065e1a729c17 /main/openrc/networking.initd
parent5cffcf36bcd88657a1faf4c14959f3f506e5fa9d (diff)
downloadaports-0883c9ddd66fa981fe993434cb3bab2593e299e4.tar.bz2
aports-0883c9ddd66fa981fe993434cb3bab2593e299e4.tar.xz
main/openrc: allow to change interfaces config location
This is basically a backport of 6a467d4a814f4ce4ce59f9022e656fad7a4c79aa but implemented in more cautious way to be more sure that it will surely not cause any compatibility breakages.
Diffstat (limited to 'main/openrc/networking.initd')
-rw-r--r--main/openrc/networking.initd16
1 files changed, 11 insertions, 5 deletions
diff --git a/main/openrc/networking.initd b/main/openrc/networking.initd
index 2f7bec65ec..00613e0a48 100644
--- a/main/openrc/networking.initd
+++ b/main/openrc/networking.initd
@@ -3,9 +3,15 @@
# note that the spoofprotect, syncoockies and ip_forward options are set in
# /etc/sysctl.conf
-ifconf=/etc/network/interfaces
ifstate=/var/run/ifstate
+if [ -f "$cfgfile" ]; then
+ ifopts="-i $cfgfile"
+else
+ ifopts=
+ cfgfile="/etc/network/interfaces"
+fi
+
single_iface="${SVCNAME#*.}"
if [ "$single_iface" = "$SVCNAME" ]; then
single_iface=
@@ -23,7 +29,7 @@ find_ifaces() {
if [ -n "$single_iface" ]; then
echo $single_iface
else
- awk '$1 == "auto" {for (i = 2; i <= NF; i = i + 1) printf("%s ", $i)}' $ifconf
+ awk '$1 == "auto" {for (i = 2; i <= NF; i = i + 1) printf("%s ", $i)}' "$cfgfile"
fi
}
@@ -43,8 +49,8 @@ start() {
for iface in $(find_ifaces); do
local r=0
ebegin "$iface"
- if ! ifup $iface >/dev/null; then
- ifdown $iface >/dev/null 2>&1
+ if ! ifup $ifopts $iface >/dev/null; then
+ ifdown $ifopts $iface >/dev/null 2>&1
r=1
fi
# atleast one interface needs to be started for action
@@ -64,7 +70,7 @@ stop() {
eindent
for iface in $(find_running_ifaces); do
ebegin "$iface"
- ifdown -f $iface >/dev/null
+ ifdown $ifopts -f $iface >/dev/null
eend $?
done
eoutdent