Initial commit

This commit is contained in:
ariane
2021-03-18 15:42:28 +00:00
committed by root
commit e53cb04f1a
973 changed files with 23055 additions and 0 deletions

11
network/if-down.d/resolvconf Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
# ifdown hook script for resolvconf
# Written by Roy Marples <roy@marples.name> under the BSD-2 license
[ -x /sbin/resolvconf ] || exit 0
case "$ADDRFAM" in
inet|inet6) : ;;
*) exit 0;;
esac
[ "$METHOD" = dhcp ] && /sbin/resolvconf -f -d "$IFACE"
/sbin/resolvconf -f -d "$IFACE.$ADDRFAM"

View File

@@ -0,0 +1 @@
../../wpa_supplicant/ifupdown.sh

View File

@@ -0,0 +1 @@
../if-up.d/avahi-daemon

View File

@@ -0,0 +1,78 @@
#!/bin/sh
IWCONFIG=/sbin/iwconfig
if [ ! -x $IWCONFIG ]; then
exit 0
fi
# check if this is a 802.11 device we're supposed to be effecting
case "${IF_WIRELESS:-enable}" in
wireless-tools|iwconfig)
# *we* and not some other 802.11 tool should be used
;;
true|yes|enable|1)
# 802.11 should be used on this device, check for extensions
$IWCONFIG $IFACE >/dev/null 2>&1 || exit 0
;;
*)
exit 0
;;
esac
apply_settings()
{
if [ -n "$IF_WIRELESS_MODE" ]; then
$IWCONFIG "$IFACE" mode auto
fi
if [ -n "$IF_WIRELESS_AP" ]; then
$IWCONFIG "$IFACE" ap off
fi
if [ -n "$IF_WIRELESS_RATE" ]; then
$IWCONFIG "$IFACE" rate auto
fi
if [ -n "$IF_WIRELESS_RTS" ]; then
$IWCONFIG "$IFACE" rts auto
fi
if [ -n "$IF_WIRELESS_FRAG" ]; then
$IWCONFIG "$IFACE" frag auto
fi
if [ -n "$IF_WIRELESS_POWER" ]; then
$IWCONFIG "$IFACE" power off
fi
if [ -n "$IF_WIRELESS_TXPOWER" ]; then
$IWCONFIG "$IFACE" txpower auto
fi
if [ -n "$IF_WIRELESS_ENC" ]; then
$IWCONFIG "$IFACE" enc off
fi
if [ -n "$IF_WIRELESS_KEY" ]; then
$IWCONFIG "$IFACE" key off
fi
if [ -n "$IF_WIRELESS_DEFAULTKEY" ]; then
$IWCONFIG "$IFACE" key off
fi
if [ -n "$IF_WIRELESS_NWID" ]; then
$IWCONFIG "$IFACE" nwid off
fi
if [ -n "$IF_WIRELESS_ESSID" ]; then
$IWCONFIG "$IFACE" essid any
fi
if [ -n "$IF_WIRELESS_COMMIT" ]; then
$IWCONFIG "$IFACE" commit
fi
}
apply_settings 2>/dev/null

View File

@@ -0,0 +1 @@
../../wpa_supplicant/ifupdown.sh

14
network/if-pre-up.d/ethtool Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/sh
ETHTOOL=/sbin/ethtool
test -x $ETHTOOL || exit 0
[ "$IFACE" != "lo" ] || exit 0
# Gather together the mixed bag of settings applied with -s/--change
SETTINGS="\
${IF_ETHERNET_PORT:+ port $IF_ETHERNET_PORT}\
${IF_DRIVER_MESSAGE_LEVEL:+ msglvl $IF_DRIVER_MESSAGE_LEVEL}\
"
[ -z "$SETTINGS" ] || $ETHTOOL --change "$IFACE" $SETTINGS

View File

