Skip to content

Instantly share code, notes, and snippets.

@highgain86j
Last active December 1, 2021 02:27
Show Gist options
  • Save highgain86j/a9082face7dcd0c37e2dba0cb44dcdc4 to your computer and use it in GitHub Desktop.
Save highgain86j/a9082face7dcd0c37e2dba0cb44dcdc4 to your computer and use it in GitHub Desktop.
OpenWrt must-have
#!/bin/bash
for file in `find /etc/bird*.conf /etc/config/ -type f`; do
sed -i 's/\(10\.255\.53\.\)0/\1100/g' "${file}"
sed -i 's/\(10\.255\.53\.\)90/\1110/g' "${file}"
sed -i 's/\(10\.1\.1[4,5]\.\)90/\130/g' "${file}"
done; \
for service in network bird4 bird6; do
"/etc/init.d/${service}" restart
done
#opkg update
opkg install $(opkg list | awk '{print $1}' | \
grep -E '^curl$|^ip-full|^bash$|^bwm-ng$|^kmod-dummy$|^nano$|bird|^conntrack$|^ipset$' | \
grep -Ev '^lib|i18n|-bird')
#opkg install $(opkg list | awk '{print $1}' | \
#grep -E '^curl$|^ip-full|^bash$|unbound|bwm-ng|kmod-dummy|nano|bird|adblock|^conntrack$|^ipset$' | \
#grep -Ev 'badblock|asterisk|^lib|i18n|simple|-bird')
rm `find /etc/ -type f | grep -E '\-opkg$'`
uci set system.@system[0].hostname='ns'
uci commit system
echo "config bird 'bird'" | tee /etc/config/bird4 /etc/config/bird6
uci set bird4.bird.use_UCI_config='0'
uci commit bird4
/etc/init.d/bird4 restart
/etc/init.d/bird4 enable
uci set bird6.bird.use_UCI_config='0'
uci commit bird6
/etc/init.d/bird6 restart
/etc/init.d/bird6 enable
/etc/init.d/dnsmasq stop
/etc/init.d/dnsmasq disable
#/etc/init.d/unbound restart
#/etc/init.d/unbound enable
uci set firewall.@defaults[0].disable_ipv6='1'
uci commit firewall
/etc/init.d/firewall stop
/etc/init.d/firewall disable
echo "dummy numdummies=3" > "$(ls /etc/modules.d/*-dummy)"
#threads=$(grep -Ec '^processor.*\: [0-9]+' /proc/cpuinfo);\
#target_script=$(grep -E '\.sh$' /etc/init.d/unbound | uniq | awk '{print $2}');\
#sed -i "s/num-threads\:.*\"/num-threads\: ${threads}\"/g" "${target_script}"
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment