<commit_before>#!/bin/sh
#
# net.sh: udev external RUN script
#
# Copyright 2007 <NAME> <<EMAIL>>
# Distributed under the terms of the GNU General Public License v2

IFACE="$1"
ACTION="$2"

if grep -q initng /proc/1/cmdline 
then
    EXEC="/sbin/ngc"
    INITNG="yes"
    EINIT="no"
elif grep -q einit /proc/1/cmdline
then
    EXEC="/sbin/erc"
    INITNG="no"
    EINIT="yes"
else
    EXEC="/etc/init.d/net.${IFACE}"
    INITNG="no"
    EINIT="no"
fi

case "${ACTION}" in
    start)
	if [ "${INITNG}" = "yes" ]
	then
	    ARGS="-u net/${IFACE}"
	elif [ "${EINIT}" = "yes" ]
	then
	    ARGS="net-${IFACE} enable"
	else
	    ARGS="--quiet start"
	fi
	;;
    stop)
	if [ "${INITNG}" = "yes" ]
	then
	    ARGS="-d net/${IFACE}"
	elif [ "${EINIT}" = "yes" ]
	then
	    ARGS="net-${IFACE} disable"
	else
	    ARGS="--quiet stop"
	fi
	;;
    *)
	echo "$0: wrong arguments" >&2
	echo "Call with <interface> <start|stop>" >&2
	exit 1
	;;
esac

export IN_HOTPLUG=1

if [ -x "${EXEC}" ]
then
    ${EXEC} ${ARGS}
    exit 0
else
    logger -t netplug "Error: Couldn't configure ${IFACE}, no ${EXEC} !"
    exit 1
fi

# If we're stopping then sleep for a bit in-case a daemon is monitoring
# the interface. This to try and ensure we stop after they do.
[ "${ACTION}" == "stop" ] && sleep 2

# vim: set ts=4<commit_msg>should be 100% proper now<commit_after>#!/bin/sh
#
# net.sh: udev external RUN script
#
# Copyright 2007 <NAME> <<EMAIL>>
# Distributed under the terms of the GNU General Public License v2

IFACE="$1"
ACTION="$2"

# ignore interfaces that are registered after being "up" (?)
case ${IFACE} in
    ppp*|ippp*|isdn*|plip*|lo*|irda*|dummy*|ipsec*|tun*|tap*)
    	exit 0 ;;
esac

# sypport for various init systems add your next big init system here
USE_INIT=`grep -Eo '^(init|initng|einit) ' -a /proc/1/cmdline`

if [ -z ${USE_INIT} ]; then
	logger -t udev-net.sh "${IFACE} ${ACTION} failed. Failed to determine init system."
	exit 1
fi

case "${ACTION}" in
	start)
		case "${USE_INIT}" in
			initng)
				EXEC="/sbin/ngc"
				ARGS="-u net/${IFACE}"
				;;
			einit)
				EXEC="/sbin/erc"
				ARGS="net-${IFACE} enable"
				;;
			init)
				EXEC="/etc/init.d/net.${IFACE}"
				ARGS="--quiet start"
				;;
		esac
		;;
	stop)
		case "${USE_INIT}" in
			initng)
				EXEC="/sbin/ngc"
				ARGS="-d net/${IFACE}"
				;;
			einit)
				EXEC="/sbin/erc"
				ARGS="net-${IFACE} disable"
				;;
			init)
				EXEC="/etc/init.d/net.${IFACE}"
				ARGS="--quiet stop"
				;;
		esac
		;;
	*)
		logger -t udev-net.sh "${IFACE} ${ACTION} failed. Improper action requested."
		logger -t udev-net.sh "Action must be start/stop."
		exit 1
		;;
esac


if [ ! -x "${EXEC}" ] ; then
    logger -t udev-net.sh "${IFACE} ${ACTION} failed. ${EXEC}: does not exist or is not executable"
    exit 1
fi

# If we're stopping then sleep for a bit in-case a daemon is monitoring
# the interface. This to try and ensure we stop after they do.
[ "${ACTION}" == "stop" ] && sleep 2

export IN_HOTPLUG=1
"${EXEC}" "${ARGS}"
{'fraction_non_alphanumeric': 0.17828418230563003, 'fraction_numerical': 0.011729222520107238, 'mean_word_length': 2.9431968295904887, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1345747', 'n_tokens_mistral': 1273, 'n_tokens_neox': 1138, 'n_words': 338}