@@ -0,0 +1,143 @@
#!/bin/sh
IWCONFIG=/sbin/iwconfig
if [ ! -x $IWCONFIG ]; then
exit 0
fi
# check if this is a 802.11 device we're supposed to be effecting
case "${IF_WIRELESS:-enable}" in
wireless-tools|iwconfig)
# *we* and not some other 802.11 tool should be used
;;
true|yes|enable|1)
# 802.11 should be used on this device, check for extensions
$IWCONFIG $IFACE >/dev/null 2>&1 || exit 0
;;
*)
exit 0
;;
esac
# The wireless driver madness:
#
# - Some drivers want everything to be configured before bringing the interface up
# - Some drivers want everything to be configured after bringing the interface up
# - Some drivers want some parameters before, other parameters after bringing the interface up
#
# So, we try to set every parameter when the interface is still down,
# and remember which ones failed to be configured properly.
# If some failed, we bring the interface up, and try the failed ones again.
apply_settings()
{
if [ -n "$IF_WIRELESS_SENS" ]; then
$IWCONFIG "$IFACE" sens $IF_WIRELESS_SENS && IF_WIRELESS_SENS= || FAIL=true
fi
if [ -n "$IF_WIRELESS_MODE" ]; then
$IWCONFIG "$IFACE" mode $IF_WIRELESS_MODE && IF_WIRELESS_MODE= || FAIL=true
fi
if [ -n "$IF_WIRELESS_AP" ]; then
$IWCONFIG "$IFACE" ap $IF_WIRELESS_AP && IF_WIRELESS_AP= || FAIL=true
fi
if [ -n "$IF_WIRELESS_RATE" ]; then
$IWCONFIG "$IFACE" rate $IF_WIRELESS_RATE && IF_WIRELESS_RATE= || FAIL=true
fi
if [ -n "$IF_WIRELESS_RTS" ]; then
$IWCONFIG "$IFACE" rts $IF_WIRELESS_RTS && IF_WIRELESS_RTS= || FAIL=true
fi
if [ -n "$IF_WIRELESS_FRAG" ]; then
$IWCONFIG "$IFACE" frag $IF_WIRELESS_FRAG && IF_WIRELESS_FRAG= || FAIL=true
fi
if [ -n "$IF_WIRELESS_POWER" ]; then
$IWCONFIG "$IFACE" power $IF_WIRELESS_POWER && IF_WIRELESS_POWER= || FAIL=true
fi
if [ -n "$IF_WIRELESS_POWERPERIOD" ]; then
$IWCONFIG "$IFACE" power period $IF_WIRELESS_POWERPERIOD && IF_WIRELESS_POWERPERIOD= || FAIL=true
fi
if [ -n "$IF_WIRELESS_POWERTIMEOUT" ]; then
$IWCONFIG "$IFACE" power timeout $IF_WIRELESS_POWERTIMEOUT && IF_WIRELESS_POWERTIMEOUT= || FAIL=true
fi
if [ -n "$IF_WIRELESS_TXPOWER" ]; then
$IWCONFIG "$IFACE" txpower $IF_WIRELESS_TXPOWER && IF_WIRELESS_TXPOWER= || FAIL=true
fi
if [ -n "$IF_WIRELESS_RETRY" ]; then
$IWCONFIG "$IFACE" retry $IF_WIRELESS_RETRY && IF_WIRELESS_RETRY= || FAIL=true
fi
if [ -n "$IF_WIRELESS_ENC" ]; then
eval $IWCONFIG "$IFACE" enc $IF_WIRELESS_ENC && IF_WIRELESS_ENC= || FAIL=true
fi
if [ -n "$IF_WIRELESS_DEFAULTKEY" ]; then
$IWCONFIG "$IFACE" key ["$IF_WIRELESS_DEFAULTKEY"] && IF_WIRELESS_DEFAULTKEY= || FAIL=true
fi
if [ -n "$IF_WIRELESS_KEYMODE" ]; then
$IWCONFIG "$IFACE" key "$IF_WIRELESS_KEYMODE" && IF_WIRELESS_KEYMODE= || FAIL=true
fi
if [ -n "$IF_WIRELESS_KEY" ]; then
eval $IWCONFIG "$IFACE" key $IF_WIRELESS_KEY && IF_WIRELESS_KEY= || FAIL=true
fi
if [ -n "$IF_WIRELESS_KEY1" ]; then
$IWCONFIG "$IFACE" key [1] "$IF_WIRELESS_KEY1" && IF_WIRELESS_KEY1= || FAIL=true
fi
if [ -n "$IF_WIRELESS_KEY2" ]; then
$IWCONFIG "$IFACE" key [2] "$IF_WIRELESS_KEY2" && IF_WIRELESS_KEY2= || FAIL=true
fi
if [ -n "$IF_WIRELESS_KEY3" ]; then
$IWCONFIG "$IFACE" key [3] "$IF_WIRELESS_KEY3" && IF_WIRELESS_KEY3= || FAIL=true
fi
if [ -n "$IF_WIRELESS_KEY4" ]; then
$IWCONFIG "$IFACE" key [4] "$IF_WIRELESS_KEY4" && IF_WIRELESS_KEY4= || FAIL=true
fi
if [ -n "$IF_WIRELESS_FREQ" ]; then
$IWCONFIG "$IFACE" freq $IF_WIRELESS_FREQ && IF_WIRELESS_FREQ= || FAIL=true
fi
if [ -n "$IF_WIRELESS_CHANNEL" ]; then
$IWCONFIG "$IFACE" channel $IF_WIRELESS_CHANNEL && IF_WIRELESS_CHANNEL= || FAIL=true
fi
if [ -n "$IF_WIRELESS_NICK" ]; then
$IWCONFIG "$IFACE" nick "$IF_WIRELESS_NICK" && IF_WIRELESS_NICK= || FAIL=true
fi
if [ -n "$IF_WIRELESS_NWID" ]; then
$IWCONFIG "$IFACE" nwid "$IF_WIRELESS_NWID" && IF_WIRELESS_NWID= || FAIL=true
fi
if [ -n "$IF_WIRELESS_ESSID" ]; then
$IWCONFIG "$IFACE" essid "$IF_WIRELESS_ESSID" && IF_WIRELESS_ESSID= || FAIL=true
fi
if [ -n "$IF_WIRELESS_COMMIT" ]; then
$IWCONFIG "$IFACE" commit && IF_WIRELESS_COMMIT= || FAIL=true
fi
}
FAIL=
apply_settings 2>/dev/null
if [ -n "$FAIL" ]; then
FAIL=
/sbin/ip link set dev "$IFACE" up
apply_settings
fi

