X-Git-Url: http://git.pjr.cc/?p=wyse_ntpd.git;a=blobdiff_plain;f=src%2Fbuildroot-2013.05%2Fcustom%2Ffilesystem%2Fetc%2Finit.d%2FS01custom_pre_startup;h=c9670a97dc466d1ef8ae112d96e0e9d3b221cafd;hp=17929bb6cbb9aeb8e27212a9aae4749d05b707ee;hb=f43263b21397ec7665c4a8094771007d668c102f;hpb=5124c4932b9aea51fefc402049cb888d6636c59b diff --git a/src/buildroot-2013.05/custom/filesystem/etc/init.d/S01custom_pre_startup b/src/buildroot-2013.05/custom/filesystem/etc/init.d/S01custom_pre_startup index 17929bb..c9670a9 100755 --- a/src/buildroot-2013.05/custom/filesystem/etc/init.d/S01custom_pre_startup +++ b/src/buildroot-2013.05/custom/filesystem/etc/init.d/S01custom_pre_startup @@ -1,33 +1,137 @@ #!/bin/sh # deal with our mounts +echo "Mounting info file systems" +echo ".... proc" mkdir /proc > /dev/null 2>&1 mount -t proc proc /proc mkdir /sys > /dev/null 2>&1 +echo ".... sys" mount -t sysfs sys /sys mkdir -p /dev/pts > /dev/null 2>&1 +echo ".... devpts" mount -t devpts devpts /dev/pts +echo ".... tmpfs" mount /tmp > /dev/null 2>&1 -# create out gps0 -ln -s /dev/ttyS0 /dev/gps0 -mknod -m 0664 /dev/pps0 c 252 0 -ln -s /dev/pps0 /dev/gpspps0 - # mount the config file system mkdir /fs > /dev/null 2>&1 +echo "Mounting /fs" mount /dev/sda1 /fs > /dev/null 2>&1 +echo "Looking for system config" if [ -f /fs/config/system ] then + echo ".... found - loading" . /fs/config/system fi +echo "Looking for dropbear config" if [ -f /fs/config/dropbear.tar ] then RD=`pwd` cd / - tar xf /fs/config/dropbear.tar + echo ".... found - installing" + tar xf /fs/config/dropbear.tar > /dev/null 2>&1 cd $RD fi + +# bring the interface up for a bit +ifconfig eth0 up + +# create the interfaces layout +echo "Setting up network interfaces configuration" +echo ".... loopback" +cat << EOF > /etc/network/interfaces +auto lo +iface lo inet loopback + +EOF + +# create network interfaces bit +if [ "x$INTERFACE" == "xdhcp" ] +then +echo ".... eth0 - dhcp" +cat << EOF >> /etc/network/interfaces +auto eth0 +iface eth0 inet dhcp +EOF + +else + # static network address + if [ "x$NET_ADDRESS" != "x" ] + then + + echo ".... eth0 - static $NET_ADDRESS - $NET_MASK" +cat << EOF >> /etc/network/interfaces +auto eth0 +iface eth0 inet static +address $NET_ADDRESS +netmask $NET_MASK +EOF + fi + + # set gateway + if [ "x$NET_GW" != "x" ] + then + echo ".... eth0 - gateway $NET_GW" +cat << EOF >> /etc/network/interfaces +gateway $NET_GW +EOF + fi + + # dns search domain + if [ "x$NET_SEARCH_DOMAIN" != "x" ] + then + echo ".... eth0 - search domain $NET_SEARCH_DOMAIN" +cat << EOF >> /etc/network/interfaces +dns-search $NET_SEARCH_DOMAIN +EOF + fi + + # dns servers + if [ "x$NET_DNS_SERVERS" != "x" ] + then + echo ".... eth0 - dns servers $NET_DNS_SERVERS" +cat << EOF >> /etc/network/interfaces +dns-nameservers $NET_DNS_SERVERS +EOF + fi + +fi + +# create out gps0 +echo "Creating serial devices" +echo ".... gps0" +ln -s /dev/ttyS0 /dev/gps0 + + +# addatch the pps device +ldattach pps /dev/ttyS0 +# find the minor/major numbers of the device and create +if [ -f /sys/class/pps/pps0/dev ] +then + PPSMAJOR=`cat /sys/class/pps/pps0/dev|cut -f1 -d:` + PPSMINOR=`cat /sys/class/pps/pps0/dev|cut -f2 -d:` + echo ".... pps0" + mknod -m 0664 /dev/pps0 c $PPSMAJOR $PPSMINOR + echo ".... gpspps0" + ln -s /dev/pps0 /dev/gpspps0 +else + echo "Cant find pps device?" +fi + +if [ "x$SYSLOG_HOST" != "x" ] +then + syslogd -R $SYSLOG_HOST +fi + +# lastly, work around for thttpd problems +mv /var/www/thttpd_config /var/www/thttpd_config.orig +cat > /var/www/thttpd_config << EOF +dir=/var/www/data +cgipat=**.cgi +pidfile=/var/run/thttpd.pid +logfile=/dev/null +EOF