Sfoglia il codice sorgente

1、增加网络重置功能,同时长按上键和下键,能够强制恢复网络默认配置

liyuezong 1 anno fa
parent
commit
2b0f967718
2 ha cambiato i file con 54 aggiunte e 1 eliminazioni
  1. 1 1
      output/t113i/pack.sh
  2. 53 0
      output/t113i/pack_dir/opt/recovery.sh

+ 1 - 1
output/t113i/pack.sh

@@ -19,7 +19,7 @@ echo remove tmp file
 #rm -r $OUTDIR/$TMP $OUTDIR/$TARGET
 
 echo tar base files ...
-SCRIPTS="$SRCDIR/etc/* $SRCDIR/etc/init.d/* $SRCDIR/usr/sbin/* $SRCDIR/root/run/app/snmp/conf/*"
+SCRIPTS="$SRCDIR/etc/* $SRCDIR/etc/init.d/* $SRCDIR/usr/sbin/* $SRCDIR/root/run/app/snmp/conf/* $SRCDIR/opt/*"
 dos2unix -q $SCRIPTS
 cp -f $SRCDIR/root/run/app/pdu_dat.db $SRCDIR/root/run/app/pdu_dat_bak.db
 chmod 777 -R $SRCDIR

+ 53 - 0
output/t113i/pack_dir/opt/recovery.sh

@@ -0,0 +1,53 @@
+#! /bin/sh
+
+# 配置文件路径
+DNS_CONFIG_FILE="/etc/dnsmasq.conf"
+ 
+# 恢复DNS配置
+echo "正在恢复DNS配置..."
+cat > "$DNS_CONFIG_FILE" << EOF
+interface=eth0
+no-hosts
+no-resolv
+ 
+server=8.8.8.8
+server=114.114.114.114
+EOF
+ 
+killall dnsmasq; /usr/sbin/dnsmasq &
+echo "DNS配置 /etc/dnsmasq.conf已恢复成功"
+
+
+# 恢复IP配置
+# 配置文件路径
+IP_CONFIG_FILE="/etc/network/interfaces"
+ 
+# 恢复IP配置
+echo "正在恢复IP配置..."
+cat > "$IP_CONFIG_FILE" << EOF
+auto lo
+iface lo inet loopback
+ 
+auto eth0
+iface eth0 inet static
+  address 192.168.1.132
+  netmask 255.255.255.0
+  gateway 192.168.1.1
+ 
+iface eth0 inet6 static
+  address fe80::132
+  netmask 64
+  gateway fe80::1
+ 
+auto eth1
+iface eth1 inet dhcp
+pre-up /etc/network/nfs_check
+wait-delay 5
+hostname \$(hostname)
+EOF
+ 
+echo "IP配置 /etc/network/interfaces已恢复成功"
+
+
+reboot
+