X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=brc2;h=3f0e9ec06504d50d2f43289e9ebf2a423196a0be;hb=6061d88c7d5beda3e974943eb8676f7c39d4ae9f;hp=220f1241890f111bbf114f9fc5e1685342f2a768;hpb=95a4248e98e118024f5065636288406e8e8c9a30;p=distro-setup diff --git a/brc2 b/brc2 index 220f124..3f0e9ec 100644 --- a/brc2 +++ b/brc2 @@ -29,7 +29,6 @@ export WCDHOME=/a source /a/bin/distro-functions/src/identify-distros source /a/bin/distro-functions/src/package-manager-abstractions source /a/bin/log-quiet/logq-function -source /a/bin/small-misc-bash/psg-function # for x in /a/bin/bash_unpublished/source-!(.#*); do echo source $x; done source /a/bin/bash_unpublished/source-semi-priv source /a/bin/bash_unpublished/source-state @@ -101,8 +100,8 @@ set -e conflink f=/var/lib/bind/db.b8.nz ser stop bind9 -s rm -fv $f.jnl -s install -m 644 -o bind -g bind /p/c/machine_specific/linode/bind-initial/db.b8.nz $f +sudo rm -fv $f.jnl +sudo install -m 644 -o bind -g bind /p/c/machine_specific/linode/bind-initial/db.b8.nz $f ser restart bind9 EOF done @@ -122,8 +121,10 @@ bbk() { # btrbk wrapper fi # run latest install-my-scripts - btrbk-run "$@" | pee cat "systemd-cat -t btrbk-run" - $active && ser enable btrbk.timer + btrbk-run "$@" |& pee cat "systemd-cat -t btrbk-run" + if $active; then + ser enable btrbk.timer + fi } bfg() { java -jar /a/opt/bfg-1.12.14.jar "$@"; } @@ -137,14 +138,14 @@ bpull() { c / # run latest install-my-scripts - switch-mail-host $1 $HOSTNAME | pee cat "systemd-cat -t switch-mail-host" + switch-mail-host pull $1 |& pee cat "systemd-cat -t switch-mail-host" } bpush() { [[ $1 ]] || return 1 c / # run latest install-my-scripts - switch-mail-host $HOSTNAME $1 | pee cat "systemd-cat -t switch-mail-host" + switch-mail-host push $1 |& pee cat "systemd-cat -t switch-mail-host" } lipush() { # note, i had --delete-excluded, but that deletes all files in --exclude-from on @@ -153,13 +154,13 @@ lipush() { p=(/a/bin /a/exe /a/h /a/c /p/c/machine_specific/linode{,.hosts} /a/opt/{emacs,emacs-debianstable,mu}) a="-ahviSAXPH --specials --devices --delete --relative --exclude-from=/p/c/li-rsync-excludes" ret=0 - m rsync $@ $a ${p[@]} /p/c/machine_specific/l2 root@l2.b8.nz:/ || ret=$? - m rsync $@ $a ${p[@]} /p/c/machine_specific/li root@li.b8.nz:/ || ret=$? - m rsync $@ -ahviSAXPH root@iankelling.org:/a/h/proposed-comments/ /a/h/proposed-comments || ret=$? + m rsync "$@" $a ${p[@]} /p/c/machine_specific/l2 root@l2.b8.nz:/ || ret=$? + m rsync "$@" $a ${p[@]} /p/c/machine_specific/li root@li.b8.nz:/ || ret=$? + m rsync "$@" -ahviSAXPH root@iankelling.org:/a/h/proposed-comments/ /a/h/proposed-comments || ret=$? return $ret } lipushnoe() { # noe = noemacs. for running faster. - rsync $@ --delete-excluded -ahviSAXPH --specials --devices --delete --relative \ + rsync "$@" --delete-excluded -ahviSAXPH --specials --devices --delete --relative \ --exclude-from=/p/c/li-rsync-excludes /a/bin /a/exe /a/h /a/c /p/c/machine_specific/li root@li:/ } @@ -232,14 +233,16 @@ chrome() { } -dat() { # do all tee, for more complex scripts - tee >(ssh frodo bash -l) >(bash -l) >(ssh x2 bash -l) >(ssh tp bash -l) +# do all tee. +# pipe to this, or just type like a shell +# todo: test this +dat() { + tee >(ssh frodo.b8.nz) >(ssh x2) >(ssh tp.b8.nz) >(ssh kw) >(ssh tp.b8.nz) } da() { # do all local host - "$@" - for host in x2 tp kd; do - ssh $host $(printf "") + for host in x2 kw tp.b8.nz x3.b8.nz frodo.b8.nz; do + ssh $host "$@" done } @@ -263,44 +266,26 @@ debian_pick_mirror () { sudo sed -ri "/http.us.debian.org/ s@( *[^ #]+ +)[^ ]+([^#]+).*@\1$url\2# http.us.debian.org@" /etc/apt/sources.list sudo apt-get update } -dig() { - command dig +nostats +nocmd "$@" -} -# Output with sections sorted, and removal of query id, so 2 dig outputs can be diffed. -digsort() { - local sec - sec= - dig +nordflag "$@" | sed -r 's/^(;; ->>HEADER<<-.*), id: .*/\1/' | while read -r l; do - if [[ $l == [^\;]* ]]; then - sec+="$l"$'\n' - else - if [[ $sec ]]; then - printf "%s" "$sec" | sort - sec= - fi - printf "%s\n" "$l" - fi - done -} -# note: only the soa master nameserver will respond with -# ra "recursive answer" flag. That difference is meaningless afaik. -# Same thing happens with gnu nameservers. digme() { - digsort "$@" @ns1.iankelling.org | tee /tmp/digme - diff -u /tmp/digme <(digsort "$@" @ns2.iankelling.org) + digdiff @ns{1,2}.iankelling.org "$@" } dup() { local ran_d ran_d=false + system-status _ case $PS1 in - *DISTRO-BEGIN*) + *DISTRO-BEGIN!*|*DISTRO!*) + pushd / /b/ds/distro-begin || return $? + popd ran_d=true ;;& - *DISTRO-END*) + *DISTRO-END!*|*DISTRO!*) + pushd /b/ds/distro-end || return $? + popd ran_d=true ;;& *CONFLINK*) @@ -399,11 +384,15 @@ fdroid_pkgs=( fdup() { local -A installed updated local p - fdroidcl update + # tried putting this in go buildscript cronjob, + # but it failed with undefined: os.UserCacheDir. I expect its due to + # an environment variable missing, but its easier just to stick it here. + m go get -u mvdan.cc/fdroidcl || return 1 + m fdroidcl update if fdroidcl search -u | grep ^org.fdroid.fdroid; then fdroidcl install org.fdroid.fdroid sleep 5 - fdroidcl update + m fdroidcl update fi for p in $(fdroidcl search -i| grep -o "^\S\+"); do installed[$p]=true @@ -413,14 +402,14 @@ fdup() { done for p in ${fdroid_pkgs[@]}; do if ! ${installed[$p]:-false}; then - fdroidcl install $p + m fdroidcl install $p # sleeps are just me being paranoid since replicant has a history of crashing when certain apps are installed sleep 5 fi done for p in ${!installed[@]}; do if ! ${updated[$p]:-true}; then - fdroidcl install $p + m fdroidcl install $p sleep 5 fi done @@ -530,12 +519,10 @@ fw() { firefox -P default "$@" >/dev/null 2>&1 } - gitian() { git config user.email ian@iankelling.org } - # at least in flidas, things rely on gpg being gpg1 gpg() { command gpg2 "$@" @@ -550,7 +537,6 @@ gse() { --suppress-cc=self "$@" } - hstatus() { # do git status on published repos. c /a/bin/githtml @@ -566,11 +552,16 @@ hstatus() { done } - idea() { /a/opt/idea-IC-163.7743.44/bin/idea.sh "$@" &r } +ilog() { + chan=${1:-#fsfsys} + # use * instead of -r since that does sorted order + ssh root@iankelling.org "cd /var/lib/znc/moddata/log/iank/freenode/$chan && hr && for x in *; do echo \$x; cat \$x; hr; done" | less +G +} + o() { if type gvfs-open &> /dev/null ; then gvfs-open "$@" @@ -588,7 +579,7 @@ jtail() { journalctl -n 10000 -f "$@" | jfilter } jr() { journalctl "$@" | jfilter | less ; } -jrf() { journalctl -f "$@" | jfilter; } +jrf() { journalctl -n 200 -f "$@" | jfilter; } kff() { # keyboardio firmware flash @@ -654,32 +645,35 @@ mdt() { firefox /tmp/mdtest.html } - - mo() { xset dpms force off; } # monitor off +myirc() { + chan=${1:-fsf-office} + # use * instead of -r since that does sorted order + ssh root@iankelling.org "cd /var/lib/znc/moddata/log/iank/freenode/#$chan; grep '\