forked from zw963/asuswrt-merlin-transparent-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init_route
37 lines (28 loc) · 870 Bytes
/
init_route
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# run following to reset route
# ssh admin@192.168.50.1 <<< "$(cat init_route)" to reset router
# ssh admin@192.168.50.1 reboot
[ -e /opt/etc/toggle_proxy.sh ] && sh /opt/etc/toggle_proxy.sh disable
date=$(date '+%Y-%m-%d_%H-%M-%S')
mv /tmp/mnt/sda1/entware /tmp/mnt/sda1/entware_bak_$date
cp -a /tmp/mnt/sda1/entware.bak /tmp/mnt/sda1/entware
if fgrep -qs 'conf-dir=/opt/etc/dnsmasq.d/,*.conf' /etc/dnsmasq.conf; then
sed -i 's#conf-dir=/opt/etc/dnsmasq.d/,\*\.conf$##g' /etc/dnsmasq.conf
fi
dnsmasq --test && kill $(cat /var/run/dnsmasq.pid) && dnsmasq --log-async
rm -f /opt/var/lock/opkg.lock
cat <<'HEREDOC' > /jffs/scripts/services-start
#!/bin/sh
RC='/opt/etc/init.d/rc.unslung'
i=30
until [ -x "$RC" ] ; do
i=$(($i-1))
if [ "$i" -lt 1 ] ; then
logger "Could not start Entware"
exit
fi
sleep 1
done
$RC start
HEREDOC
exit