commit:     fdf03428319c30a617edc160007fb8803d9e8158
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 24 22:29:22 2016 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Mon Oct 24 22:29:22 2016 +0000
URL:        https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=fdf03428

Switch /var/run to /run.

Use /run directly, instead of /var/run, for starting any internal
daemons. This allows netifrc to earlier, before /var is available.

X-Gentoo-Bug: 545364
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=545364
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 net/adsl.sh            |  6 +++---
 net/br2684ctl.sh       |  4 ++--
 net/clip.sh            | 14 +++++++-------
 net/dhclient.sh        |  4 ++--
 net/dhcpcd.sh          |  4 ++--
 net/ifplugd.sh         |  4 ++--
 net/ipppd.sh           |  4 ++--
 net/netplugd.sh        |  4 ++--
 net/pppd.sh            | 10 +++++-----
 net/udhcpc.sh.Linux.in | 10 +++++-----
 net/wpa_supplicant.sh  | 20 ++++++++++----------
 sh/udhcpc-hook.sh.in   |  4 ++--
 test/src/netifrc.py    |  4 ++--
 13 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/net/adsl.sh b/net/adsl.sh
index 744ebc2..4bfe51f 100644
--- a/net/adsl.sh
+++ b/net/adsl.sh
@@ -48,7 +48,7 @@ adsl_start()
        (
        cat "${cfgfile}";
        echo "ETH=${IFACE}";
-       echo "PIDFILE=/var/run/rp-pppoe-${IFACE}.pid";
+       echo "PIDFILE=/run/rp-pppoe-${IFACE}.pid";
        [ -n "${user}" ] && echo "USER=${user}";
        ) | ${exe} >/dev/null
        eend $?
@@ -58,7 +58,7 @@ adsl_stop()
 {
        local exe= cfgfile=
 
-       [ ! -f /var/run/rp-pppoe-"${IFACE}".pid ] && return 0
+       [ ! -f /run/rp-pppoe-"${IFACE}".pid ] && return 0
 
        adsl_setup_vars stop || return 1
 
@@ -66,7 +66,7 @@ adsl_stop()
        (
        cat "${cfgfile}";
        echo "ETH=${IFACE}";
-       echo "PIDFILE=/var/run/rp-pppoe-${IFACE}.pid";
+       echo "PIDFILE=/run/rp-pppoe-${IFACE}.pid";
        ) | ${exe} >/dev/null
        eend $?
 

diff --git a/net/br2684ctl.sh b/net/br2684ctl.sh
index b3f6119..8e48016 100644
--- a/net/br2684ctl.sh
+++ b/net/br2684ctl.sh
@@ -34,14 +34,14 @@ br2684ctl_pre_start()
 
        einfo "Starting RFC 2684 Bridge control on ${IFACE}"
        start-stop-daemon --start --exec $(_which br2684ctl) --background \
-               --make-pidfile --pidfile "/var/run/br2684ctl-${IFACE}.pid" \
+               --make-pidfile --pidfile "/run/br2684ctl-${IFACE}.pid" \
                -- -c "${IFACE#nas*}" ${opts}
        eend $?
 }
 
 br2684ctl_post_stop()
 {
-       local pidfile="/var/run/br2684ctl-${IFACE}.pid"
+       local pidfile="/run/br2684ctl-${IFACE}.pid"
        [ -e "${pidfile}" ] || return 0
 
        einfo "Stopping RFC 2684 Bridge control on ${IFACE}"

diff --git a/net/clip.sh b/net/clip.sh
index ca98250..3416075 100644
--- a/net/clip.sh
+++ b/net/clip.sh
@@ -21,7 +21,7 @@ atmclip_svc_start()
     ebegin "Starting $2 Daemon ($1)"
     start-stop-daemon --start \
                --background \
-               --make-pidfile --pidfile "/var/run/$1.pid" \
+               --make-pidfile --pidfile "/run/$1.pid" \
                --exec "/usr/sbin/$1" -- -l syslog
     eend $?
 }
