#!/bin/sh if [ ! -e /etc/linksysconf ] then # Ok this may be a little hack for now # but Make sure the kernel module info is updated # So the driver can actually load the first time /usr/sbin/update-modules dd if=/dev/mtdblock1 of=/etc/linksysconf cat < /etc/original-network-settings # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) # The loopback interface auto lo iface lo inet loopback auto eth0 iface eth0 inet static EOF # Use the bootproto key to set "static" or "dhcp", then do other stuff based on that. # strings /etc/linksysconf | grep bootproto >> /etc/original-network-settings # sed -i -e 's/bootproto=//' /etc/original-network-settings strings /etc/linksysconf | grep ip_addr >> /etc/original-network-settings strings /etc/linksysconf | grep ^netmask >> /etc/original-network-settings strings /etc/linksysconf | grep ^gateway=. >> /etc/original-network-settings strings /etc/linksysconf | grep hw_addr >> /etc/original-network-settings sed -i -e 's/ip_addr=/ address /' /etc/original-network-settings sed -i -e 's/netmask=/ netmask /' /etc/original-network-settings sed -i -e 's/gateway=/ gateway /' /etc/original-network-settings sed -i -e 's/hw_addr=/ hwaddress ether /' /etc/original-network-settings mv /etc/network/interfaces /etc/network/interfaces.old cp /etc/original-network-settings /etc/network/interfaces echo "Configured /etc/network/interfaces from /etc/linksysconf" strings /etc/linksysconf | grep disk_server_name >> /tmp/hostname sed -i -e 's/disk_server_name=//' /tmp/hostname if [ -s /tmp/hostname ] ; then mv /etc/hostname /etc/hostname.old mv /tmp/hostname /etc/hostname echo "Configured /etc/hostname from /etc/linksysconf" fi strings /etc/linksysconf | grep dns_server1 >> /tmp/resolv.conf sed -i -e 's/dns_server1=/nameserver /' /tmp/resolv.conf if [ -s /tmp/resolv.conf ] ; then mv /etc/resolv.conf /etc/resolv.conf.old mv /tmp/resolv.conf /etc/resolv.conf echo "Configured /etc/resolv.conf from /etc/linksysconf" fi fi # Module loading handled more properly by update-modules and modprobe.conf