|
|
@@ -30,21 +30,26 @@ function rm_old()
|
|
|
}
|
|
|
function set_net()
|
|
|
{
|
|
|
- ip4=`ip addr show dev eth0 | sed -e's/^.*inet \([^ ]*\)\/.*$/\1/;t;d'`
|
|
|
- ip6=`ip addr show dev eth0 | sed -e's/^.*inet6 \([^ ]*\)\/.*$/\1/;t;d'`
|
|
|
- str_lo="auto lo\niface lo inet loopback\n\n"
|
|
|
- str_e0="auto eth0\niface eth0 inet static\naddress $ip4\nnetmask 255.255.255.0\ngateway 192.168.1.1\n\n"
|
|
|
+ netfile=/etc/network/interfaces
|
|
|
+ content=$(cat $netfile)
|
|
|
|
|
|
- if [ "$ip6" = "" ]; then
|
|
|
- echo ___$ip6
|
|
|
+ if [[ $content == *"address"* ]]; then
|
|
|
+ return
|
|
|
fi
|
|
|
-
|
|
|
- str_e1="auto eth1\niface eth1 inet dhcp\npre-up /etc/network/nfs_check\nwait-delay 5\nhostname $(hostname)\n"
|
|
|
|
|
|
- netfile=/etc/network/interfaces
|
|
|
+ ip4=192.168.1.132
|
|
|
+ mask4=255.255.255.0
|
|
|
+ gw4=192.168.1.1
|
|
|
+
|
|
|
+ str_lo="auto lo\niface lo inet loopback\n\n"
|
|
|
+ str_e0="auto eth0\niface eth0 inet static\naddress $ip4\nnetmask $mask4\ngateway $gw4\n\n"
|
|
|
+ str_e1="auto eth1\niface eth1 inet dhcp\npre-up /etc/network/nfs_check\nwait-delay 5\nhostname $(hostname)\n"
|
|
|
+
|
|
|
echo -e $str_lo > $netfile
|
|
|
echo -e $str_e0 >> $netfile
|
|
|
echo -e $str_e1 >> $netfile
|
|
|
+
|
|
|
+ ifconfig eth0 $ip4
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -60,7 +65,7 @@ echo release $obj ...
|
|
|
tar -xpf $obj -C / >/dev/null 2>&1
|
|
|
rm $obj
|
|
|
|
|
|
-#set_net
|
|
|
+set_net
|
|
|
|
|
|
echo +++++++ upgrade ok! +++++++
|
|
|
echo reboot device now ...
|