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
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
fi
# run latest
install-my-scripts
- btrbk-run "$@" |& pee cat "systemd-cat -t btrbk-run"
+ unbuffer btrbk-run "$@" |& pee cat "systemd-cat -t btrbk-run"
if $active; then
ser enable btrbk.timer
fi
c /
# run latest
install-my-scripts
- switch-mail-host pull $1 |& pee cat "systemd-cat -t switch-mail-host"
+ ubuffer 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 push $1 |& pee cat "systemd-cat -t switch-mail-host"
+ ubuffer 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
# do all tee.
# pipe to this, or just type like a shell
+# todo: test this
dat() {
- tee >(ssh frodo.b8.nz bash -l) >(ssh x2 bash -l) >(ssh tp.b8.nz bash -l) >(ssh kw bash -l) >(ssh tp.b8.nz bash -l)
+ tee >(ssh frodo.b8.nz) >(ssh x2) >(ssh tp.b8.nz) >(ssh kw) >(ssh tp.b8.nz)
}
da() { # do all
local host
ran_d=true
;;&
*DISTRO-END!*|*DISTRO!*)
- pushd
+ pushd /
/b/ds/distro-end || return $?
popd
ran_d=true
hr
e "s lshw -C network"
hr
- s lshw -C network
+ sudo lshw -C network
}
nk() {
ser stop NetworkManager
ser stop dnsmasq
- s resolvconf -d NetworkManager
+ sudo resolvconf -d NetworkManager
ser start dnsmasq
- s ifup br0
+ sudo ifup br0
}
ngo() {
- s ifdown br0
+ sudo ifdown br0
ser start NetworkManager
sleep 4
- s nmtui-connect
+ sudo nmtui-connect
}
otp() {
#rbp() { rbt post -o "$@"; }
rebr() {
- s ifdown br0
- s ifup br0
+ sudo ifdown br0
+ sudo ifup br0
}
resolvcat() {
}
spend() {
- s systemctl suspend
+ sudo systemctl suspend
}
# ssh, copy my universal config over if needed.
# By default .bashrc is sourced for ALL ssh commands. This is wonky.
# Normally, this file is not sourced when a script is run, but we can
-# override that by having #!/bin/bash -l. I want the same thing for ssh
+# override that by sourcing ~/.bashrc. I want the same thing for ssh
# commands. when a local script runs an ssh command, bashrc should not be
# sourced, unless we use a modified command.
#
type=${tmp2: -1}
if [[ $type == b ]]; then
info_sec=${tmp::10}
- if (( $(stat -c%Y /b/ds/brc) > info_sec || $(stat -c%Y /b/ds/.bashrc) > info_sec )); then
- dorsync=true
- rm -f $sshinfo
- fi
+ for f in /b/ds/sl/.iank/*; do
+ if (( $(stat -L -c%Y $f) > info_sec )); then
+ dorsync=true
+ rm -f $sshinfo
+ break
+ fi
+ done
fi
else
- dorsync=true
# use this weird yes thing to ensure we know ssh succeeded
if ! tmp=$(command ssh "${args[@]}" "$remote" "if test -e /a/bin/ds/.bashrc -a -L .bashrc; then echo yes; fi"); then
echo failed sl test. doing plain ssh -v
if [[ $tmp == yes ]]; then
type=a
else
+ dorsync=true
type=b
fi
fi
- if [[ $type == b ]] && $dorsync; then
- if ! RSYNC_RSH="ssh ${args[*]}" rsync -rptL /b/ds/sl/.iank "$remote":; then
- echo WARNING: rsync failed. remove $sshinfo to try again
- fi
+ if $dorsync; then
+ RSYNC_RSH="ssh ${args[*]}" rsync -rptL /b/ds/sl/.iank "$remote":
fi
if $dorsync || ! $haveinfo; then
sshinfo=/p/sshinfo/$now$type"$remote"
chmod 666 $sshinfo
fi
if [[ $type == b ]]; then
- if $dorsync; then
- RSYNC_RSH="ssh ${args[*]}" rsync -rptL /b/ds/sl/.iank "$remote":
- fi
if (( ${#@} )); then
# Theres a couple ways to do this. im not sure whats best,
if [[ -t 0 ]]; then
BRC=t command ssh "${args[@]}" "$remote" ${@@Q}
else
- command ssh "${args[@]}" "$remote" BRC=t bash -l
+ command ssh "${args[@]}" "$remote" BRC=t bash
fi
fi
}
[[ $1 ]] || { echo need arg; return 1; }
journalctl --unit=$vpn_service@$1 -f -n0 &
- s systemctl start $vpn_service@$1
+ sudo systemctl start $vpn_service@$1
# sometimes the ask-password agent does not work and needs a delay.
sleep .5
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=779240
# noticed around 8-2017 after update from around stretch release
# on debian testing, even though the bug is much older.
- s systemd-tty-ask-password-agent
+ sudo systemd-tty-ask-password-agent
}
vpnoff() {
else
local vpn_service=openvpn
fi
- s systemctl stop $vpn_service@$1
+ sudo systemctl stop $vpn_service@$1
}
vpnoffc() { # vpn off client
ser stop openvpn-nn@client