fi
ll ~/.ssh/known_hosts
}
-khfix-r() { # known hosts fix + root
+khfix-r() { # known hosts fix without syncing to root user
_khfix-common "$@" || return 1
ssh $1 :
- rootsshsync
}
khfix() {
_khfix-common "$@" || return 1
ssh $1 :
+ rootsshsync
}
# copy path into clipboard
# Don't return 1 on nonmatch because this is meant to be
# interactive, not in a conditional.
if [[ ${#@} == 1 ]]; then
- grep --exclude-dir='*.emacs.d' --exclude-dir='*.git' -riIP --color=auto "$@" . || [[ $? == 1 ]]
+ grep -E --exclude-dir='*.emacs.d' --exclude-dir='*.git' -riIP --color=auto "$@" . || [[ $? == 1 ]]
else
- grep --exclude-dir='*.emacs.d' --exclude-dir='*.git' -riIP --color=auto "$@" || [[ $? == 1 ]]
+ grep -E --exclude-dir='*.emacs.d' --exclude-dir='*.git' -riIP --color=auto "$@" || [[ $? == 1 ]]
fi
}
ccomp grep gr grr
# so I've thrown a bunch of things at the wall to speed it up.
prompt-command() {
local return=$? # this MUST COME FIRST
+
+ # all usable colors:
+ # black
+ # green nonzero exit (pri 1)
+ # purple default
+ # purple bold
+ # red pwd different owner & group & not writable (pri 2)
+ # red bold pwd different owner & group & writable (pri 2)
+ # yellow
+
local ps_char ps_color
unset IFS
history -a # save history
fi
- case $return in
- 0) ps_color="$term_purple"
- ps_char='\$'
- ;;
- *) ps_color="$term_green"
- ps_char="$return \\$"
- ;;
- esac
+ ps_color="$term_purple"
+ ps_char='\$'
if [[ ! -O . ]]; then # not owner
if [[ -w . ]]; then # writable
ps_color="$term_bold$term_red"
else
- ps_color="$term_bold$term_green"
+ ps_color="$term_red"
fi
fi
+ if [[ $return != 0 ]]; then
+ ps_color="$term_green"
+ ps_char="$return \\$"
+ fi
+
# faster than sourceing the file im guessing
if [[ -e /dev/shm/iank-status && ! -e /tmp/quiet-status ]]; then
eval "$(< /dev/shm/iank-status)"
dsign iankelling.org expertpathologyreview.com zroe.org amnimal.ninja
lipush
for h in li bk; do
- e sshing $h
- ssh $h.b8.nz <<'EOF'
-source ~/.bashrc
-m dnsup
-EOF
+ m ssh $h.b8.nz dnsup
done
}
bindpushb8() {
lipush
for h in li bk; do
- e sshing $h
- ssh $h.b8.nz <<'EOF'
-source ~/.bashrc
-m dnsb8
-EOF
+ m ssh $h.b8.nz dnsb8
done
}
dnsb8() {
local f=/var/lib/bind/db.b8.nz
m ser stop named
- m sleep 1
- m sudo rm -fv $f.jnl $f.signed.jnl
+ # jbk is like a temp file. dunno if removing it helps
+
+ i=0
+ while pgrep '^named$' &>/dev/null; do
+ sleep .5
+ i=$(( i + 1 ))
+ if (( i > 100 )); then
+ echo "dnsb8: error: timeout waiting for named to exit"
+ return 1
+ fi
+ done
+ m sudo rm -fv $f.jnl $f.signed.jnl $f.jbk
m sudo install -m 644 -o bind -g bind /p/c/machine_specific/vps/bind-initial/db.b8.nz $f
m ser restart named
}
umask $umask_orig
}
+host-info-all() {
+ host-info-update
+ bindpushb8
+ wrt-setup
+}
+
+
+# if you change a host's ip, then run
+# bindpushb8
+# wrt-setup
host-info-update() {
local -A vpn_ips host_ips host_macs nonvpn_ips
EOF
- grep -E '^[a-z0-9]+[[:space:]]' /p/c/machine_specific/vps/bind-initial/db.b8.nz | awk '{print $1,$3}'
-
local host ipsuf f files
sedi '/edits below here are made automatically/,$d' /p/c/machine_specific/li/filesystem/etc/wireguard/wgmail.conf
echo 'local-data-ptr: "$l.'$ipsuf $host.b8.nz'"'
done
echo "EOF"
- } | u /p/ptr-data
+ } | u /p/c/ptr-data
{
echo "cat <<EOF"
echo "dhcp-host=${host_macs[$host]},set:$host,\$l.$ipsuf,$host"
done
echo "EOF"
- } | u /p/dnsmasq-data
+ } | u /p/c/dnsmasq-data
{
for host in ${!nonvpn_ips[@]}; do
}
+# grep + find
+gef() {
+ faf | grep -E "$@" ||:
+ rgv "$@"
+}
+
# rg my main files
rgm() {
rg "$@" /p/w.org /a/t.org /a/work.org /b
}
# re all my files more expansively
-
rem() {
local paths
paths="/p/c /b/"