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.
h) usage ;;
t)
case $2 in
- 2)
+ 2|3)
dev2=true
+ libremanage_host=wrt
+ ;;&
+ 2)
lanip=4
hostname=wrt2
- libremanage_host=wrt
+ ;;
+ 3)
+ lanip=14
+ hostname=wrt3
;;
test)
test=true
macpre=${mac:0: -1}
macsuf=${mac: -1}
+
+p_updated=false
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
- opkg update
+ if ! opkg update; then
+ echo "$0: warning: opkg update failed" >&2
+ fi
+ p_updated=true
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
- opkg install "$@"
fi
done
+ if [[ $to_install ]]; then
+ opkg install ${to_install[@]}
+ fi
}
v() {
####### end uci example #####
uset() {
+ printf "+ uset %s\n" "$*"
local key="$1"
local val="$2"
local service="${key%%.*}"
# 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
$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