Ubuntu Pastebin

Paste from martin at Tue, 20 Jan 2015 06:39:06 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
# generate network-online.target dependencies for all "auto" interfaces in
# /etc/network/interfaces
# Author: Martin Pitt <martin.pitt@ubuntu.com>
set -e
# expect three directories as arguments, using the "late" one
[ -d "$3" ] || exit 1
UNITDIR="$3"

INTERFACES=$(ifquery --list --exclude lo --allow auto)
# if we don't have any static interfaces, do nothing
[ -n "$INTERFACES" ] || exit 0

mkdir -p "$UNITDIR/network-online.target.d" "$UNITDIR/ifup@.service.d"
UNIT="$UNITDIR/network-online.target.d/ifup-auto.conf"
exec 3>$UNIT

echo '[Unit]' >&3
for iface in $INTERFACES; do
    echo "Requires=ifup@${iface}.service" >&3
    echo "After=ifup@${iface}.service" >&3
done
exec 3<&-

# now make ifup@.service re-trigger network-online.target
UNIT="$UNITDIR/ifup@.service.d/ifup-auto.conf"
exec 3>$UNIT
echo '[Unit]' >&3
echo 'Wants=network-online.target' >&3
exec 3<&-
Download as text