iankelling.org
/
git
/
automated-distro-installer
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
changes for buster linode
[automated-distro-installer]
/
wrt-setup-local
diff --git
a/wrt-setup-local
b/wrt-setup-local
index b0635a1856ac2f58bb3a84500f0092d1a04f288c..91f8193779368ac8ea1989c16347cab7e531fa82 100755
(executable)
--- a/
wrt-setup-local
+++ b/
wrt-setup-local
@@
-24,8
+24,9
@@
usage() {
usage: ${0##*/} [-h] [-t 2|test] [-m WIRELESS_MAC]
setup my router in general: dhcp, dns, etc.
usage: ${0##*/} [-h] [-t 2|test] [-m WIRELESS_MAC]
setup my router in general: dhcp, dns, etc.
-Type 2 is for setting up a backup device. Type test is for setting up a
-testing device.
+Type 2 or 3 is for setting up a backup device, there are two kinds so
+that you can switch the main device to a backup, then a backup to the
+main. Type test is for setting up a testing device.
Passing an empty string for WIRELESS_MAC will cause the device's native
mac to be used.
Passing an empty string for WIRELESS_MAC will cause the device's native
mac to be used.
@@
-47,11
+48,17
@@
while getopts hm:t: opt; do
h) usage ;;
t)
case $2 in
h) usage ;;
t)
case $2 in
- 2)
+ 2
|3
)
dev2=true
dev2=true
+ libremanage_host=wrt
+ ;;&
+ 2)
lanip=4
hostname=wrt2
lanip=4
hostname=wrt2
- libremanage_host=wrt
+ ;;
+ 3)
+ lanip=14
+ hostname=wrt3
;;
test)
test=true
;;
test)
test=true
@@
-79,23
+86,37
@@
fi
macpre=${mac:0: -1}
macsuf=${mac: -1}
macpre=${mac:0: -1}
macsuf=${mac: -1}
+
+p_updated=false
pmirror() {
pmirror() {
+ if $p_updated; then
+ return
+ fi
# background: upgrading all packages is not recommended because it
# doesn't go into the firmware. build new firmware if you want
# lots of upgrades. I think /tmp/opkg-lists is a pre openwrt 14 location.
f=(/var/opkg-lists/*)
if ! (( $(date -r $f +%s) + 60*60*24 > $(date +%s) )); then
# background: upgrading all packages is not recommended because it
# doesn't go into the firmware. build new firmware if you want
# lots of upgrades. I think /tmp/opkg-lists is a pre openwrt 14 location.
f=(/var/opkg-lists/*)
if ! (( $(date -r $f +%s) + 60*60*24 > $(date +%s) )); then
- opkg update
+ if ! opkg update; then
+ echo "$0: warning: opkg update failed" >&2
+ fi
+ p_updated=true
fi
}
pi() {
fi
}
pi() {
- for x in "$@"; do
- if [[ ! $(opkg list-installed "$x") ]]; then
+ to_install=()
+ for p in "$@"; do
+ pname=${p##*/}
+ pname=${pname%%_*}
+ if [[ ! $(opkg list-installed "$pname") ]]; then
+ to_install+=($p)
pmirror
pmirror
- opkg install "$@"
fi
done
fi
done
+ if [[ $to_install ]]; then
+ opkg install ${to_install[@]}
+ fi
}
v() {
}
v() {
@@
-116,6
+137,7
@@
v() {
####### end uci example #####
uset() {
####### end uci example #####
uset() {
+ printf "+ uset %s\n" "$*"
local key="$1"
local val="$2"
local service="${key%%.*}"
local key="$1"
local val="$2"
local service="${key%%.*}"
@@
-200,8
+222,8
@@
mkdir -p /run/parabolaiso/bootmnt
# wiki says safe to do in case of fstab changes:
## ian: usb broke on old router. if that happens, can just comment this to disable problems
# wiki says safe to do in case of fstab changes:
## ian: usb broke on old router. if that happens, can just comment this to disable problems
-echo | cedit /etc/config/fstab ||:
-cedit /etc/config/fstab <<EOF || { v block umount; v block mount; }
+
#
echo | cedit /etc/config/fstab ||:
+
v
cedit /etc/config/fstab <<EOF || { v block umount; v block mount; }
config global automount
option from_fstab 1
option anon_mount 1
config global automount
option from_fstab 1
option anon_mount 1
@@
-404,15
+426,39
@@
config rule
option target ACCEPT
option family ipv6
option target ACCEPT
option family ipv6
+config rule
+ option name http-ipv6
+ option src wan
+ option dest lan
+ option dest_port 80
+ option target ACCEPT
+ option family ipv6
+
+config rule
+ option name https-ipv6
+ option src wan
+ option dest lan
+ option dest_port 443
+ option target ACCEPT
+ option family ipv6
+
+config rule
+ option name node-exporter
+ option src wan
+ option dest lan
+ option dest_port 9101
+ option target ACCEPT
+ option family ipv6
config rule
config rule
- option name mail-ipv6
+ option name mail
587
-ipv6
option src wan
option dest lan
option src wan
option dest lan
- option dest_port
25
+ option dest_port
587
option target ACCEPT
option family ipv6
option target ACCEPT
option family ipv6
+
EOF
EOF
@@
-430,6
+476,7
@@
$l.6 demohost
$l.7 x3
$l.8 tp b8.nz faiserver
$l.9 bb8
$l.7 x3
$l.8 tp b8.nz faiserver
$l.9 bb8
+$l.14 wrt3
72.14.176.105 li
# netns creation looks for next free subnet starting at 10.173, but I only
72.14.176.105 li
# netns creation looks for next free subnet starting at 10.173, but I only
@@
-474,6
+521,12
@@
EOF
# to start.
mkdir -p /mnt/usb/tftpboot
v cedit /etc/dnsmasq.conf <<EOF || dnsmasq_restart=true
# to start.
mkdir -p /mnt/usb/tftpboot
v cedit /etc/dnsmasq.conf <<EOF || dnsmasq_restart=true
+server=/dmarctest.b8.nz/#
+server=/_domainkey.b8.nz/#
+server=/_dmarc.b8.nz/#
+mx-host=b8.nz,mail.iankelling.org,10
+txt-record=b8.nz,"v=spf1 a ?all"
+
# https://ret2got.wordpress.com/2018/01/19/how-your-ethereum-can-be-stolen-using-dns-rebinding/
stop-dns-rebind
# https://ret2got.wordpress.com/2018/01/19/how-your-ethereum-can-be-stolen-using-dns-rebinding/
stop-dns-rebind