various bug fixes
[distro-setup] / distro-begin
index e77ff04a5827f1d7200b35718cb2205276613ad0..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)
@@ -61,8 +54,6 @@ fi
 
 ### arg parsing
 recompile=false
-# for copying to a new data fs
-bootstrapfs=false # old flag, needs new look before using.
 while [[ $1 == -* ]]; do
     case $1 in
         -r) recompile=true; shift ;;
@@ -74,12 +65,12 @@ fi
 
 
 ##### variables/env setup
-script_dir="$(readlink -f "$BASH_SOURCE")"
+script_dir="$(readlink -f "$BASH_SOURCE")"; script_dir=${script_dir%/*}
 source $script_dir/pkgs
 set +x
 source /a/bin/distro-functions/src/identify-distros
 $interactive || set -x
-for f in iank-dev htpc treetowl 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
@@ -209,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
 
 
@@ -223,6 +214,11 @@ Defaults  env_keep += SUDOD
 # makes ubuntu be like debian
 # https://unix.stackexchange.com/a/91572
 Defaults always_set_home
+# default setting is to have  minimum umask of 0022
+# This lets us have user-specific umasks which are more permissive.
+# I did this for transmission and set it's umask gecos on install,
+# see there for more info.
+Defaults !umask
 EOF
 
 
@@ -316,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
@@ -469,7 +466,7 @@ EOF
 fi
 
 ##### setup /nocow.
-# a nocow dir that is common to multiple distros installed onthe same system
+# a nocow dir that is common to multiple distros installed on the same system
 dir=/nocow
 if has_btrfs; then
     if ! mountpoint $dir; then
@@ -563,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