summaryrefslogtreecommitdiff
path: root/extra/openrc/networking.initd
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-05-04 23:52:30 +0100
committerdavidovski <david@davidovski.xyz>2022-05-04 23:52:30 +0100
commit739c65c54cb0e957df5e9b76f93fb02554e5cac3 (patch)
tree09ddfa0a342f3ea9de136cb50abdd79821bf1b53 /extra/openrc/networking.initd
parent4c585ad54388285500fd18a6aaa516894e0f2c16 (diff)
moved everything to new file formatting
Diffstat (limited to 'extra/openrc/networking.initd')
-rw-r--r--extra/openrc/networking.initd88
1 files changed, 0 insertions, 88 deletions
diff --git a/extra/openrc/networking.initd b/extra/openrc/networking.initd
deleted file mode 100644
index 417f4a3..0000000
--- a/extra/openrc/networking.initd
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/sbin/openrc-run
-
-# note that the spoofprotect, syncoockies and ip_forward options are set in
-# /etc/sysctl.conf
-
-: ${cfgfile:="/etc/network/interfaces"}
-: ${ifquery:="ifquery"}
-: ${ifstate:="/run/ifstate"}
-
-single_iface="${RC_SVCNAME#*.}"
-if [ "$single_iface" = "$RC_SVCNAME" ]; then
- single_iface=
-fi
-
-depend() {
- need localmount
- want dev-settle
- after bootmisc hwdrivers modules
- provide net
- keyword -jail -prefix -vserver -docker
-}
-
-# find interfaces we want to start
-find_ifaces() {
- if [ -n "$single_iface" ]; then
- echo $single_iface
- return 0
- fi
-
- if command -v "$ifquery" >/dev/null; then
- $ifquery -i "$cfgfile" --list --auto
- return
- fi
-
- # fallback in case ifquery does not exist
- awk '$1 == "auto" {for (i = 2; i <= NF; i = i + 1) printf("%s ", $i)}' "$cfgfile"
-}
-
-# return the list of interfaces we should try stop
-find_running_ifaces() {
- if [ -n "$single_iface" ]; then
- echo $single_iface
- return 0
- fi
-
- if command -v "$ifquery" >/dev/null; then
- $ifquery --state-file $ifstate -i "$cfgfile" --running
- return
- fi
-
- # fallback
- awk -F= '{print $2}' $ifstate
-}
-
-start() {
- local iface= ret=1
- ebegin "Starting networking"
- eindent
- for iface in $(find_ifaces); do
- local r=0
- ebegin "$iface"
- if ! ifup -i "$cfgfile" $iface >/dev/null; then
- ifdown -i "$cfgfile" $iface >/dev/null 2>&1
- r=1
- fi
- # atleast one interface needs to be started for action
- # to be success
- eend $r && ret=0
- done
- eoutdent
- return $ret
-}
-
-stop() {
- local iface=
- # Don't stop the network at shutdown.
- yesno ${keep_network:-YES} && yesno $RC_GOINGDOWN && return 0
-
- ebegin "Stopping networking"
- eindent
- for iface in $(find_running_ifaces); do
- ebegin "$iface"
- ifdown -i "$cfgfile" -f $iface >/dev/null
- eend $?
- done
- eoutdent
- return 0
-}