View File

@@ -0,0 +1 @@
../../wpa_supplicant/ifupdown.sh

22
network/if-up.d/000resolvconf Executable file
View File

@@ -0,0 +1,22 @@
#!/bin/sh
# ifup hook script for resolvconf
# Written by Roy Marples <roy@marples.name> under the BSD-2 license
[ -x /sbin/resolvconf ] || exit 0
case "$ADDRFAM" in
inet|inet6) : ;;
*) exit 0;;
esac
conf=
[ -n "$IF_DNS_DOMAIN" ] && conf="${conf}domain $IF_DNS_DOMAIN\n"
[ -n "$IF_DNS_SEARCH" ] && conf="${conf}search $IF_DNS_SEARCH\n"
[ -n "$IF_DNS_SORTLIST" ] && conf="${conf}sortlist $IF_DNS_SORTLIST\n"
[ -n "$IF_DNS_OPTIONS" ] && conf="${conf}options $IF_DNS_OPTIONS\n"
for nameserver in $IF_DNS_NAMESERVERS; do
conf="${conf}nameserver $nameserver\n"
done
if [ -n "$conf" ]; then
conf="# Generated by ifup for $IFACE.$ADDRFAM\n$conf"
printf "$conf" | /sbin/resolvconf -a "$IFACE.$ADDRFAM"
fi

16
network/if-up.d/avahi-daemon Executable file
View 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
network/if-up.d/ethtool Executable file
View 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

View File

@@ -0,0 +1 @@
../../wpa_supplicant/ifupdown.sh

7
network/interfaces Normal file
View File

@@ -0,0 +1,7 @@
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d