makefile for pps-tools
[wyse_ntpd.git] / src / buildroot-2013.05 / custom / filesystem / etc / init.d / S01custom_pre_startup
1 #!/bin/sh
2
3 # deal with our mounts
4 echo "Mounting normal file systems"
5 echo ".... proc"
6 mkdir /proc > /dev/null 2>&1
7 mount -t proc proc /proc
8 mkdir /sys > /dev/null 2>&1
9 echo ".... sys"
10 mount -t sysfs sys /sys
11 mkdir -p /dev/pts > /dev/null 2>&1
12 echo ".... devpts"
13 mount -t devpts devpts /dev/pts
14 echo ".... tmpfs"
15 mount /tmp > /dev/null 2>&1
16
17
18 # create out gps0
19 echo "Creating serial devices"
20 echo ".... gps0"
21 ln -s /dev/ttyS0 /dev/gps0
22 echo ".... gpspps0"
23 mknod -m 0664 /dev/pps0 c 252 0
24 ln -s /dev/pps0 /dev/gpspps0
25
26 # mount the config file system
27 mkdir /fs > /dev/null 2>&1
28 echo "Mounting /fs"
29 mount /dev/sda1 /fs > /dev/null 2>&1
30
31 echo "Looking for system config"
32 if [ -f /fs/config/system ]
33 then
34         echo ".... found - loading"
35         . /fs/config/system
36 fi
37
38 echo "Looking for dropbear config"
39 if [ -f /fs/config/dropbear.tar ]
40 then
41         RD=`pwd`
42         cd /
43         echo ".... found - installing"
44         tar xf /fs/config/dropbear.tar
45         cd $RD
46 fi
47
48 # create the interfaces layout
49 echo "Setting up network interfaces configuration"
50 echo ".... loopback"
51 cat << EOF > /etc/network/interfaces
52 auto lo
53 iface lo inet loopback
54
55 EOF
56
57 # create network interfaces bit
58 if [ "x$INTERFACE" == "xdhcp" ]
59 then
60 echo ".... eth0 - dhcp"
61 cat << EOF >> /etc/network/interfaces
62 auto eth0
63 iface eth0 inet dhcp
64 EOF
65
66 else
67         # static network address
68         if [ "x$NET_ADDRESS" != "x" ]
69         then
70
71         echo ".... eth0 - static $NET_ADDRESS - $NET_MASK"
72 cat << EOF >> /etc/network/interfaces
73 auto eth0
74 iface eth0 inet static
75 address $NET_ADDRESS
76 netmask $NET_MASK
77 EOF
78         fi
79
80         # set gateway
81         if [ "x$NET_GW" != "x" ]
82         then
83         echo ".... eth0 - gateway $NET_GW"
84 cat << EOF >> /etc/network/interfaces
85 gateway $NET_GW
86 EOF
87         fi
88
89         # dns search domain
90         if [ "x$NET_SEARCH_DOMAIN" != "x" ]
91         then
92         echo ".... eth0 - search domain $NET_SEARCH_DOMAIN"
93 cat << EOF >> /etc/network/interfaces
94 gateway $NET_SEARCH_DOMAIN
95 EOF
96         fi
97
98         # dns servers
99         if [ "x$NET_DNS_SERVERS" != "x" ]
100         then
101         echo ".... eth0 - dns servers $NET_DNS_SERVERS"
102 cat << EOF >> /etc/network/interfaces
103 gateway $NET_DNS_SERVERS
104 EOF
105         fi
106
107 fi