network: don't use "ifup -m"
[dracut.git] / modules.d / 80cms / cmsifup.sh
blobb1b96163478b4c5214fd5cb4df407f3e4fb5d6d0
1 #!/bin/bash
3 type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
5 DEVICE=$1
7 . /tmp/cms.conf
9 strglobin "$IPADDR" '*:*:*' && ipv6=1
11 if [ "$ipv6" ] && ! str_starts "$IPADDR" "["; then
12 IPADDR="[$IPADDR]"
15 if [ "$ipv6" ] && ! str_starts "$GATEWAY" "["; then
16 GATEWAY="[$GATEWAY]"
19 if [ "$ipv6" ]; then
20 DNS1=$(set -- ${DNS/,/ }; echo $1)
21 DNS2=$(set -- ${DNS/,/ }; echo $2)
22 else
23 DNS1=$(set -- ${DNS/:/ }; echo $1)
24 DNS2=$(set -- ${DNS/:/ }; echo $2)
28 echo "ip=$IPADDR::$GATEWAY:$NETMASK:$HOSTNAME:$DEVICE:none:$MTU:$MACADDR"
29 for i in $DNS1 $DNS2; do
30 echo "nameserver=$i"
31 done
32 } > /etc/cmdline.d/80-cms.conf
34 [ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
35 IFACES="$IFACES $DEVICE"
36 echo "$IFACES" >> /tmp/net.ifaces
38 ifup $DEVICE -m