- move create_interface from initrd/s390 to root/sbin
[opensuse:installation-images.git] / data / root / etc / create_interface
1 #!/bin/sh
2 #
3 #       Create interface
4 #       Create chandev-Entry
5 #
6 ROOT=$1
7 INSTALLINF=/etc/install.inf
8 CHANDEVCONF=$ROOT/etc/chandev.conf
9 DEVICEDIR=$ROOT/etc/sysconfig/network/
10 ROUTINGFILE=$ROOT/etc/sysconfig/network/routes
11 # INSTALLINF=netsetup.inf
12 # INSTALLINF=install.inf
13 # CHANDEVCONF=chandev.conf
14 # DEVICEDIR=
15 # ROUTINGFILE=routes
16 #
17 #
18 if [ -f $INSTALLINF ]
19 then
20 #       Check for chandev
21         CHANDEV=`grep Chandev: $INSTALLINF | uniq | sed -e 's/Chandev: \\(.*\\)/\\1/'`
22         if [ ! -z "$CHANDEV" ]
23         then
24                 echo $CHANDEV >> $CHANDEVCONF
25         fi
26 #
27 #       Create interfacefile
28 #
29         NETDEV=`grep Netdevice: $INSTALLINF | uniq | sed -e 's/Netdevice: \\(.*\\)/\\1/'`
30         DEVICEFILE=${DEVICEDIR}ifcfg-$NETDEV
31         echo "BOOTPROTO=\"static\"" > $DEVICEFILE
32         echo "STARTMODE=\"onboot\"" >> $DEVICEFILE
33         IP=`grep "^IP:" $INSTALLINF | uniq | sed -e 's/IP: \\(.*\\)/\\1/'`
34         echo "IPADDR=\"$IP\"" >> $DEVICEFILE
35 #
36 #       Create pointopoint Interfaces
37 #
38         PTOP=`grep Pointopoint: $INSTALLINF | uniq | sed -e 's/Pointopoint: \\(.*\\)/\\1/'`
39         if [ ! -z "$PTOP" ]
40         then
41                 echo "REMOTE_IPADDR=\"$PTOP\"" >> $DEVICEFILE
42         fi
43 #
44 #       create broadcast-interface
45 #
46         NWMASK=`grep Netmask: $INSTALLINF | uniq | sed -e 's/Netmask: \\(.*\\)/\\1/'`
47         if [ ! -z "$NWMASK" ]
48         then
49                 echo "NETMASK=\"$NWMASK\"" >> $DEVICEFILE
50         fi
51         NW=`grep Netmask: $INSTALLINF | uniq | sed -e 's/Netmask: \\(.*\\)/\\1/'`
52         if [ ! -z "$NW" ]
53         then
54                 echo "NETWORK=\"$NW\"" >> $DEVICEFILE
55         fi
56         NWBROADCAST=`grep Netmask: $INSTALLINF | uniq | sed -e 's/Netmask: \\(.*\\)/\\1/'`
57         if [ ! -z "$NWBROADCAST" ]
58         then
59                 echo "BROADCAST=\"$NWBROADCAST\"" >> $DEVICEFILE
60         fi
61 #       
62 #       Create routingfile
63 #
64         GW=`grep Gateway: $INSTALLINF | uniq | sed -e 's/Gateway: \\(.*\\)/\\1/'`
65         if [ ! -z "$GW" ]
66         then
67                 echo "default $GW 0.0.0.0 -" >> $ROUTINGFILE
68         fi
69         
70 fi
71 :