mirror of
https://git.proxmox.com/git/systemd
synced 2026-01-18 03:35:37 +00:00
The patches from udev were either merged upstream, applied directly, added as files to debian/extra/ or dropped: - debian/patches/commit-4b50a3d Applied upstream in4b50a3d004- debian/patches/fix_gtkdoc_oot Fixed upstream - debian/patches/libudevpc_no_librt Fixed upstream ine712ffcce6- debian/patches/vio_type Dropped for now. - debian/patches/debian_rules Added as debian/extra/rules/* - debian/patches/extra_agents Added as debian/extra/*.agent and debian/extra/hotplug.functions - debian/patches/extra_initramfs Added as debian/extra/initramfs.* - debian/patches/extra_installer Added as debian/extra/udev.* - debian/patches/extra_modprobeconf Added as debian/extra/fbdev-blacklist.conf and debian/extra/make-fbdev-blacklist - debian/patches/extra_misc Added as debian/extra/links.conf and debian/extra/create_static_nodes - debian/patches/dont-build-some-helpers Dropped, since we will use the upstream firmware agent now - debian/patches/libgudev_in_usr Applied as418b0a2d41- debian/patches/rules_compat_qemu Dropped, only needed for kernel versions <= 2.6.32 - debian/patches/use_run_tmpfs Dropped, since wheezy /run is mandatory - debian/patches/dev_root_rule Dropped, discouraged upstream - debian/patches/udevd_in_sbin Dropped, we will use the $libexec path now in the .service file and provide compat symlinks - udev_conf_comments Applied asc82d84e916
106 lines
2.1 KiB
Bash
106 lines
2.1 KiB
Bash
#!/bin/sh -e
|
|
#
|
|
# run /sbin/{ifup,ifdown} with the --allow=hotplug option.
|
|
#
|
|
|
|
. /lib/udev/hotplug.functions
|
|
|
|
if [ -z "$INTERFACE" ]; then
|
|
mesg "Bad net.agent invocation: \$INTERFACE is not set"
|
|
exit 1
|
|
fi
|
|
|
|
check_program() {
|
|
[ -x $1 ] && return 0
|
|
|
|
mesg "ERROR: $1 not found. You need to install the ifupdown package."
|
|
mesg "net.agent $ACTION event for $INTERFACE not handled."
|
|
exit 1
|
|
}
|
|
|
|
wait_for_interface() {
|
|
local interface=$1
|
|
|
|
while :; do
|
|
local state="$(cat /sys/class/net/$interface/operstate 2>/dev/null || true)"
|
|
if [ "$state" != down ]; then
|
|
return 0
|
|
fi
|
|
sleep 1
|
|
done
|
|
}
|
|
|
|
net_ifup() {
|
|
check_program /sbin/ifup
|
|
|
|
if grep -q '^auto[[:space:]].*\<'"$INTERFACE"'\>' \
|
|
/etc/network/interfaces; then
|
|
# this $INTERFACE is marked as "auto"
|
|
IFUPARG='\('$INTERFACE'\|-a\|--all\)'
|
|
else
|
|
IFUPARG=$INTERFACE
|
|
fi
|
|
|
|
if ps -C ifup ho args | grep -q "$IFUPARG"; then
|
|
debug_mesg "Already ifup-ing interface $INTERFACE"
|
|
exit 0
|
|
fi
|
|
|
|
wait_for_interface lo
|
|
if [ -e /sys/fs/cgroup/systemd ]; then
|
|
exec systemctl start ifup@${INTERFACE}.service
|
|
else
|
|
exec ifup --allow=hotplug $INTERFACE
|
|
fi
|
|
}
|
|
|
|
net_ifdown() {
|
|
check_program /sbin/ifdown
|
|
|
|
if ps -C ifdown ho args | grep -q $INTERFACE; then
|
|
debug_mesg "Already ifdown-ing interface $INTERFACE"
|
|
exit 0
|
|
fi
|
|
|
|
exec ifdown --allow=hotplug $INTERFACE
|
|
}
|
|
|
|
do_everything() {
|
|
|
|
case "$ACTION" in
|
|
add)
|
|
# these interfaces generate hotplug events *after* they are brought up
|
|
case $INTERFACE in
|
|
ppp*|ippp*|isdn*|plip*|lo|irda*|ipsec*)
|
|
exit 0 ;;
|
|
esac
|
|
|
|
net_ifup
|
|
;;
|
|
|
|
remove)
|
|
# the pppd persist option may have been used, so it should not be killed
|
|
case $INTERFACE in
|
|
ppp*)
|
|
exit 0 ;;
|
|
esac
|
|
|
|
net_ifdown
|
|
;;
|
|
|
|
*)
|
|
debug_mesg "NET $ACTION event not supported"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
}
|
|
|
|
# When udev_log="debug" stdout and stderr are pipes connected to udevd.
|
|
# They need to be closed or udevd will wait for this process which will
|
|
# deadlock with udevsettle until the timeout.
|
|
do_everything > /dev/null 2> /dev/null &
|
|
|
|
exit 0
|
|
|