@@ -49,7 +49,7 @@ atmclip_svc_stop()
 {
     ebegin "Stopping $2 Daemon ($1)"
     start-stop-daemon --stop --quiet \
-               --pidfile "/var/run/$1.pid" \
+               --pidfile "/run/$1.pid" \
                --exec "/usr/sbin/$1"
     eend $?
 }
@@ -73,13 +73,13 @@ atmclip_svcs_stop()
 
 are_atmclip_svcs_running()
 {
-       [ -f /var/run/atmarpd.pid ] || return 1
-       start-stop-daemon --quiet --test --stop --pidfile /var/run/atmarpd.pid 
|| return 1
+       [ -f /run/atmarpd.pid ] || return 1
+       start-stop-daemon --quiet --test --stop --pidfile /run/atmarpd.pid || 
return 1
 
        if yesno ${clip_full:-yes}; then
-               [ -f /var/run/ilmid.pid -a -f /var/run/atmsigd.pid ] || return 1
-               start-stop-daemon --quiet --test --stop --pidfile 
/var/run/ilmid.pid || return 1
-               start-stop-daemon --quiet --test --stop --pidfile 
/var/run/atmsigd.pid || return 1
+               [ -f /run/ilmid.pid -a -f /run/atmsigd.pid ] || return 1
+               start-stop-daemon --quiet --test --stop --pidfile 
/run/ilmid.pid || return 1
+               start-stop-daemon --quiet --test --stop --pidfile 
/run/atmsigd.pid || return 1
        fi
 
     return 0

diff --git a/net/dhclient.sh b/net/dhclient.sh
index 8c100dd..1c4238e 100644
--- a/net/dhclient.sh
+++ b/net/dhclient.sh
@@ -12,7 +12,7 @@ _config_vars="$_config_vars dhcp dhcpcd"
 
 dhclient_start()
 {
-       local args= opt= opts= pidfile="/var/run/dhclient-${IFACE}.pid"
+       local args= opt= opts= pidfile="/run/dhclient-${IFACE}.pid"
        local sendhost=true dconf=
 
        # Get our options
@@ -55,7 +55,7 @@ dhclient_start()
 
 dhclient_stop()
 {
-       local pidfile="/var/run/dhclient-${IFACE}.pid" opts=
+       local pidfile="/run/dhclient-${IFACE}.pid" opts=
        [ ! -f "${pidfile}" ] && return 0
 
        # Get our options

diff --git a/net/dhcpcd.sh b/net/dhcpcd.sh
index c598083..479170f 100644
--- a/net/dhcpcd.sh
+++ b/net/dhcpcd.sh
@@ -15,7 +15,7 @@ _config_vars="$_config_vars dhcp dhcpcd"
 
 dhcpcd_start()
 {
-       local args= opt= opts= pidfile="/var/run/dhcpcd-${IFACE}.pid" new=true
+       local args= opt= opts= pidfile="/run/dhcpcd-${IFACE}.pid" new=true
        eval args=\$dhcpcd_${IFVAR}
        [ -z "${args}" ] && args=${dhcpcd}
 
@@ -74,7 +74,7 @@ dhcpcd_start()
 
 dhcpcd_stop()
 {
-       local pidfile="/var/run/dhcpcd-${IFACE}.pid" opts= sig=SIGTERM
+       local pidfile="/run/dhcpcd-${IFACE}.pid" opts= sig=SIGTERM
        [ ! -f "${pidfile}" ] && return 0
 
        ebegin "Stopping dhcpcd on ${IFACE}"

diff --git a/net/ifplugd.sh b/net/ifplugd.sh
index 0bcde2f..dcc0657 100644
--- a/net/ifplugd.sh
+++ b/net/ifplugd.sh
@@ -13,7 +13,7 @@ ifplugd_depend()
 
 ifplugd_pre_start()
 {
-       local pidfile="/var/run/ifplugd.${IFACE}.pid" timeout= args=
+       local pidfile="/run/ifplugd.${IFACE}.pid" timeout= args=
 
        # We don't start ifplugd if we're being called from the background
        yesno ${IN_BACKGROUND} && return 0
@@ -84,7 +84,7 @@ ifplugd_stop()
 {
        yesno ${IN_BACKGROUND} && return 0
 
-       local pidfile="/var/run/ifplugd.${IFACE}.pid"
+       local pidfile="/run/ifplugd.${IFACE}.pid"
        [ ! -e "${pidfile}" ] && return 0
 
        ebegin "Stopping ifplugd on ${IFACE}"

diff --git a/net/ipppd.sh b/net/ipppd.sh
index 537065a..edf0aa0 100644
--- a/net/ipppd.sh
+++ b/net/ipppd.sh
@@ -13,7 +13,7 @@ _config_vars="$_config_vars ipppd"
 
 ipppd_pre_start()
 {
-       local opts= pidfile="/var/run/ipppd-${IFACE}.pid"
+       local opts= pidfile="/run/ipppd-${IFACE}.pid"
 
        # Check that we are a valid ippp interface
        case "${IFACE}" in
@@ -37,7 +37,7 @@ ipppd_pre_start()
 
 ipppd_post_stop()
 {
-       local pidfile="/var/run/ipppd-${IFACE}.pid"
+       local pidfile="/run/ipppd-${IFACE}.pid"
 
        [ ! -f "${pidfile}" ] && return 0
 

diff --git a/net/netplugd.sh b/net/netplugd.sh
index f43a5e6..d7d937d 100644
--- a/net/netplugd.sh
+++ b/net/netplugd.sh
@@ -16,7 +16,7 @@ netplugd_depend()
 
 netplugd_pre_start()
 {
-       local pidfile="/var/run/netplugd-${IFACE}.pid" timeout=
+       local pidfile="/run/netplugd-${IFACE}.pid" timeout=
 
        # We don't start netplug if we're being called from the background
        yesno ${IN_BACKGROUND} && return 0
@@ -86,7 +86,7 @@ netplugd_stop()
 {
        yesno ${IN_BACKGROUND} && return 0
 
-       local pidfile="/var/run/netplugd-${IFACE}.pid"
+       local pidfile="/run/netplugd-${IFACE}.pid"
        [ ! -e "${pidfile}" ] && return 0
 
        ebegin "Stopping netplug on" "${IFACE}"

diff --git a/net/pppd.sh b/net/pppd.sh
index 97bd3ee..ee5e7c2 100644
--- a/net/pppd.sh
+++ b/net/pppd.sh
@@ -12,7 +12,7 @@ pppd_depend()
 
 is_ppp()
 {
-       [ -e /var/run/ppp-"${IFACE}".pid ]
+       [ -e /run/ppp-"${IFACE}".pid ]
 }
 
 requote()
@@ -106,7 +106,7 @@ pppd_pre_start()
        ${hasmaxfail} || opts="${opts} maxfail 0"
        ${haspersist} || opts="${opts} persist"
 
-       # Set linkname because we need /var/run/ppp-${linkname}.pid
+       # Set linkname because we need /run/ppp-${linkname}.pid
        # This pidfile has the advantage of being there,
        # even if ${IFACE} interface was never started
        opts="linkname ${IFACE} ${opts}"
@@ -201,10 +201,10 @@ pppd_pre_start()
        && [ -n "${password}" -o -z "${passwordset}" ]; then
                printf "%s" "${password}" | \
                eval start-stop-daemon --start --exec /usr/sbin/pppd \
-                       --pidfile "/var/run/ppp-${IFACE}.pid" -- "${opts}" 
>/dev/null
+                       --pidfile "/run/ppp-${IFACE}.pid" -- "${opts}" 
>/dev/null
        else
                eval start-stop-daemon --start --exec /usr/sbin/pppd \
-                       --pidfile "/var/run/ppp-${IFACE}.pid" -- "${opts}" 
>/dev/null
+                       --pidfile "/run/ppp-${IFACE}.pid" -- "${opts}" 
>/dev/null
        fi
 
        if ! eend $? "Failed to start PPP"; then
@@ -231,7 +231,7 @@ pppd_start()
 pppd_stop()
 {
        yesno ${IN_BACKGROUND} && return 0
-       local pidfile="/var/run/ppp-${IFACE}.pid"
+       local pidfile="/run/ppp-${IFACE}.pid"
 
        [ ! -s "${pidfile}" ] && return 0
 

diff --git a/net/udhcpc.sh.Linux.in b/net/udhcpc.sh.Linux.in
index b6e0327..030d89e 100644
--- a/net/udhcpc.sh.Linux.in
+++ b/net/udhcpc.sh.Linux.in
@@ -12,7 +12,7 @@ _config_vars="$_config_vars dhcp udhcpc"
 
 udhcpc_start()
 {
-       local args= opt= opts= pidfile="/var/run/udhcpc-${IFACE}.pid"
+       local args= opt= opts= pidfile="/run/udhcpc-${IFACE}.pid"
        local sendhost=true cachefile="/var/cache/udhcpc-${IFACE}.lease"
 
        eval args=\$udhcpc_${IFVAR}
@@ -24,7 +24,7 @@ udhcpc_start()
        # This omits the Gentoo specific patch to busybox,
        # but it creates temporary files.
        # We can move this stuff to udhcpc hook script to avoid that, should we 
do?
-       local conf="/var/run/udhcpc-${IFACE}.conf"
+       local conf="/run/udhcpc-${IFACE}.conf"
        >"$conf"
        # Map some generic options to dhcpcd
        for opt in ${opts}; do
@@ -83,7 +83,7 @@ udhcpc_start()
 
 udhcpc_stop()
 {
-       local pidfile="/var/run/udhcpc-${IFACE}.pid" opts=
+       local pidfile="/run/udhcpc-${IFACE}.pid" opts=
        [ ! -f "${pidfile}" ] && return 0
 
        # Get our options
@@ -104,7 +104,7 @@ udhcpc_stop()
        start-stop-daemon --stop --exec /bin/busybox --pidfile "${pidfile}"
        eend $?
 
-       if [ -e "/var/run/udhcpc-${IFACE}.conf" ]; then
-               rm -f "/var/run/udhcpc-${IFACE}.conf"
+       if [ -e "/run/udhcpc-${IFACE}.conf" ]; then
+               rm -f "/run/udhcpc-${IFACE}.conf"
        fi
 }

diff --git a/net/wpa_supplicant.sh b/net/wpa_supplicant.sh
index 53b0256..c487238 100644
--- a/net/wpa_supplicant.sh
+++ b/net/wpa_supplicant.sh
@@ -128,7 +128,7 @@ wpa_supplicant_pre_start()
                        esac
                        ctrl_dir=${ctrl_dir%% *}
                else
-                       ctrl_dir="/var/run/wpa_supplicant"
+                       ctrl_dir="/run/wpa_supplicant"
                        opts="${opts} -C ${ctrl_dir}"
                fi
        fi
@@ -140,9 +140,9 @@ wpa_supplicant_pre_start()
                mark_service_inactive
        fi
        start-stop-daemon --start --exec "${wpas}" \
-               --pidfile "/var/run/wpa_supplicant-${IFACE}.pid" \
+               --pidfile "/run/wpa_supplicant-${IFACE}.pid" \
                -- ${opts} -B -i "${IFACE}" \
-               -P "/var/run/wpa_supplicant-${IFACE}.pid"
+               -P "/run/wpa_supplicant-${IFACE}.pid"
        eend $? || return 1
 
        # If we don't have a working wpa_cli and action file continue
@@ -162,9 +162,9 @@ wpa_supplicant_pre_start()
 
        ebegin "Starting wpa_cli on" "${IFACE}"
        start-stop-daemon --start --exec "${wpac}" \
-               --pidfile "/var/run/wpa_cli-${IFACE}.pid" \
+               --pidfile "/run/wpa_cli-${IFACE}.pid" \
                -- ${cliopts} -a "${actfile}" -p "${ctrl_dir}" -i "${IFACE}" \
-               -P "/var/run/wpa_cli-${IFACE}.pid" -B
+               -P "/run/wpa_cli-${IFACE}.pid" -B
        if eend $?; then
                ebegin "Backgrounding ..."
                exit 1
@@ -172,7 +172,7 @@ wpa_supplicant_pre_start()
 
        # wpa_cli failed to start? OK, error here
        start-stop-daemon --quiet --stop --exec "${wpas}" \
-               --pidfile "/var/run/wpa_supplicant-${IFACE}.pid"
+               --pidfile "/run/wpa_supplicant-${IFACE}.pid"
        ${inact} ||     mark_service_stopped
        return 1
 }
@@ -192,14 +192,14 @@ wpa_supplicant_post_stop()
        fi
        [ $? != 0 ] && return 0
 
-       local pidfile="/var/run/wpa_cli-${IFACE}.pid"
+       local pidfile="/run/wpa_cli-${IFACE}.pid"
        if [ -f ${pidfile} ]; then
                ebegin "Stopping wpa_cli on ${IFACE}"
                start-stop-daemon --stop --exec "${wpac}" --pidfile "${pidfile}"
                eend $?
        fi
 
-       pidfile="/var/run/wpa_supplicant-${IFACE}.pid"
+       pidfile="/run/wpa_supplicant-${IFACE}.pid"
        if [ -f ${pidfile} ]; then
                ebegin "Stopping wpa_supplicant on ${IFACE}"
                start-stop-daemon --stop --exec "${wpas}" --pidfile "${pidfile}"
@@ -207,6 +207,6 @@ wpa_supplicant_post_stop()
        fi
 
        # If wpa_supplicant exits uncleanly, we need to remove the stale dir
-       [ -S "/var/run/wpa_supplicant/${IFACE}" ] \
-               && rm -f "/var/run/wpa_supplicant/${IFACE}"
+       [ -S "/run/wpa_supplicant/${IFACE}" ] \
+               && rm -f "/run/wpa_supplicant/${IFACE}"
 }

diff --git a/sh/udhcpc-hook.sh.in b/sh/udhcpc-hook.sh.in
index c756061..bd03859 100644
--- a/sh/udhcpc-hook.sh.in
+++ b/sh/udhcpc-hook.sh.in
@@ -113,8 +113,8 @@ deconfig()
        fi
 }
 
-if [ -r "/var/run/udhcpc-${interface}.conf" ]; then
-       . "/var/run/udhcpc-${interface}.conf"
+if [ -r "/run/udhcpc-${interface}.conf" ]; then
+       . "/run/udhcpc-${interface}.conf"
 fi
 
 case "$1" in

diff --git a/test/src/netifrc.py b/test/src/netifrc.py
index 8840583..d17a60c 100755
--- a/test/src/netifrc.py
+++ b/test/src/netifrc.py
@@ -25,7 +25,7 @@ from file import save as backend_save, fetch as 
backend_retrieve
 
 
 def get_mode():
-    if(os.path.exists("/var/run/openrc")):
+    if(os.path.exists("/run/openrc")):
         return defaults['MODE_MASTER']
     return defaults['MODE_SLAVE']
 
@@ -35,7 +35,7 @@ def normalize(*args):
 
 
 def _service_call(iface, command):
-    if(os.path.exists("/var/run/openrc")):
+    if(os.path.exists("/run/openrc")):
         subprocess.check_call(["rc-service", "net."+iface, command])
     elif(os.path.exists("/run/systemd")):
         subprocess.check_call(["systemctl", command, "net@"+iface])

Reply via email to