summaryrefslogtreecommitdiffstats
path: root/test/TEST-50-MULTINIC/client-init.sh
blob: 4c51e271df27a8c7ec01ceba35d1c8ab6261e740 (plain)
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
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
. /lib/dracut-lib.sh

export PATH=/usr/sbin:/usr/bin:/sbin:/bin
command -v plymouth > /dev/null 2>&1 && plymouth --quit
exec > /dev/console 2>&1

export TERM=linux
export PS1='initramfs-test:\w\$ '
stty sane
echo "made it to the rootfs! Powering down."

set -x

for i in /sys/class/net/*; do
    # booting with network-manager module
    state=/run/NetworkManager/devices/$(cat "$i"/ifindex)
    grep -q connection-uuid= "$state" 2> /dev/null || continue
    i=${i##*/}
    [ "$i" = lo ] && continue
    ip link show "$i" | grep -q master && continue
    IFACES="${IFACES}${i} "
done

for i in /run/initramfs/net.*.did-setup; do
    # booting with network-legacy module
    [ -f "$i" ] || continue
    strglobin "$i" ":*:*:*:*:" && continue
    i=${i%.did-setup}
    IFACES="${IFACES}${i##*/net.} "
done
{
    echo "OK"
    echo "$IFACES"
} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker

getargbool 0 rd.shell && sh -i

sync
poweroff -f