sle() { # sl emacs
local f=/home/iank/.emacs.d/init.el
- sl --sl-test-cmd ". /etc/os-release ; printf %s \${VERSION//[^a-zA-Z0-9]/}; test -e $f && stat -c%Y $f" --sl-test-hook slemacs "$@"
+ sl --sl-test-cmd "sed -rn '/^VERSION=/{s/^.*=//;s/[^[:alnum:]]//gp}' /etc/os-release; test -e $f && stat -c%Y $f" --sl-test-hook slemacs "$@"
}
ccomp ssh sle
host-info-all() {
host-info-update
bindpushb8
- ssh li.b8.nz conflink
+ ssh iank@li.b8.nz conflink
wrt-setup
}
host-info-update() {
local -A vpn_ips host_ips host_macs nonvpn_ips all_ips
- local -a root_hosts nonroot_hosts
+ local -a root_hosts nonroot_hosts host_usbs
# the hosts with no mac
root_hosts=( bk je li b8.nz )
else
nonroot_hosts+=($host ${host}i)
fi
-
host_ips[$host]=$ip
- host_macs[$host]=$mac
+ if [[ $mac ]]; then
+ host_macs[$host]=$mac
+ fi
+
done </p/c/host-info
{
ipsuf=${vpn_ips[$host]}
i_port=$(( 2200 + ipsuf ))
cat <<EOF
- config redirect
- option name ssh$host
- option src wan
- option src_dport $i_port
- option dest_port 22
- option dest_ip \$l.$ipsuf
- option dest lan
- config rule
- option src wan
- option target ACCEPT
- option dest_port $i_port
+config redirect
+option name ssh$host
+option src wan
+option src_dport $i_port
+option dest_port 22
+option dest_ip \$l.$ipsuf
+option dest lan
+config rule
+option src wan
+option target ACCEPT
+option dest_port $i_port
EOF
done
echo "EOF"
echo "EOF"
} | u /p/c/dnsmasq-data
+
b8_ip=$(dig +short b8.nz @iankelling.org | tail -1)
if [[ ! $b8_ip ]]; then
echo "$0: error: got empty b8.nz ip. returning 1"