commit: ecba7604cf633342162deb802cb18008c55b0382 Author: Rabi Shanker Guha <guha.rabishankar <AT> gmail <DOT> com> AuthorDate: Fri Jan 9 15:08:13 2015 +0000 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> CommitDate: Fri Jan 9 15:08:13 2015 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/netifrc.git;a=commit;h=ecba7604
Update runscript to use functions.sh compatibility layer --- init.d/net.lo.in | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/init.d/net.lo.in b/init.d/net.lo.in index 6a0aefb..c79e7ff 100644 --- a/init.d/net.lo.in +++ b/init.d/net.lo.in @@ -2,6 +2,7 @@ # Copyright (c) 2007-2009 Roy Marples <r...@marples.name> # Released under the 2-clause BSD license. +SHDIR="@LIBEXECDIR@/sh" MODULESDIR="@LIBEXECDIR@/net" MODULESLIST="${RC_SVCDIR}/nettree" _config_vars="config routes" @@ -13,9 +14,20 @@ description="Configures network interfaces." # Handy var so we don't have to embed new lines everywhere for array splitting __IFS=" " + +# Set the INIT to be openrc if this file is called directly +: ${INIT:=openrc} + +if [ -f "$SHDIR/functions.sh" ]; then + . "$SHDIR/functions.sh" +else + echo "$SHDIR/functions.sh missing. Exiting" + exit -1 +fi + depend() { - local IFACE=${RC_SVCNAME#*.} + local IFACE=$(get_interface) local IFVAR=$(shell_var "${IFACE}") need localmount @@ -526,7 +538,7 @@ interface_down() start() { - local IFACE=${RC_SVCNAME#*.} oneworked=false fallback=false module= + local IFACE=$(get_interface) oneworked=false fallback=false module= local IFVAR=$(shell_var "${IFACE}") cmd= our_metric= local metric=0 _up_before_preup eval _up_before_preup="\$up_before_preup_${IFVAR}" @@ -721,7 +733,7 @@ stop() # correctly if we go back to multiuser. yesno ${keep_network:-YES} && yesno $RC_GOINGDOWN && return 0 - local IFACE=${RC_SVCNAME#*.} module= + local IFACE=$(get_interface) module= local IFVAR=$(shell_var "${IFACE}") opts= einfo "Bringing down interface ${IFACE}"