summaryrefslogtreecommitdiffstats
path: root/test/TEST-50-MULTINIC/client-init.sh
blob: 8495913a49064e74933f04418aedb2c7f08a0045 (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/scsi-0QEMU_QEMU_HARDDISK_marker status=none

getargbool 0 rd.shell && sh -i

sync
poweroff -f