Your IP : 216.73.216.21


Current Path : /var.old/run/openrc/started/
Upload File :
Current File : //var.old/run/openrc/started/networking

#!/sbin/openrc-run

# Copyright (c) Natanael Copa
# This code is licensed under BSD-2-Clause
#
# 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 hostname
	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 -a
		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
}

https://nalibali.org/post-sitemap.xml 2026-11-20T09:00:00+00:00 https://nalibali.org/page-sitemap.xml 2026-11-18T09:24:11+00:00 https://nalibali.org/stories-sitemap.xml 2026-05-05T06:48:38+00:00 https://nalibali.org/stories-sitemap2.xml 2026-05-05T06:48:38+00:00 https://nalibali.org/audio_stories-sitemap.xml 2026-03-27T06:53:13+00:00 https://nalibali.org/story_cards-sitemap.xml 2025-06-06T10:27:48+00:00 https://nalibali.org/story_seeds-sitemap.xml 2025-05-19T07:35:43+00:00 https://nalibali.org/rhymes-sitemap.xml 2025-06-17T07:43:10+00:00 https://nalibali.org/activity_sheets-sitemap.xml 2025-05-16T09:16:43+00:00 https://nalibali.org/printables-sitemap.xml 2025-05-16T09:28:40+00:00 https://nalibali.org/posters_bookmarks-sitemap.xml 2025-05-16T10:20:22+00:00 https://nalibali.org/team_member-sitemap.xml 2025-05-28T09:40:43+00:00 https://nalibali.org/video_stories-sitemap.xml 2025-06-23T08:48:28+00:00 https://nalibali.org/guides-sitemap.xml 2025-06-17T09:38:41+00:00 https://nalibali.org/story_supplements-sitemap.xml 2025-09-16T12:22:20+00:00 https://nalibali.org/vacancies-sitemap.xml 2026-09-17T07:05:01+00:00 https://nalibali.org/category-sitemap.xml 2026-11-20T09:00:00+00:00 https://nalibali.org/post_tag-sitemap.xml 2026-11-06T00:00:00+00:00 https://nalibali.org/test-sitemap.xml 2025-06-13T09:36:28+00:00 https://nalibali.org/story_categories-sitemap.xml 2026-05-05T06:48:38+00:00 https://nalibali.org/activity_sheets_categories-sitemap.xml 2025-05-16T09:16:43+00:00 https://nalibali.org/printables_categories-sitemap.xml 2025-05-16T09:28:40+00:00 https://nalibali.org/posters_bookmarks_categories-sitemap.xml 2025-05-16T10:20:22+00:00 https://nalibali.org/single_audio-sitemap.xml 2026-03-27T06:53:13+00:00 https://nalibali.org/rhyme_categories-sitemap.xml 2025-06-17T07:43:10+00:00 https://nalibali.org/guide_categories-sitemap.xml 2025-06-17T09:38:41+00:00 https://nalibali.org/author-sitemap.xml 2026-01-22T07:26:07+00:00