]> git.ipfire.org Git - thirdparty/dracut.git/blame - test/TEST-60-BONDBRIDGEVLANIFCFG/server-init.sh
fix: shellcheck 0.7.2
[thirdparty/dracut.git] / test / TEST-60-BONDBRIDGEVLANIFCFG / server-init.sh
CommitLineData
70787ab6 1#!/bin/sh
9a52c3fd 2exec < /dev/console > /dev/console 2>&1
70787ab6
LR
3set -x
4export PATH=/sbin:/bin:/usr/sbin:/usr/bin
5export TERM=linux
6export PS1='nfstest-server:\w\$ '
7stty sane
8echo "made it to the rootfs!"
9echo server > /proc/sys/kernel/hostname
10
11wait_for_if_link() {
12 local cnt=0
13 local li
0f62da04 14
70787ab6 15 while [ $cnt -lt 600 ]; do
9a52c3fd 16 ip link show
0f62da04 17
6e587818 18 li=$(ip -o link show dev "$1" 2> /dev/null)
9a52c3fd 19 [ -n "$li" ] && return 0
70787ab6 20 sleep 0.1
75d758e8 21 cnt=$((cnt + 1))
70787ab6
LR
22 done
23 return 1
24}
25
26wait_for_if_up() {
27 local cnt=0
28 local li
29 while [ $cnt -lt 200 ]; do
6e587818 30 li=$(ip -o link show up dev "$1")
70787ab6
LR
31 [ -n "$li" ] && return 0
32 sleep 0.1
75d758e8 33 cnt=$((cnt + 1))
70787ab6
LR
34 done
35 return 1
36}
37
38wait_for_route_ok() {
39 local cnt=0
40 while [ $cnt -lt 200 ]; do
41 li=$(ip route show)
42 [ -n "$li" ] && [ -z "${li##*$1*}" ] && return 0
43 sleep 0.1
75d758e8 44 cnt=$((cnt + 1))
70787ab6
LR
45 done
46 return 1
47}
48
49linkup() {
6e587818 50 wait_for_if_link "$1" 2> /dev/null && ip link set "$1" up 2> /dev/null && wait_for_if_up "$1" 2> /dev/null
70787ab6
LR
51}
52
0f62da04
HH
53udevadm settle
54
55ip link show
56
909961d0
HH
57wait_for_if_link enx525401123456
58wait_for_if_link enx525401123457
59wait_for_if_link enx525401123458
60wait_for_if_link enx525401123459
61
62ip link set dev enx525401123456 name net1
63ip link set dev enx525401123457 name net2
64ip link set dev enx525401123458 name net3
65ip link set dev enx525401123459 name net4
c9391e8f 66
70787ab6 67modprobe --all -b -q 8021q ipvlan macvlan
6e587818 68: > /dev/watchdog
70787ab6
LR
69ip addr add 127.0.0.1/8 dev lo
70linkup lo
909961d0
HH
71ip addr add 192.168.50.1/24 dev net1
72linkup net1
73: > /dev/watchdog
74ip link add dev net2.1 link net2 type vlan id 1
75ip link add dev net2.2 link net2 type vlan id 2
76ip link add dev net2.3 link net2 type vlan id 3
77ip link add dev net2.4 link net2 type vlan id 4
78ip addr add 192.168.54.1/24 dev net2.1
79ip addr add 192.168.55.1/24 dev net2.2
80ip addr add 192.168.56.1/24 dev net2.3
81ip addr add 192.168.57.1/24 dev net2.4
82linkup net2
83ip link set dev net2.1 up
84ip link set dev net2.2 up
85ip link set dev net2.3 up
86ip link set dev net2.4 up
87ip addr add 192.168.51.1/24 dev net3
88linkup net3
89linkup net4
6e587818 90: > /dev/watchdog
70787ab6 91modprobe af_packet
6e587818 92: > /dev/watchdog
70787ab6 93modprobe sunrpc
6e587818 94: > /dev/watchdog
70787ab6 95mount -t rpc_pipefs sunrpc /var/lib/nfs/rpc_pipefs
6e587818 96: > /dev/watchdog
70787ab6 97[ -x /sbin/portmap ] && portmap
6e587818 98: > /dev/watchdog
70787ab6
LR
99mkdir -p /run/rpcbind
100[ -x /sbin/rpcbind ] && rpcbind
6e587818 101: > /dev/watchdog
70787ab6 102modprobe nfsd
6e587818 103: > /dev/watchdog
70787ab6 104mount -t nfsd nfsd /proc/fs/nfsd
6e587818 105: > /dev/watchdog
70787ab6 106exportfs -r
6e587818 107: > /dev/watchdog
70787ab6 108rpc.nfsd
6e587818 109: > /dev/watchdog
70787ab6 110rpc.mountd
6e587818 111: > /dev/watchdog
a3f73298 112rpc.idmapd -S
6e587818 113: > /dev/watchdog
70787ab6 114exportfs -r
6e587818
HH
115: > /dev/watchdog
116: > /var/lib/dhcpd/dhcpd.leases
117: > /dev/watchdog
70787ab6 118chmod 777 /var/lib/dhcpd/dhcpd.leases
6e587818 119: > /dev/watchdog
909961d0 120dhcpd -cf /etc/dhcpd.conf -lf /var/lib/dhcpd/dhcpd.leases net1 net3
6e587818 121#echo -n 'V' : > /dev/watchdog
70787ab6 122#sh -i
909961d0 123#tcpdump -i net1
70787ab6 124# Wait forever for the VM to die
3aae122c 125echo "Serving"
70787ab6 126while :; do
9a52c3fd 127 sleep 10
6e587818 128 : > /dev/watchdog
70787ab6
LR
129done
130mount -n -o remount,ro /
131poweroff -f