a simple script to prevent bricking for openwrt
root@OpenWrt:~# cat /etc/init.d/unbrick
#!/bin/sh /etc/rc.common
START=20
bakcat() {
for i in $* ; do
echo "################file seperator for $i##################"
cat $i
echo
done
}
revert() {
echo revert config...
bakcat /etc/config/* >/root/cfgbak.all 2>&1
cp -R /root/cfgbak/* /etc/config/
}
start() {
count=$(cat /root/count_file)
if [ $count -eq 0 ] ; then
revert
fi
count=$((count-1))
echo $count > /root/count_file
}
root@OpenWrt:~# /etc/init.d/unbrick enable
root@OpenWrt:~# echo 3 > /root/count_file
root@OpenWrt:~# mkdir /root/cfgbakbefore modifying files in /etc/config, put an usable copy in /root/cfgbak.
if the script can run perfectly, echo 3 > /root/count_file after every reboot.
disable this script if the config files are valid and need no more change.
if any config file is wrong, reboot 3 times to unblick.
Thanks for sharing this source code. I’m sure that this could help me a lot. You truly save my day,a big thanks to you for sharing your knowledge to us.
Truly impressive blog. Seemingly I am enjoying reading that content on this blog. Thanks!
The codes you provide in this post are very useful and helpful to me and also to others
. i’m sure many of us are very thankful that there is still a person who always share their knowledge to us like you
.
Perhaps that last step was a bit over-confident, although I’ve upgraded Asus boxes many times this way (albeit not to this SVN code). I also forgot to check whether boot_wait was on or off before doing this.
The codes that you post are so useful and really helps me a lot. Thanks for the post!
I’m sure many of us are very thankful that there is still a person who always share their knowledge towards the readers. I’ve learning your blog much. Thanks!
Impressive blog.The codes you provide in this post are very useful and helpful to me and also to others .A big thanks to you.
I think you don’t need to get one more WZR-HP-G300NH.
Just try tftp method on wiki with bricked one. If it doesn’t go well, try it again and again.
I was happy enough that I got some cool code that can be helpful to fix my stuff. I check it later to modify the files if this can be workable on interfacing. Thanks
You truly save my day,a big thanks to you for sharing your knowledge to us. You hit the nail on the head. Keep it up!
A track of code that you’ll providing here that makes me knowledgeable enough to do so. I will bookmark this site promptly.
african mango