X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=distro-begin;h=72d4d44f613e6ca7ef521dac93344526fc6a753f;hb=7f759d320592e791a62cd0a966350e8c53ee0976;hp=783c6cebab6c90c46a95fab76bb611a416a92636;hpb=f9ec6d39566c13775abd5d1709a44e5bd1c32997;p=distro-setup diff --git a/distro-begin b/distro-begin index 783c6ce..72d4d44 100755 --- a/distro-begin +++ b/distro-begin @@ -1,4 +1,4 @@ -#!/bin/bash -l +#!/bin/bash # Copyright (C) 2016 Ian Kelling # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,13 +22,31 @@ # set the scrollback to unlimited in case something goes wrong +# send to registrar, glue records: +# for iankelling.org: + +# ns1.iankelling.org 72.14.176.105 +# ns1.iankelling.org 2600:3c00::f03c:91ff:fe6d:baf8 +# ns2.iankelling.org 172.105.84.95 +# ns2.iankelling.org 2a01:7e01::f03c:91ff:feb5:baec + +# for zroe.org: + +# ns1.zroe.org 72.14.176.105 +# ns1.zroe.org 2600:3c00::f03c:91ff:fe6d:baf8 +# ns2.zroe.org 172.105.84.95 +# ns2.zroe.org 2a01:7e01::f03c:91ff:feb5:baec +# + + + ####### begin setup environment ####### ### make ssh interactive shell run better. for when running line interactively line by line -sudo bash -c 'source /a/c/.bashrc && source /a/exe/ssh-emacs-setup' - +sudo bash -c '/a/exe/ssh-emacs-setup' +if [[ -s ~/.bashrc ]];then . ~/.bashrc;fi ##### setup error handling interactive=true # set this to false to force set -x [[ $- == *i* ]] || interactive=false @@ -37,14 +55,13 @@ if ! $interactive; then fi source /a/bin/errhandle/err -_errcatch_cleanup() { +err-cleanup() { echo 1 >~/.local/distro-begin } source /a/bin/distro-functions/src/package-manager-abstractions ### setup logging -exec &> >(sudo tee -a /var/log/distro-begin) echo "$0: $(date): starting now)" @@ -218,7 +235,7 @@ done ###### do conflink # linode needs bind group before conflink -if $linode; then +if linode; then pi-nostart bind9 fi # this needs to be before installing pacserve so we have gpg conf. @@ -228,6 +245,7 @@ conflink set +x err-allow source /etc/profile.d/environment.sh +export BRC=t # shellcheck source=./.bashrc source ~/.bashrc err-catch @@ -307,9 +325,9 @@ pi ${p1[@]} ######## fix evbug bug ###### -case $distro in - trisquel|ubuntu) - # noticed in flidas. +case $(debian-codename-compat) in + xenial) + # noticed in flidas. dunno if it affects any others #https://bugs.launchpad.net/ubuntu/+source/module-init-tools/+bug/240553 #https://wiki.debian.org/KernelModuleBlacklisting #common advice when searching is to use /etc/modprobe.d/blacklist.conf, @@ -317,7 +335,7 @@ case $distro in sudo rmmod evbug ||: # might not be loaded yet file=/etc/modprobe.d/evbug.conf line="blacklist evbug" - if ! grep -xFq "$line" $file; then + if [[ $(cat $file) != $line ]]; then sudo dd of=$file 2>/dev/null <<<"$line" sudo depmod -a sudo update-initramfs -u @@ -328,15 +346,15 @@ esac ###### link files # convenient to just do all file linking in one place -s /a/exe/lnf -T /a/bin /b -s /a/exe/lnf -T /nocow/t /t +sudo /a/exe/lnf -T /a/bin /b +sudo /a/exe/lnf -T /nocow/t /t if has_p; then lnf -T /p/News ~/News fi -s /a/exe/lnf /q/root/.editor-backups /q/root/.undo-tree-history \ - /a/opt /a/c/.emacs.d $HOME/mw_vars /k/backup /root +sudo /a/exe/lnf /q/root/.editor-backups /q/root/.undo-tree-history \ + /a/opt /a/c/.emacs.d $HOME/mw_vars /k/backup /root /a/bin/ds/install-my-scripts # needed for rootsshsync cronjob -s /a/exe/lnf /a/c/.vim /a/c/.vimrc /a/c/.gvimrc /root +sudo /a/exe/lnf /a/c/.vim /a/c/.vimrc /a/c/.gvimrc /root @@ -347,7 +365,7 @@ case $(distro-name) in arch) # pkgfile is like apt-cache pi pkgfile - s pkgfile --update + sudo pkgfile --update ;; esac @@ -365,8 +383,8 @@ fi ##### make extra dirs dirs=(/mnt/{1,2,3,4,5,6,7,8,9} /nocow/t) -s mkdir -p "${dirs[@]}" -s chown $USER:$USER "${dirs[@]}" +sudo mkdir -p "${dirs[@]}" +sudo chown $USER:$USER "${dirs[@]}" ###### setup /i if home_network; then @@ -375,8 +393,8 @@ if home_network; then /i/k /k none bind,noauto 0 0 EOF if ! mountpoint /kr; then - s mkdir -p /kr - s chown $USER:user2 /kr + sudo mkdir -p /kr + sudo chown $USER:user2 /kr fi if [[ $HOSTNAME == frodo ]]; then tu /etc/fstab <<'EOF' @@ -387,14 +405,14 @@ EOF frodo:/k /kr nfs noauto 0 0 EOF fi - s mkdir -p /q /i/{w,k} + sudo mkdir -p /q /i/{w,k} for dir in /{i,w,k}; do if mountpoint $dir; then continue; fi # already mounted - s mkdir -p $dir - s chown $USER:$USER $dir + sudo mkdir -p $dir + sudo chown $USER:$USER $dir done # not needed for all hosts, but rather just keep it uniform - s mkdir -p /mnt/iroot + sudo mkdir -p /mnt/iroot # debian auto mounting of multi-disk encrypted btrfs is busted. It is # in jessie, and in stretch as of 11/26/2016 I have 4 disks in cryptab, # based on 3 of those, it creates .device units for /dev/mapper/dev... @@ -402,7 +420,7 @@ EOF # have already been created and exist. todo: create a simple repro # for this in a vm and report it upstream. pi nfs-common - s dd of=/root/imount <<'EOF' + sudo dd of=/root/imount <<'EOF' #!/bin/bash [[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@" set -eE -o pipefail @@ -418,8 +436,8 @@ for dir in /i /mnt/iroot /k /kr /w; do fi done EOF - s chmod +x /root/imount - s dd of=/etc/systemd/system/imount.service < *{/,/}/s/KP_Multiply/underscore/g' /usr/share/X11/xkb/symbols/keypad + sudo sed -i.orig '/key * *{/,/}/s/KP_Multiply/underscore/g' /usr/share/X11/xkb/symbols/keypad fi ##### basic graphical packages @@ -592,4 +595,5 @@ fi echo 0 >~/.local/distro-begin echo "$0: $(date): ending now" +echo "exiting with status 0" exit 0