various bug fixes
authorIan Kelling <iank@fsf.org>
Thu, 4 Apr 2019 16:28:31 +0000 (12:28 -0400)
committerIan Kelling <iank@fsf.org>
Thu, 4 Apr 2019 16:28:31 +0000 (12:28 -0400)
.bashrc
.profile
brc
btrbk-run [changed mode: 0755->0644]
check-subvol-stale
distro-begin
distro-end
install-my-scripts
mount-latest-subvol
subdir_files/.gnupg/gpg.conf

diff --git a/.bashrc b/.bashrc
index d0c4b02f6bff6fbbbdc4c647a5ecbbea8812416a..097dd9859413d0f9c5640e12908726d579bfdd29 100644 (file)
--- a/.bashrc
+++ b/.bashrc
@@ -51,7 +51,7 @@ if [[ $SSH_CONNECTION ]] \
        && [[ ! $SSH_TTY ]] \
        && [[ $- != *i* ]] \
        && [[ ! $BASH_LOGIN_SHELL == true ]]; then
-    return
+    return 0
 else
     if [[ -r /etc/profile ]]; then
         source /etc/profile
@@ -62,3 +62,5 @@ else
         source $_x
     fi
 fi
+# ensure no bad programs appending to this file will have an affect
+return 0
index 6596cb5e4381a761102e3daf35905c7a5990567b..96ca11732754837f471156d638c3c60da16c29d9 100644 (file)
--- a/.profile
+++ b/.profile
@@ -1,2 +1,7 @@
 # see .bashrc_profile for commentary
 echo this is ~/.profile, either my .bashrc_profile is unavailable or this is posix mode or not bash
