minor fixes
[distro-setup] / brc2
diff --git a/brc2 b/brc2
index df695d2157336734a926e88f940bc0e730b2b1a4..a3ab32a872c189c09056f02703bf9f22b5d65642 100644 (file)
--- a/brc2
+++ b/brc2
@@ -100,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
@@ -121,7 +121,7 @@ bbk() { # btrbk wrapper
   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
@@ -138,14 +138,14 @@ bpull() {
   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
@@ -283,7 +283,7 @@ dup() {
       ran_d=true
       ;;&
     *DISTRO-END!*|*DISTRO!*)
-      pushd
+      pushd /
       /b/ds/distro-end || return $?
       popd
       ran_d=true
@@ -659,21 +659,21 @@ net-dev-info() {
   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() {
@@ -746,8 +746,8 @@ pumpa() {
 #rbp() { rbt post -o "$@"; }
 
 rebr() {
-  s ifdown br0
-  s ifup br0
+  sudo ifdown br0
+  sudo ifup br0
 }
 
 resolvcat() {
@@ -860,7 +860,7 @@ spd() {
 }
 
 spend() {
-  s systemctl suspend
+  sudo systemctl suspend
 }
 
 # ssh, copy my universal config over if needed.
@@ -945,7 +945,6 @@ sl() {
       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
@@ -954,13 +953,12 @@ sl() {
     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"
@@ -968,9 +966,6 @@ sl() {
     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,
@@ -1132,13 +1127,13 @@ vpn() {
 
   [[ $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() {
@@ -1148,7 +1143,7 @@ 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