first commit
This commit is contained in:
47
etc_org/network/if-up.d/000resolvconf
Executable file
47
etc_org/network/if-up.d/000resolvconf
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# ifup hook script for resolvconf
|
||||
#
|
||||
# This file is part of the resolvconf package.
|
||||
#
|
||||
|
||||
[ -x /sbin/resolvconf ] || exit 0
|
||||
|
||||
case "$ADDRFAM" in
|
||||
inet|inet6) : ;;
|
||||
*) exit 0 ;;
|
||||
esac
|
||||
|
||||
R=""
|
||||
if [ "$IF_DNS_DOMAIN" ] ; then
|
||||
R="${R}domain $IF_DNS_DOMAIN
|
||||
"
|
||||
fi
|
||||
if [ "$IF_DNS_SEARCH" ] ; then
|
||||
R="${R}search $IF_DNS_SEARCH
|
||||
"
|
||||
fi
|
||||
if [ "$IF_DNS_SORTLIST" ] ; then
|
||||
R="${R}sortlist $IF_DNS_SORTLIST
|
||||
"
|
||||
fi
|
||||
for NS in $IF_DNS_NAMESERVERS ; do
|
||||
R="${R}nameserver $NS
|
||||
"
|
||||
done
|
||||
|
||||
# Note: arguments of multiple instances of options are separated by newlines
|
||||
set_NS_to_first_arg() { NS="$1" ; }
|
||||
STANDARD_IFS="$IFS"
|
||||
IFS='
|
||||
'
|
||||
for OPT in $IF_DNS_NAMESERVER ; do
|
||||
IFS="$STANDARD_IFS"
|
||||
set_NS_to_first_arg $OPT
|
||||
[ "$NS" ] && R="${R}nameserver $NS
|
||||
"
|
||||
done
|
||||
IFS="$STANDARD_IFS"
|
||||
|
||||
echo -n "$R" | /sbin/resolvconf -a "${IFACE}.${ADDRFAM}" || :
|
||||
|
||||
37
etc_org/network/if-up.d/avahi-autoipd
Executable file
37
etc_org/network/if-up.d/avahi-autoipd
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# Description: Add routes to allow communication between machines which
|
||||
# only have an IPv4LL address assigned and those which only
|
||||
# have a routable address assigned.
|
||||
#
|
||||
# See http://developer.apple.com/qa/qa2004/qa1357.html for
|
||||
# more information.
|
||||
|
||||
[ -x /usr/sbin/avahi-autoipd ] || exit 0
|
||||
|
||||
[ "$IFACE" != "lo" ] || exit 0
|
||||
case "$ADDRFAM" in
|
||||
inet) ;;
|
||||
*) exit 0 ;;
|
||||
esac
|
||||
|
||||
case "$METHOD" in
|
||||
static|dhcp|NetworkManager) ;;
|
||||
*) exit 0 ;;
|
||||
esac
|
||||
|
||||
|
||||
if [ -x /bin/ip ]; then
|
||||
# route already present?
|
||||
ip route show | grep -q '^169.254.0.0/16[[:space:]]' && exit 0
|
||||
|
||||
/bin/ip route add 169.254.0.0/16 dev $IFACE metric 1000 scope link
|
||||
elif [ -x /sbin/route ]; then
|
||||
# route already present?
|
||||
/sbin/route -n | egrep -q "^169.254.0.0[[:space:]]" && exit 0
|
||||
|
||||
/sbin/route add -net 169.254.0.0 netmask 255.255.0.0 dev $IFACE metric 1000
|
||||
fi
|
||||
|
||||
16
etc_org/network/if-up.d/avahi-daemon
Executable file
16
etc_org/network/if-up.d/avahi-daemon
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Don't run the avahi-daemon unicast local check while bringing up
|
||||
# the loopback device; it's not necessary until we bring up a real network
|
||||
# device
|
||||
[ "$IFACE" != "lo" ] || exit 0
|
||||
case "$ADDRFAM" in
|
||||
inet|inet6) ;;
|
||||
*) exit 0 ;;
|
||||
esac
|
||||
|
||||
# If we have an unicast .local domain, we immediately disable avahi to avoid
|
||||
# conflicts with the multicast IP4LL .local domain
|
||||
if [ -x /usr/lib/avahi/avahi-daemon-check-dns.sh ] ; then
|
||||
exec /usr/lib/avahi/avahi-daemon-check-dns.sh
|
||||
fi
|
||||
55
etc_org/network/if-up.d/ethtool
Executable file
55
etc_org/network/if-up.d/ethtool
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
|
||||
ETHTOOL=/sbin/ethtool
|
||||
|
||||
test -x $ETHTOOL || exit 0
|
||||
|
||||
[ "$IFACE" != "lo" ] || exit 0
|
||||
|
||||
# Find settings with a given prefix and print them as they appeared in
|
||||
# /etc/network/interfaces, only with the prefix removed.
|
||||
# This actually prints each name and value on a separate line, but that
|
||||
# doesn't matter to the shell.
|
||||
gather_settings () {
|
||||
set | sed -n "
|
||||
/^IF_$1[A-Za-z0-9_]*=/ {
|
||||
h; # hold line
|
||||
s/^IF_$1//; s/=.*//; s/_/-/g; # get name without prefix
|
||||
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/; # lower-case
|
||||
p;
|
||||
g; # restore line
|
||||
s/^[^=]*=//; s/^'\(.*\)'/\1/; # get value
|
||||
p;
|
||||
}"
|
||||
}
|
||||
|
||||
# Gather together the mixed bag of settings applied with -s/--change
|
||||
SETTINGS="\
|
||||
${IF_LINK_SPEED:+ speed $IF_LINK_SPEED}\
|
||||
${IF_LINK_DUPLEX:+ duplex $IF_LINK_DUPLEX}\
|
||||
"
|
||||
|
||||
# WOL has an optional pass-key
|
||||
set -- $IF_ETHERNET_WOL
|
||||
SETTINGS="$SETTINGS${1:+ wol $1}${2:+ sopass $2}"
|
||||
|
||||
# Autonegotiation can be on|off or an advertising mask
|
||||
case "$IF_ETHERNET_AUTONEG" in
|
||||
'') ;;
|
||||
on|off) SETTINGS="$SETTINGS autoneg $IF_ETHERNET_AUTONEG" ;;
|
||||
*) SETTINGS="$SETTINGS autoneg on advertise $IF_ETHERNET_AUTONEG" ;;
|
||||
esac
|
||||
|
||||
[ -z "$SETTINGS" ] || $ETHTOOL --change "$IFACE" $SETTINGS
|
||||
|
||||
SETTINGS="$(gather_settings ETHERNET_PAUSE_)"
|
||||
[ -z "$SETTINGS" ] || $ETHTOOL --pause "$IFACE" $SETTINGS
|
||||
|
||||
SETTINGS="$(gather_settings HARDWARE_IRQ_COALESCE_)"
|
||||
[ -z "$SETTINGS" ] || $ETHTOOL --coalesce "$IFACE" $SETTINGS
|
||||
|
||||
SETTINGS="$(gather_settings HARDWARE_DMA_RING_)"
|
||||
[ -z "$SETTINGS" ] || $ETHTOOL --set-ring "$IFACE" $SETTINGS
|
||||
|
||||
SETTINGS="$(gather_settings OFFLOAD_)"
|
||||
[ -z "$SETTINGS" ] || $ETHTOOL --offload "$IFACE" $SETTINGS
|
||||
42
etc_org/network/if-up.d/openssh-server
Executable file
42
etc_org/network/if-up.d/openssh-server
Executable file
@@ -0,0 +1,42 @@
|
||||
#! /bin/sh
|
||||
# Reload the OpenSSH server when an interface comes up, to allow it to start
|
||||
# listening on new addresses.
|
||||
|
||||
set -e
|
||||
|
||||
# Don't bother to restart sshd when lo is configured.
|
||||
if [ "$IFACE" = lo ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Only run from ifup.
|
||||
if [ "$MODE" != start ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# OpenSSH only cares about inet and inet6. Get ye gone, strange people
|
||||
# still using ipx.
|
||||
if [ "$ADDRFAM" != inet ] && [ "$ADDRFAM" != inet6 ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Is /usr mounted?
|
||||
if [ ! -e /usr/sbin/sshd ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -f /var/run/sshd.pid ] || \
|
||||
[ "$(ps -p "$(cat /var/run/sshd.pid)" -o comm=)" != sshd ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# We'd like to use 'reload' here, but it has some problems; see #502444. On
|
||||
# the other hand, repeated restarts of ssh make systemd unhappy
|
||||
# (#756547/#757822), so use reload in that case.
|
||||
if [ -d /run/systemd/system ]; then
|
||||
systemctl reload --no-block ssh.service >/dev/null 2>&1 || true
|
||||
else
|
||||
invoke-rc.d ssh restart >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
exit 0
|
||||
54
etc_org/network/if-up.d/upstart
Executable file
54
etc_org/network/if-up.d/upstart
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/bin/sh -e
|
||||
MARK_DEV_PREFIX="/run/network/ifup."
|
||||
MARK_STATIC_NETWORK_EMITTED="/run/network/static-network-up-emitted"
|
||||
|
||||
if [ -e /lib/lsb/init-functions ]; then
|
||||
. /lib/lsb/init-functions
|
||||
fi
|
||||
|
||||
if ! init_is_upstart; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Let's ignore meta entries (ifup -a)
|
||||
if [ "$ADDRFAM" = "meta" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# lo emission handled by /etc/init/network-interface.conf
|
||||
if [ "$IFACE" != lo ]; then
|
||||
initctl emit -n net-device-up \
|
||||
"IFACE=$IFACE" \
|
||||
"LOGICAL=$LOGICAL" \
|
||||
"ADDRFAM=$ADDRFAM" \
|
||||
"METHOD=$METHOD"
|
||||
fi
|
||||
|
||||
get_auto_interfaces() {
|
||||
# write to stdout a list of interfaces configured as 'auto' in interfaces(5)
|
||||
local found=""
|
||||
# stderr redirected as it outputs things like:
|
||||
# Ignoring unknown interface eth0=eth0.
|
||||
found=$(ifquery --list --allow auto 2>/dev/null) || return
|
||||
set -- ${found}
|
||||
echo "$@"
|
||||
}
|
||||
|
||||
all_interfaces_up() {
|
||||
# return true if all interfaces listed in /etc/network/interfaces as 'auto'
|
||||
# are up. if no interfaces are found there, then "all [given] were up"
|
||||
local prefix="$1" iface=""
|
||||
for iface in $(get_auto_interfaces); do
|
||||
# if cur interface does is not up, then all have not been brought up
|
||||
[ -f "${prefix}${iface}" ] || return 1
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
# touch our own "marker" indicating that this interface has been brought up.
|
||||
: > "${MARK_DEV_PREFIX}$IFACE"
|
||||
|
||||
if all_interfaces_up "${MARK_DEV_PREFIX}" &&
|
||||
mkdir "${MARK_STATIC_NETWORK_EMITTED}" 2>/dev/null; then
|
||||
initctl emit --no-wait static-network-up
|
||||
fi
|
||||
1
etc_org/network/if-up.d/wpasupplicant
Symbolic link
1
etc_org/network/if-up.d/wpasupplicant
Symbolic link
@@ -0,0 +1 @@
|
||||
../../wpa_supplicant/ifupdown.sh
|
||||
Reference in New Issue
Block a user