+
+# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
+export PATH="$PATH:$HOME/.rvm/bin"
+
+[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
diff --git a/brc b/brc
index 08f4e79524f37490c58fb6eb0e2cba933695b18f..9851fe46350e8538cc37421da45e2d896232d756 100644 (file)
--- a/brc
+++ b/brc
@@ -2205,27 +2205,7 @@ fi
 #  eval "$(pyenv virtualenv-init -)"
 #fi
 
-# id prefer to have system-wide, plus user ruby, due to bug in it
-# https://github.com/rubygems/rubygems/pull/1002
-# further problems: installing multi-user ruby and user ruby,
-# you dont get multi-user ruby when you sudo to root, unless its sudo -i.
-# There a third hybrid form, which passenger error suggested I use,
-# but it didnt actually work.
-
-# in cased I never need this
-# rvm for non-interactive shell: modified from https://rvm.io/rvm/basics
-#if [[ $(type -t rvm) == file && ! $(type -t ruby) ]]; then
-#    source $(rvm 1.9.3 do rvm env --path)
-#fi
-
-# based on warning from rvmsudo
-export rvmsudo_secure_path=1
 
-if [[ -s "/usr/local/rvm/scripts/rvm" ]]; then
-  source "/usr/local/rvm/scripts/rvm"
-elif [[ -s $HOME/.rvm/scripts/rvm ]]; then
-  source $HOME/.rvm/scripts/rvm
-fi
 
 export GOPATH=$HOME/go
 path_add $GOPATH/bin
@@ -2234,6 +2214,10 @@ export ARDUINO_PATH=/a/opt/Arduino/build/linux/work
 
 path_add --end ~/.npm-global
 
+# taken from default changes to bashrc and bash_profile
+path_add --end $HOME/.rvm/bin
+[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
+
 export BASEFILE_DIR=/a/bin/fai-basefiles
 
 # didnt get drush working, if I did, this seems like the
old mode 100755 (executable)
new mode 100644 (file)
index 6024229..b753b5d
--- a/btrbk-run
+++ b/btrbk-run
@@ -24,7 +24,11 @@ trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
 usage() {
   cat <<'EOF'
 btrbk-run [OPTIONS]
-usually -t TARGET_HOST
+usually -t TARGET_HOST or -s SOURCE_HOST
+
+Note, at source location, intentionally not executable, run and read
+install-my-scripts.
+
 EOF
   echo "top of script file:"
   sed -n '1,/^[# ]*end command line/{p;b};q' "$0"
index 99594213a6fa4405ae8f74df837bbae7324b4f84..6a63124cd3ac749028a794117e0da2df384dbcfd 100644 (file)
@@ -25,7 +25,7 @@ usage() {
   cat <<EOF
 usage: $0 SUBVOL_MOUNTPOINT...
 
-In git, this is not not executable because it's meant to be installed
+In git this is not not executable because it's meant to be installed
 using ./install-my-scripts
 
 If latest subvols \$@ are not mounted, exit 1, print message, and print
index 35c904a929d05693c03e73ef213fd6740843efa1..182a9d92ee2af270a22dfee2e30017c80720def2 100755 (executable)
@@ -33,15 +33,8 @@ interactive=true  # set this to false to force set -x
 [[ $- == *i* ]] || interactive=false
 if ! $interactive; then
     set -x
-    set -e -o pipefail
 fi
-set -E
-trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR
-for x in /a/bin/errhandle/*-function; do
-    source $x
-done
-set +e
-$interactive || errcatch
+source /a/bin/errhandle/err
 
 ### setup logging
 exec &> >(sudo tee -a /var/log/distro-begin)
@@ -77,7 +70,7 @@ source $script_dir/pkgs
 set +x
 source /a/bin/distro-functions/src/identify-distros
 $interactive || set -x
-for f in iank-dev htpc kd x2 frodo tp li lj demohost kw fz; do
+for f in iank-dev htpc kd x2 x3 frodo tp li lj demohost kw fz; do
     eval "$f() { [[ $HOSTNAME == $f ]]; }"
 done
 has_p() { ! linode; } # when tp is tracis, then not tp either
@@ -207,10 +200,10 @@ conflink
 
 ###### bash environment setup
 set +x
-errallow
+err-allow
 source /etc/profile.d/environment.sh
 source ~/.bashrc
-$interactive || errcatch
+err-catch
 $interactive || set -x
 
 
@@ -319,6 +312,7 @@ if has_p; then
 fi
 s lnf /q/root/.editor-backups /q/root/.undo-tree-history \
   /a/opt /a/c/.emacs.d $HOME/mw_vars /k/backup /root
+pi rsync # needed for rootsshsync
 rootsshsync
 s lnf /a/c/.vim /a/c/.vimrc /a/c/.gvimrc /root
 if has_p; then
@@ -566,7 +560,7 @@ if has_x; then
 fi
 
 ##### install laptop hardware packages
-if tp || x2; then
+if tp || x2 || x3; then
     case $distro in
         debian)
             pi task-laptop
index 43ca158ae4142b77d4b1e2c4f16aa0d6d0a4ae42..d72adea591e501549cfd1669e4fd6c210dd31fd0 100755 (executable)
@@ -617,7 +617,7 @@ esac
 # s cp -r --parents /etc/openvpn/easy-rsa/keys /p/c/filesystem
 # s chown -R 1000:1000 /p/c/filesystem/etc/openvpn/easy-rsa/keys
 # # kw = kgpe work machine.
-# for host in x2 kw; do
+# for host in x2 x3 kw; do
 # vpn-mk-client-cert -b $host -n home b8.nz 1196
 # dir=/p/c/machine_specific/$host/filesystem/etc/openvpn/client
 # mkdir -p $dir
@@ -911,25 +911,21 @@ Pin-Priority: -100
 Package: *
 Pin: release a=xenial-updates
 Pin-Priority: -100
+
+Package: *
+Pin: release a=xenial-security
+Pin-Priority: -100
 EOF
     s dd of=/etc/apt/sources.list.d/xenial.list 2>/dev/null <<EOF
 deb http://us.archive.ubuntu.com/ubuntu/ xenial main
 deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main
+deb http://us.archive.ubuntu.com/ubuntu/ xenial-security main
 EOF
     curl http://archive.ubuntu.com/ubuntu/project/ubuntu-archive-keyring.gpg | s apt-key add -
     p update
 
     t=$(mktemp -d)
     cd $t
-    s dd of=/etc/apt/preferences.d/flidas-xenial <<EOF
-Package: debootstrap
-Pin: release a=xenial
-Pin-Priority: 1001
-
-Package: debootstrap
-Pin: release a=xenial-updates
-Pin-Priority: 1001
-EOF
     aptitude download debootstrap
     ex *
     ex data.tar.gz
@@ -1386,7 +1382,7 @@ fi
 # EOF
 #         s systemctl daemon-reload
 #         case $HOSTNAME in
-#             x2|tp)
+#             x2|x3|tp)
 #                 ser enable synergyc@iank
 #                 ser start synergyc@iank ||: # X might not be running yet
 #                 ;;
index e2356ca3e70c13436d65cc0f26b3447628f079c9..2f9e22410c808b9357836749246bc11a9ff9eb1c 100755 (executable)
@@ -31,4 +31,4 @@ x="$(readlink -f "$BASH_SOURCE")"; cd ${x%/*}
 e() { echo "$*"; "$@"; }
 
 # scripts that would interfere with unmounting /a, put them elsewhere
-e install mount-latest-subvol check-subvol-stale /usr/local/bin
+e install btrbk-run mount-latest-subvol check-subvol-stale /usr/local/bin
index d36685f3b41e6bf717b5a31ba8f152cfe1d79bde..96210c4424907040ae4f284bf88ae330158d977d 100644 (file)
@@ -14,6 +14,9 @@
 # limitations under the License.
 
 # usage: mount-latest-subvol
+#
+# Note, at source location, intentionally not executable, run and read
+# install-my-scripts.
 
 cd /
 [[ $EUID == 0 ]] || exec sudo -E "$BASH_SOURCE" "$@"
@@ -86,7 +89,7 @@ pid-check() {
   for p in ${pids}; do
     for m in ${my_pids[@]}; do
       if (( p == m )); then
-        echo "$0: error: pids to kill includes our pid or a parent" >&2
+        echo "$0: error: pids to kill includes our pid or a parent. ps output:" >&2
         ps -f -p $p
         exit 1
       fi
index 9641d86ee4e059fe3ae009b561238991d0c5b15e..d5b5c41ea90e30985b977057ddf9f86e6da353d8 100644 (file)
@@ -34,11 +34,12 @@ default-key B125F60B7B287FF6A2B7DF8F170AF0E2954295DF
 # install -o iank -g iank -d -m700 /home/iank/gpg-agent-socket
 # because something keeps deleting that directory
 
-# default keyserver
+# default keyserver. i switch around randomly to find one that is up.
 #
 #keyserver hkp://pgp.mit.edu
-# this one seems more reliable, but it's down now
-keyserver hkp://pool.sks-keyservers.net
+#keyserver hkp://pool.sks-keyservers.net
+#keyserver hkp://keyserver.pgp.com
+keyserver hkp://ipv4.pool.sks-keyservers.net
 
 # more secure, but had problems with my gpg version
 #keyserver hkps://hkps.pool.sks-keyservers.net