3 type getarg
>/dev
/null
2>&1 || .
/lib
/dracut-lib.sh
5 mkdir
-m 0755 -p /run
/initramfs
/state
/etc
/sysconfig
/network-scripts
7 function cms_write_config
()
10 SUBCHANNELS
="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
13 read -a subch_array
<<< "indexzero,$SUBCHANNELS"
15 devbusid
=${subch_array[1]}
16 if [ "$NETTYPE" = "ctc" ]; then
22 DEVICE
=$
(cd /sys
/devices
/${driver}/$devbusid/net
/ && set -- * && [ "$1" != "*" ] && echo $1)
24 uuid
=$
(cat /proc
/sys
/kernel
/random
/uuid
)
26 IFCFGFILE
=/run
/initramfs
/state
/etc
/sysconfig
/network-scripts
/ifcfg-
$DEVICE
28 strglobin
"$IPADDR" '*:*:*' && ipv6
=1
30 # to please NetworkManager on startup in loader before loader reconfigures net
31 cat > /etc
/sysconfig
/network
<< EOF
34 echo "$HOSTNAME" > /etc
/hostname
36 echo "NETWORKING_IPV6=yes" >> /etc
/sysconfig
/network
38 echo "NETWORKING=yes" >> /etc
/sysconfig
/network
41 cat > $IFCFGFILE << EOF
47 SUBCHANNELS=$SUBCHANNELS
50 cat >> $IFCFGFILE << EOF
53 IPV6ADDR=$IPADDR/$NETMASK
54 IPV6_DEFAULTGW=$GATEWAY
57 cat >> $IFCFGFILE << EOF
65 DNS1
=$
(set -- ${DNS/,/ }; echo $1)
66 DNS2
=$
(set -- ${DNS/,/ }; echo $2)
68 DNS1
=$
(set -- ${DNS/:/ }; echo $1)
69 DNS2
=$
(set -- ${DNS/:/ }; echo $2)
71 # real DNS config for NetworkManager to generate /etc/resolv.conf
72 [ "$DNS1" != "" ] && echo "DNS1=$DNS1" >> $IFCFGFILE
73 [ "$DNS2" != "" ] && echo "DNS2=$DNS2" >> $IFCFGFILE
74 # just to please loader's readNetInfo && writeEnabledNetInfo
75 # which eats DNS1,DNS2,... and generates it themselves based on DNS
77 [ "$DNS" != "" ] && echo "DNS=\"$DNS\"" >> $IFCFGFILE
79 [ "$DNS" != "" ] && echo "DNS=\"${DNS/:/,}\"" >> $IFCFGFILE
81 # colons in SEARCHDNS already replaced with spaces above for /etc/resolv.conf
82 [ "$SEARCHDNS" != "" ] && echo "DOMAIN=\"$SEARCHDNS\"" >> $IFCFGFILE
83 [ "$NETTYPE" != "" ] && echo "NETTYPE=$NETTYPE" >> $IFCFGFILE
84 [ "$PEERID" != "" ] && echo "PEERID=$PEERID" >> $IFCFGFILE
85 [ "$PORTNAME" != "" ] && echo "PORTNAME=$PORTNAME" >> $IFCFGFILE
86 [ "$CTCPROT" != "" ] && echo "CTCPROT=$CTCPROT" >> $IFCFGFILE
87 [ "$MACADDR" != "" ] && echo "MACADDR=$MACADDR" >> $IFCFGFILE
89 for option
in LAYER2 PORTNO
; do
90 [ -z "${!option}" ] && continue
91 [ -n "$optstr" ] && optstr
=${optstr}" "
92 optstr
=${optstr}$(echo ${option} | sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')"="${!option}
94 # write single quotes since network.py removes double quotes but we need quotes
95 echo "OPTIONS='$optstr'" >> $IFCFGFILE
100 echo "files /etc/sysconfig/network-scripts" >> /run
/initramfs
/rwtab
101 echo "files /var/lib/dhclient" >> /run
/initramfs
/rwtab
104 [ -f /tmp
/cms.conf
] && cms_write_config