From: Ian Kelling Date: Sun, 28 Jan 2018 17:58:52 +0000 (-0500) Subject: mostly reorganizing and cleanup X-Git-Url: https://iankelling.org/git/?p=distro-setup;a=commitdiff_plain;h=b5152768e90016afe8ff2d55cc9f38d08396b0fc mostly reorganizing and cleanup --- diff --git a/.inputrc b/.inputrc index 76d3577..51d74a7 100644 --- a/.inputrc +++ b/.inputrc @@ -46,10 +46,13 @@ set mark-symlinked-directories on # C-x would be hard to rebind because emacs. "\C-q": exchange-point-and-mark +# default not bound "\C-w": kill-region -"\C-e": yank-last-arg +# default M-S-3 "\C-a": insert-comment -"\C-s": yank-nth-arg + +# default is C-M-y +"\e,": yank-nth-arg "\C-f": menu-complete "\C-b": menu-complete-backward diff --git a/brc b/brc index 53f8c5b..fbc1acb 100644 --- a/brc +++ b/brc @@ -558,7 +558,7 @@ fa() { } faf() { # find all files - find -L $1 -type f -not \( -name .svn -prune -o -name .git -prune \ + find -L $1 -not \( -name .svn -prune -o -name .git -prune \ -o -name .hg -prune -o -name .editor-backups -prune \ -o -name .undo-tree-history -prune \) 2>/dev/null } diff --git a/desktop-20-autostart.sh b/desktop-20-autostart.sh index 3d5b719..df8dab8 100755 --- a/desktop-20-autostart.sh +++ b/desktop-20-autostart.sh @@ -45,9 +45,16 @@ elif (( x == 2 )); then --output $middle --mode 2560x1600 --pos 1600x0 --rotate left fi -/a/bin/distro-setup/input-setup +/a/bin/distro-setup/input-setup m if isarch; then pulseaudio --start fi + +/a/exe/lnf -T /p/arbtt-capture.log ~/.arbtt/capture.log +# docs say a sample rate less than 20 is probably not worth the data cost, +# but it seems pretty small to me +arbtt-capture --sample-rate=10 & + + #indicator-kdeconnect date "+%A, %B %d, %r, %S seconds" > /tmp/desktop-20-autostart-log diff --git a/desktop-apps b/desktop-apps index a0ed3c7..bcbda09 100755 --- a/desktop-apps +++ b/desktop-apps @@ -2,6 +2,7 @@ if ! pgrep -u $EUID emacs; then emacs --daemon & + emacs -f znc-all & fi pidgin & linphone & diff --git a/distro-begin b/distro-begin index 9a7a9ad..08ea004 100755 --- a/distro-begin +++ b/distro-begin @@ -13,45 +13,53 @@ # See the License for the specific language governing permissions and # limitations under the License. - - - -# for bootstrapping a new machine - -# in case we need it, -# to make ssh interactive shell run better, we run this first. -sudo bash -c 'source /a/c/.bashrc && source /a/exe/ssh-emacs-setup' - - +# for setting up a new machine # usage: $0 [-r] HOSTNAME # tips: # run any sudo command first so your pass is cached # set the scrollback to unlimited in case something goes wrong -if [[ $EUID == 0 ]]; then - if getent passwd iank || getent passwd ian ; then - echo "$0: error: running as root. unprivileged user exists. use it." - exit 1 - else - echo "$0: warning: running as root. I will setup users then exit" - fi -fi +####### 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' + + +##### setup error handling 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 +### setup logging exec &> >(sudo tee -a /var/log/distro-begin) echo "$0: $(date): starting now)" -# headless=false # unused atm + +### sanity checking +if [[ $EUID == 0 ]]; then + if getent passwd iank || getent passwd ian ; then + echo "$0: error: running as root. unprivileged user exists. use it." + exit 1 + else + echo "$0: warning: running as root. I will setup users then exit" + fi +fi + + +### arg parsing recompile=false # for copying to a new data fs bootstrapfs=false # old flag, needs new look before using. @@ -60,11 +68,17 @@ while [[ $1 == -* ]]; do -r) recompile=true; shift ;; esac done - if [[ $1 ]]; then export HOSTNAME=$1 fi + +##### variables/env setup +script_dir="$(readlink -f "$BASH_SOURCE")" +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 eval "$f() { [[ $HOSTNAME == $f ]]; }" done @@ -74,16 +88,16 @@ linode() { lj || li; } has_btrfs() { ! linode; } home_network() { ! linode; } encrypted() { has_p; } - shopt -s extglob export GLOBIGNORE=*/.:*/.. -umask 0002 +umask 022 +PATH="/a/exe:$PATH" +sed="sed --follow-symlinks" + +####### end setup environment ####### -####### end command line parsing -PATH="/a/exe:$PATH" -sed="sed --follow-symlinks" ##### begin setup encryption scripts ###### if encrypted; then @@ -133,27 +147,16 @@ fi ##### end setup encryption scripts ###### -install-myqueue +# disabled until its fixed up +# install-myqueue -# this script has been designed to be idempotent # todo, it would be nice to cut down on some of the output - -for x in /a/bin/errhandle/*-function; do - source $x -done - - -set +e -$interactive || errcatch -set +x -source /a/bin/distro-functions/src/identify-distros -$interactive || set -x - +##### fedora prereq/fundamental settings if isfedora; then # comment out line disallowing calling sudo in scripts sudo $sed -i 's/^Defaults *requiretty/#\0 # ian commented/' /etc/sudoers - # turn on magic sysrq commands for this boot cycle + # turn on magic sysrq commands echo 1 > sudo dd of=/proc/sys/kernel/sysrq echo "kernel.sysrq = 1" > /etc/sysctl.d/90-sysrq.conf # selinux is not user friendly. Like, you enable samba, but you haven't run the magic selinux commands so it doesn't work @@ -163,6 +166,7 @@ if isfedora; then fi +#### rerun my fai-time scripts # already ran for pxe installs, but used for vps & updates distro=$(distro-name) case $distro in @@ -175,25 +179,27 @@ case $distro in ;; esac +###### setup hostname sudo $sed -i '/^127\.0\.1\.1/d' /etc/hosts echo "127.0.1.1 $HOSTNAME.b8.nz $HOSTNAME" | sudo tee -a /etc/hosts +##### exit first stage if running as root if [[ $EUID == 0 ]]; then echo "$0: running as root. exiting now that users are setup" exit 0 fi -#### begin link bashrc for root ###### +#### setup bash for root for x in /a/c/{.bashrc,brc,.bash_profile,.profile,.inputrc,path_add_function}; do sudo -i </dev/null || sudo groupadd -r bind @@ -201,6 +207,7 @@ fi # this needs to be before installing pacserve so we have gpg conf. conflink +###### bash environment setup set +x errallow source /etc/profile.d/environment.sh @@ -209,7 +216,7 @@ $interactive || errcatch $interactive || set -x -# passwordless sudo +#### setup passwordless sudo tu /etc/sudoers </dev/null <<'EOF' [Unit] Description=ZNC, an advanced IRC bouncer diff --git a/filesystem/etc/X11/Xsession.d/98iank b/filesystem/etc/X11/Xsession.d/98iank index fa21023..23adf30 100644 --- a/filesystem/etc/X11/Xsession.d/98iank +++ b/filesystem/etc/X11/Xsession.d/98iank @@ -1,10 +1,6 @@ +#!/bin/bash + # no screensaver for htpc machine if [[ $HOSTNAME != frodo ]]; then /usr/share/xscreensaver/xscreensaver-wrapper.sh & fi - -/a/exe/lnf -T /p/arbtt-capture.log ~/.arbtt/capture.log - -# docs say a sample rate less than 20 is probably not worth the data cost, -# but it seems pretty small to me -arbtt-capture --sample-rate=10 & diff --git a/filesystem/etc/profile.d/environment.sh b/filesystem/etc/profile.d/environment.sh index 95dce05..4c5794f 100644 --- a/filesystem/etc/profile.d/environment.sh +++ b/filesystem/etc/profile.d/environment.sh @@ -55,16 +55,20 @@ if [ -f /etc/fedora-release ]; then fi fi +# background: # ubuntu has 002 for non-system users, debian has 022. 002 makes groups -# be rw instead of r. One security concern is where some unixes put -# every user in a same group, so if you copy files there with exact -# perms, that is probably not what you want. I don't use a system like -# that. I don't care much either way, but the ubuntu one seems a bit -# more user friendly, and copying files between them is a annoying with -# different umasks. However, it also makes it so if you create a file as -# a regular user then move it to become a system file, it's got slightly -# wrong permissions, and sometimes thing break. So, this outweighs the -# other things, stick with 022 umask always. +# be rw instead of r. +# +# ubuntu is more user friendly when using multiple users. However, +# it also makes it so if you create a file as a regular user then move +# it to become a system file, it's got slightly wrong permissions, and +# sometimes thing break. Also, copying files between ubuntu and debian +# makes things inconsistent. So stick with 022 umask always. +# +# One security concern is where some unixes put every user in a same +# group, so if you copy files there with exact perms, that is probably +# not what you want. I don't use a system like that, so I don't +# care. umask 022 # this is how we could test for non-system user diff --git a/mail-setup b/mail-setup index 930ddcc..c7f2933 100755 --- a/mail-setup +++ b/mail-setup @@ -117,6 +117,7 @@ u=$SUDO_USER # echo "dmarc dns, name: _dmarc value: v=DMARC1; p=none; rua=mailto:mailauth-reports@$domain" # # 2017-02 spf policies: +# # host -t txt lists.fedoraproject.org # # google ~all, hotmail -all, yahoo: ?all, fastmail ?all # # i include fastmail\'s settings, per their instructions, # # and follow their policy. In mail in a box, or similar instructions, diff --git a/pkgs b/pkgs new file mode 100644 index 0000000..524849e --- /dev/null +++ b/pkgs @@ -0,0 +1,138 @@ +#!/bin/bash +# meant to be sourced + +p1=( + trash-cli + cryptsetup + lvm2 +) +p2=( + # 2nd + ghc + sakura + xmonad + cabal-install +) +p3=( + htop + iptables + mailutils + nmon + rdiff-backup + ruby + ruby-rest-client + tree + vim + wcd + wget +) + +# swh-plugins is for karaoke pulsaudio filter. +# mutagen for pithos +# guvcview set webcam brightness to highest +# pidgin-otr, i went into pidgin pluggin settings and generated a key for some accounts +# xawtv has webcam cli control. v4lctl bright 80%; v4lctl list +# guvcview also adjusts webcam +p4=( + adb + apache2 + apache2-doc + apt-doc + apt-listchanges + aptitude-doc-en + bash-doc + beets + beets-doc + binutils-doc + bind9-doc + bind9utils + bwm-ng + cloc + cpulimit + cron + debootstrap + debconf-doc + dirmngr + dnsutils + dnsmasq + dtrx + duplicity + eclipse + evince + fdupes + feh + filelight + flashrom + gawk-doc + gcc-doc + gdb + gdb-doc + geoip-bin + git-doc + git-email + gitk + glibc-doc + goaccess + gnome-screenshot + guvcview + i3lock + inetutils-traceroute + iperf3 + iproute2-doc + jq + kid3-qt + kid3-cli + konsole + libreoffice + linphone + linux-doc + locate + lshw + make-doc + manpages + manpages-dev + mb2md + meld + mps-youtube + mpv + mumble + nagstamon + ncdu + nginx-doc + nmap + offlineimap + oathtool + opendkim-tools + p7zip + paprefs + parted-doc + pavucontrol + pdfgrep + perl-doc + pianobar + pidgin + pidgin-otr + pry + python-autopep8 + python3-doc + qrencode + reportbug + schroot + sqlite3-doc + squashfs-tools + swh-plugins + tar-doc + tcpdump + telnet + transmission-remote-gtk + vlc + whois + wondershaper + xawtv + xbacklight + xprintidle + xscreensaver + xscreensaver-data-extra + xscreensaver-gl + xscreensaver-gl-extra +) diff --git a/switch-mail-host b/switch-mail-host index 9315807..9b4872d 100755 --- a/switch-mail-host +++ b/switch-mail-host @@ -218,6 +218,6 @@ if $restore_old_btrbk; then $old_shell sudo systemctl start btrbk.timer fi -$new_shell arbtt-capture --sample-rate=10 & +$new_shell DISPLAY=:0 arbtt-capture --sample-rate=10 & echo $warn