# can update the hardstatus (xterm title) with a command like this:
# hardstatus string "SCREEN @ %H: %-n - %t"
+
+# the default scrollback is way too small
+defscrollback 1000000
\ No newline at end of file
unalias -a
# remove gnome keyring warning messages
-# there is probably a more proper way, but I didn't find any easily on google
+# there is probably a more proper way, but I didnt find any easily on google
# now using xfce+xmonad instead of vanilla xmonad, so disabling this
#unset GNOME_KEYRING_CONTROL
shopt -s extglob
# include .files when globbing, but ignore files name . and ..
# setting this also sets dotglob.
-# Note, this doesn't work in bash 4.4 anymore, for paths with
+# Note, this doesnt work in bash 4.4 anymore, for paths with
# more than 1 directory, like a/b/.foo, since * is fixed to not match /
export GLOBIGNORE=*/.:*/..
-# broken with bash_completion package. Saw a bug for this once. Don't anymore.
+# broken with bash_completion package. Saw a bug for this once. dont anymore.
# still broken in wheezy
# still buggered in latest stable from the web, version 2.1
# perhaps its fixed in newer git version, which fails to make for me
# advanced completion
# http://bash-completion.alioth.debian.org/
-# might be sourced by the system already, but I've noticed it not being sourced before
+# might be sourced by the system already, but ive noticed it not being sourced before
if ! type _init_completion &> /dev/null && [[ -r "/usr/share/bash-completion/bash_completion" ]]; then
. /usr/share/bash-completion/bash_completion
fi
# inside emcas fixes
if [[ $RLC_INSIDE_EMACS ]]; then
- # EMACS is used by bash on startup, but we don't need it anymore.
+ # EMACS is used by bash on startup, but we dont need it anymore.
# plus I hit a bug in a makefile which inherited it
unset EMACS
export RLC_INSIDE_EMACS
export PAGER=cat
export MANPAGER=cat
- # scp completion does not work, but this doesn't fix it. todo, figure this out
+ # scp completion does not work, but this doesnt fix it. todo, figure this out
complete -r scp &> /dev/null
# todo, remote file completion fails, figure out how to turn it off
export NODE_DISABLE_COLORS=1
- # This get's rid of ugly terminal escape chars in node repl
- # sometime, I'd like to have completion working in emacs shell for node
+ # This gets rid of ugly terminal escape chars in node repl
+ # sometime, Id like to have completion working in emacs shell for node
# the offending chars can be found in lib/readline.js,
# things that do like:
# stream.write('\x1b[' + (x + 1) + 'G');
# no prompt, or else readline complete seems to be confused, based
# on our column being different? node probably needs to send
# different kind of escape sequence that is not ugly. Anyways,
- # completion doesn't work yet even with the ugly prompt, so whatever
+ # completion doesnt work yet even with the ugly prompt, so whatever
#
export NODE_NO_READLINE=1
bind '"\eOc": shell-forward-word'
bind '"\eOd": shell-backward-word'
fi
- # i can't remember why i did this, probably to free up some keys to bind
+ # i cant remember why i did this, probably to free up some keys to bind
# to other things in bash.
# other than C-c and C-z, the rest defined by stty -a are, at least in
# gnome-terminal, overridden by bash, or disabled by the system
# also, setting this makes the history file record time
# of each command as seconds from the epoch
HISTTIMEFORMAT="%I:%M %p %m/%d "
-# consecutive duplicate lines don't go in history
+# consecutive duplicate lines dont go in history
HISTCONTROL=ignoredups
# works in addition to HISTCONTROL to do more flexible things
# it could also do the same things as HISTCONTROL and thus replace it,
export BC_LINE_LENGTH=0
-# note, if I use a machine I don't want files readable by all users, set
+# note, if I use a machine I dont want files readable by all users, set
# umask 077 # If fewer than 4 digits are entered, leading zeros are assumed
C_DEFAULT_DIR=/a
+# i for insensitive. the rest from
+# https://superuser.com/questions/366930/how-do-i-get-the-git-pager-to-clean-up-screen-output-after-exit
+# and reading the man
+export LESS=RXi
# * include files
for _x in /a/bin/distro-functions/src/* /a/bin/!(githtml)/*-function?(s); do
for x in /a/bin/bash_unpublished/source-!(.#*); do source $x; done
source $(dirname $(readlink -f $BASH_SOURCE))/path_add-function
source /a/bin/log-quiet/logq-function
+if [[ -e /a/bin/errhandle/err ]]; then
+ source /a/bin/errhandle/err
+ err-allow
+fi
path_add /a/exe
+# pip3 --user things go here:
+path_add --end ~/.local/bin
+path_add --ifexists --end /a/work/libremanage
path_add --ifexists --end /a/opt/adt-bundle*/tools /a/opt/adt-bundle*/platform-tools
+path_add --ifexists --end /a/opt/scancode-toolkit-2.9.2
export WCDHOME=/a
# based on readme.debian. dunno if this will break on other distros.
_x=/usr/share/wcd/wcd-include.sh
# file cut copy and paste, like the text buffers :)
-# I havn't tested these.
+# I havnt tested these.
_fbufferinit() { # internal use by
! [[ $my_f_tempdir ]] && my_f_tempdir=$(mktemp -d)
rm -rf "$my_f_tempdir"/*
}
_khfix_common() {
- local h=${1##*@}
- local x
- ssh-keygen -R $h -f $(readlink -f ~/.ssh/known_hosts)
- x=$(timeout 1 ssh -oBatchMode=yes -oControlMaster=no -oControlPath=/ -v $1 |& sed -rn "s/debug1: Connecting to $h \[([^\]*)].*/\1/p")
- if [[ ! $x ]]; then
+ local host=${1##*@}
+ local ip port
+ read -r ip port < <(timeout 1 ssh -oBatchMode=yes -oControlMaster=no -oControlPath=/ -v $1 |& sed -rn "s/debug1: Connecting to $host \[([^\]*)] port ([0-9]+).*/\1 \2/p")
+ if [[ ! $ip ]]; then
echo "khfix: ssh failed"
return 1
fi
- echo "khfix: removing key for $x"
- ssh-keygen -R $x -f $(readlink -f ~/.ssh/known_hosts)
+ if [[ $port != 22 ]]; then
+ ip_entry="[$ip]:$port"
+ host_entry="[$host]:$port"
+ else
+ ip_entry=$ip
+ host_entry=$host
+ fi
+ ssh-keygen -R "$host_entry" -f $(readlink -f ~/.ssh/known_hosts)
+ echo "khfix: removing key for $ip_entry"
+ ssh-keygen -R "$ip_entry" -f $(readlink -f ~/.ssh/known_hosts)
}
khfix() { # known hosts fix
_khfix_common "$@" || return 1
}
a() {
- beet "${@}"
+ local x=$(readlink -nf "$@")
+ # yes, its kinda dumb that xclip/xsel cant do this in one invocation
+ echo -n "$x" | xclip -selection clipboard
+ echo -n "$x" | xclip
}
ack() { ack-grep "$@"; }
_cdiff-prep "$2" "$f2"
cat "$f1" "$f2" | grep -Po '^[^=]+=' | sort | uniq > "$unified"
while IFS= read -r line; do
- # the default bright red / blue doesn't work in emacs shell
+ # the default bright red / blue doesnt work in emacs shell
dwdiff -cblue,red -A best -d " ," <(grep "^$line" "$f1" || echo ) <(grep "^$line" "$f2" || echo ) | colordiff
done < "$unified"
}
da() { # do all
local host
"$@"
- for host in x2 tp treetowl; do
+ for host in x2 tp kd; do
ssh $host "$@"
done
}
debian_pick_mirror () {
# netselect-apt finds a fast mirror.
# but we need to replace the mirrors ourselves,
- # because it doesn't do that. best it can do is
+ # because it doesnt do that. best it can do is
# output a basic sources file
# here we get the server it found, get the main server we use
# then substitute all instances of one for the other in the sources file
# fdroidcl search -i, then manually removing
# automatically installed/preinstalled apps
-# firefox updater. commented out, firefox depends on nonfree opengl.
-# de.marmaro.krt.ffupdater
-# # causes replicant to die on install and go into a boot loop
-# me.ccrama.redditslide
#
# # my attempt at recovering from boot loop:
# # in that case, boot to recovery (volume up, home button, power, let go of power after samsun logo)
# org.quantumbadger.redreader
# org.kde.kdeconnect_tp
-# not broke, but won't work without gps
+# not broke, but wont work without gps
#com.zoffcc.applications.zanavi
# not broke, but not using atm
#com.nutomic.syncthingandroid
-#org.fedorahosted.freeotp
# # doesn\'t work on replicant
#net.sourceforge.opencamera
#
fdroid_pkgs=(
+ de.marmaro.krt.ffupdater
+ me.ccrama.redditslide
+ org.fedorahosted.freeotp
at.bitfire.davdroid
com.alaskalinuxuser.justnotes
com.artifex.mupdf.viewer.app
+ com.danielkim.soundrecorder
com.fsck.k9
com.ghostsq.commander
com.ichi2.anki
com.jmstudios.redmoon
com.jmstudios.chibe
+ org.kde.kdeconnect_tp
com.notecryptpro
com.termux
cz.martykan.forecastie
de.danoeh.antennapod
+ de.blinkt.openvpn
+ de.marmaro.krt.ffupdater
+ eu.siacs.conversations
+ free.rm.skytube.oss
im.vector.alpha # riot
info.papdt.blackblub
me.tripsit.tripmobile
net.gaast.giggity
+ net.minetest.minetest
net.osmand.plus
org.isoron.uhabits
+ org.linphone
+ org.gnu.icecat
org.smssecure.smssecure
org.yaaic
+ sh.ftp.rocketninelabs.meditationassistant.opensource
)
# https://forum.xda-developers.com/android/software-hacking/wip-selinux-capable-superuser-t3216394
# for maru,
}
gh() {
- # i got an error, gh not found when doing a pull request, it seems like it wants itself in it's path.
+ # i got an error, gh not found when doing a pull request, it seems like it wants itself in it\'s path.
local _oldpath="$PATH"
PATH="$PATH:~/node_modules/.bin"
command gh "$@"
grep -iIP --color=auto "$@"
}
-grr() {
+grr() { # grep recursive
if [[ ${#@} == 1 ]]; then
- grep --exclude-dir='*.emacs.d' --exclude-dir='*.git' -riIP --color=auto "$@" .
+ grep --exclude-dir='*.emacs.d' --exclude-dir='*.git' -RiIP --color=auto "$@" .
else
- grep --exclude-dir='*.emacs.d' --exclude-dir='*.git' -riIP --color=auto "$@"
+ grep --exclude-dir='*.emacs.d' --exclude-dir='*.git' -RiIP --color=auto "$@"
fi
}
history -a # save history
max_lines=$HISTFILELINES
[[ $max_lines =~ ^[0-9]+$ ]] || { echo "error in hl: failed to get max line count"; return 1; }
- linecount=$(wc -l < $HISTFILE) # pipe so it doesn't output a filename
+ linecount=$(wc -l < $HISTFILE) # pipe so it doesnt output a filename
[[ $linecount =~ ^[0-9]+$ ]] || { echo "error in hl: wc failed"; return 1; }
if (($linecount > $max_lines)); then
prune_lines=$(($linecount - $max_lines))
hrcat() { local f; for f; do [[ -f $f ]] || continue; hr; echo "$f"; cat "$f"; done }
-hub() { /nocow/t/hub-linux-amd64-2.3.0-pre10/bin/hub "$@"; }
+# get latest hub and run it
+# main command to use:
+# hub pull-request
+# on first use, you input username/pass and it gets an oath token so you dont have to repeat
+# it\'s at ~/.config/hub
+hub() {
+ local up uptar updir p
+ p=/github/hub/releases/
+ up=https://github.com/$(curl -s https://github.com$p| grep -o $p'download/[^/]*/hub-linux-amd64[^"]*' | head -n1)
+ uptar=${up##*/}
+ updir=${uptar%.tgz}
+ if [[ ! -e /a/opt/$updir ]]; then
+ rm -rf /a/opt/hub-linux-amd64*
+ wget -P /a/opt $up
+ tar -C /a/opt -zxf /a/opt/$uptar
+ rm -f /a/opt/$uptar
+ s /a/opt/$updir/install
+ fi
+
+ # save token across computers
+ if [[ ! -L ~/.config/hub ]]; then
+ if [[ -e ~/.config/hub ]]; then
+ mv ~/.config/hub /p/c/subdir_files/.config/
+ fi
+ if [[ -e /p/c/subdir_files/.config/hub ]]; then
+ conflink
+ fi
+ fi
+ command hub "$@"
+}
i() { git "$@"; }
# modified from ~/local/bin/git-completion.bash
if ! sudo cryptsetup luksOpen $l $base; then
sudo losetup -d $l
return 1
- fi
+ fi
sudo mkdir -p /mnt/$base
sudo mount /dev/mapper/$base /mnt/$base
sudo chown $USER:$USER /mnt/$base
c "$1"
}
+mkct() {
+ mkc `mktemp -d`
+}
+
mkt() { # mkdir and touch file
local path="$1"
mkdir -p "$(dirname "$path")"
}
pubip() { curl -4s https://icanhazip.com; }
+pubip6() { curl -6s https://icanhazip.com; }
whatismyip() { pubip; }
pumpa() {
# packages catches up on some changes in future (this is written in
# 4/2017)
#
- # geekosaur: so you'll want to upgrade to xmonad 0.13 or else use a
- # locally modified XMonad.Hooks.ManageDocks that doesn't set the
- # work area; turns out it's impossible to set correctly if you are
+ # geekosaur: so youll want to upgrade to xmonad 0.13 or else use a
+ # locally modified XMonad.Hooks.ManageDocks that doesnt set the
+ # work area; turns out it\'s impossible to set correctly if you are
# not a fully EWMH compliant desktop environment
#
# geekosaur: chrome shows one failure mode, qt/kde another, other
# gtk apps a third, ... I came up with a setting that works for me
- # locally but apparently doesn't work for others, so we joined the
+ # locally but apparently doesnt work for others, so we joined the
# other tiling window managers in giving up on setting it at all
#
xprop -root -remove _NET_WORKAREA
# -x = max length
# -t = print pronunciation
apg -m 14 -x 17 -t
+ for (( i=0; i<10; i++ )); do
+ shuf -n3 /usr/share/hunspell/en_US.dic | sed 's,/.*,,' | paste -sd . -
+
+ done
}
pwlong() {
rsync -ahvic --delete "$@"
}
rld() {
- # like rlu, but don't delete files on the target end which
+ # like rlu, but dont delete files on the target end which
# do not exist on the original end.
rsync -ahvic "$@"
}
if [[ $path == .* ]]; then
path=$(readlink -f $path)
fi
- # rync here uses checksum instead of time so we don't mess with
+ # rync here uses checksum instead of time so we dont mess with
# unison relying on time as much. g is for group, same reason
# to keep up with unison.
s rsync -rlpchviog --relative "${opts[@]}" "$path" "root@$host:/";
# initial setup of rss2email:
# r2e new r2e@iankelling.org
# that initializes files, and sets default email.
- # symlink to the config doesn't work, so I copied it to /p/c
+ # symlink to the config doesnt work, so I copied it to /p/c
# and then use cli option to specify explicit path.
# Only option changed from default config is to set
# force-from = True
# address, which makes me be a spammer.
r2e add $1 "$2" $1@r2e.iankelling.org
- # get up to date and don't send old entries now:
+ # get up to date and dont send old entries now:
r2e run --no-send $1
}
r2e() { command r2e -d /p/c/rss2email.json -c /p/c/rss2email.cfg "$@"; }
}
rmstrips() {
- ssh fencepost head -n 300 /gd/gnuorg/EventAndTravelInfo/rms-current-trips.txt
+ ssh fencepost head -n 300 /gd/gnuorg/EventAndTravelInfo/rms-current-trips.txt | less
}
s() {
# background
- # I use a function because otherwise we can't use in a script,
- # can't assign to variable.
+ # I use a function because otherwise we cant use in a script,
+ # cant assign to variable.
#
# note: gksudo is recommended for X apps because it does not set the
# home directory to the same, and thus apps writing to ~ fuck things up
fi
}
-safe_rename() { # warn and don't rename if file exists.
- # mv -n exists, but it's silent
+safe_rename() { # warn and dont rename if file exists.
+ # mv -n exists, but it\'s silent
if [[ $# != 2 ]]; then
echo safe_rename error: $# args, need 2 >2
return 1
$s service $2 $1
fi
}
+serstopnm() {
+ ser stop NetworkManager
+ ser stop dnsmasq
+ s resolvconf -d NetworkManager
+ ser start dnsmasq
+}
setini() { # set a value in a .ini style file
key="$1" value="$2" section="$3" file="$4"
local x
local -a args
if type -t trash-put >/dev/null; then
- # skip args that don't exist, or else trash-put will have an error
+ # skip args that dont exist, or else trash-put will have an error
for x in "$@"; do
if [[ -e $x || -L $x ]]; then
args+=("$x")
# cp /p/c/subdir_files/sieve/personal{test,}.sieve; testsievelist -eW INBOX
#
# Another option is to use sieve-test SCRIPT MAIL_FILE. note,
-# sieve-test doesn't know about envelopes, I'm not sure if sieve-filter does.
+# sieve-test doesnt know about envelopes, Im not sure if sieve-filter does.
# sieve with output filter. arg is mailbox, like INBOX.
# This depends on dovecot conf, notably mail_location in /etc/dovecot/conf.d/10-mail.conf
# mail related
testexim() {
# testmail above calls sendmail, which is a link to exim/postfix.
- # it's docs don't say a way of adding an argument
+ # its docs dont say a way of adding an argument
# to sendmail to turn on debug output. We could make a wrapper, but
# that is a pain. Exim debug args are documented here:
# http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_exim_command_line.html
# note, for exim daemon, you can turn on debug options by
# adding -d, etc to COMMONOPTIONS in
# /etc/default/exim4
- # for testing external mail, you need the to address as final cmdline arg
- exim -d+tls -t <<'EOF'
-From: root@frodo.lan
-To: ian@mail.iankelling.org
+ exim -d -t <<'EOF'
+From: root@gnu.org
+To: ian@iankelling.org
Subject: Testing Exim
This is a test message.
EOF
}
+# toggle keyboard
+tk() {
+ # based on
+ # https://askubuntu.com/questions/160945/is-there-a-way-to-disable-a-laptops-internal-keyboard
+ id=$(xinput --list --id-only 'AT Translated Set 2 keyboard')
+ if xinput list | grep -F '∼ AT Translated Set 2 keyboard' &>/dev/null; then
+ echo enabling keyboard
+ # find the first slave keyboard number, they are all the same in my output.
+ # if they werent, worst case we would need to save the slave number somewhere
+ # when it got disabled.
+ slave=$(xinput list | sed -n 's/.*slave \+keyboard (\([0-9]*\)).*/\1/p' | head -n1)
+ xinput reattach $id $slave
+ else
+ xinput float $id
+ fi
+}
+
tm() {
# timer in minutes
# --no-config
$s teeu "$@"
}
-tx() { # toggle set -x, and the prompt so it doesn't spam
+tx() { # toggle set -x, and the prompt so it doesnt spam
if [[ $- == *x* ]]; then
set +x
PROMPT_COMMAND=prompt-command
+ # disabled due to issue on stretch, running ll we get error. something
+ # about the DEBUG trap is broken
+ # if [[ $TERM == *(screen*|xterm*|rxvt*) ]]; then
+ # trap 'settitle "$BASH_COMMAND"' DEBUG
+ # fi
else
+ # normally, i would just execute these commands in the function.
+ # however, DEBUG is not inherited, so we need to run it outside a function.
+ # And we want to run set -x afterwards to avoid spam, so we cram everything
+ # in here, and then it will run after this function is done.
+ #PROMPT_COMMAND='trap DEBUG; unset PROMPT_COMMAND; PS1="\w \$ "; set -x'
+
unset PROMPT_COMMAND
PS1="\w \$ "
set -x
xl() {
if pgrep gnome-screensav &>/dev/null; then
- # this command actually starts gnome-screensaver if it isn't running.
+ # this command actually starts gnome-screensaver if it isn\'t running.
# lololol, what crap
gnome-screensaver-command --exit &>/dev/null
fi
# fedora/debian source
[[ -r /usr/share/git-core/contrib/completion/git-prompt.sh ]] && source /usr/share/git-core/contrib/completion/git-prompt.sh
- # in case we didn't source git-prompt.sh
+ # in case we didnt source git-prompt.sh
if ! declare -f __git_ps1 > /dev/null; then
__git_ps1() {
:
fi
fi
# I would set nullglob, but bash has had bugs where that
- # doesn't work if not in top level.
- if [[ -e /nocow/btrfs-stale ]] && ((`ls -AUq /nocow/btrfs-stale|wc -l`)); then
+ # doesnt work if not in top level.
+ if [[ -e /nocow/btrfs-stale ]] && ((`command ls -AUq /nocow/btrfs-stale|wc -l`)); then
ps_char="! $ps_char"
fi
PS1="${PS1%"${PS1#*[wW]}"} \[$ps_color\]$ps_char\[$(get_term_color nocolor)\] "
- # emacs completion doesn't like the git prompt atm, so disabling it.
+ # emacs completion doesnt like the git prompt atm, so disabling it.
#PS1="${PS1%"${PS1#*[wW]}"}$(__git_ps1 ' (%s)') \[$ps_color\]$ps_char\[$(get_term_color nocolor)\] "
}
PROMPT_COMMAND=prompt-command
local title_escape="\033]0;"
fi
if [[ $* != prompt-command ]]; then
- echo -ne "$title_escape$USER@$HOSTNAME ${PWD/#$HOME/~}"; printf "%s" "$*"; echo -ne "\007"
+ echo -ne "$title_escape$USER@$HOSTNAME ${PWD/#$HOME/~} "
+ printf "%s" "$*"
+ echo -ne "\007"
fi
}
- # for titlebar
- # condition from the screen man page i think
- if [[ $TERM == *(screen*|xterm*|rxvt*) ]]; then
- trap 'settitle "$BASH_COMMAND"' DEBUG
- else
- trap DEBUG
- fi
+ # for titlebar.
+ # condition from the screen man page i think.
+ # note: duplicated in tx()
+ # disabled. see note in tx
+ # if [[ $TERM == *(screen*|xterm*|rxvt*) ]]; then
+ # trap 'settitle "$BASH_COMMAND"' DEBUG
+ # else
+ # trap DEBUG
+ # fi
fi
errcatch
fi
-# I'd prefer to have system-wide, plus user ruby, due to bug in it
+# for mitmproxy to get a newer python.
+# commented until i want to use it because it
+# noticably slows bash startup
+#
+#if [[ $EUID != 0 && -e ~/.pyenv/bin ]]; then
+# export PATH="~/.pyenv/bin:$PATH"
+# eval "$(pyenv init -)"
+# 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 don't get multi-user ruby when you sudo to root, unless its sudo -i.
+# 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 didn't actually work.
+# but it didnt actually work.
# in cased I never need this
# rvm for non-interactive shell: modified from https://rvm.io/rvm/basics
path_add --end ~/.npm-global
+export BASEFILE_DIR=/a/bin/fai-basefiles
-# didn't get drush working, if I did, this seems like the
+# didnt get drush working, if I did, this seems like the
# only good thing to include for it.
# Include Drush completion.
# if [ -f "/home/ian/.drush/drush.complete.sh" ] ; then
# todo: remove old leaf subvols, like keep up to 1 month or something.
+# todo: if we cancel in the middle of a btrfs send, then run again immediately, the received subvolume doesn't get a Received UUID: field, and we won't mount it. Need to figure out a solution that will fix this.
set -eE -o pipefail
trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
[[ $EUID == 0 ]] || exec sudo -E "$BASH_SOURCE" "$@"
usage() {
- echo "top of script file:"
- sed -n '1,/^[# ]*end command line/{p;b};q' "$0"
- exit $1
+ echo "top of script file:"
+ sed -n '1,/^[# ]*end command line/{p;b};q' "$0"
+ exit $1
}
script_dir=$(dirname $(readlink -f "$BASH_SOURCE"))
default_args_file=/etc/btrbk-run.conf
if [[ -s $default_args_file ]]; then
- set -- $(< $default_args_file) "$@"
+ set -- $(< $default_args_file) "$@"
fi
temp=$(getopt -l help cl:m:nprt:vh "$@") || usage 1
eval set -- "$temp"
while true; do
- case $1 in
- # only creates the config file, does not run btrbk
- -c) conf_only=true; shift ;;
- -l) rate_limit=$2; shift 2 ;;
- -m) IFS=, mountpoints=($2); unset IFS; shift 2 ;;
- -n) dry_run=true; dry_run_arg=-n; shift ;;
- -p) progress_arg="--progress"; shift ;;
- # btrbk arg: Resume only. Skips snapshot creation.
- -r) resume_arg=-r; shift ;;
- # empty is valid for just doing local snapshot. we have default hosts
- # we will populate
- -t) IFS=, targets=($2); unset IFS; shift 2 ;;
- -v) verbose=true; verbose_arg=-v; shift ;;
- -h|--help) usage ;;
- --) shift; break ;;
- *) echo "$0: Internal error!" ; exit 1 ;;
- esac
+ case $1 in
+ # only creates the config file, does not run btrbk
+ -c) conf_only=true; shift ;;
+ -l) rate_limit=$2; shift 2 ;;
+ -m) IFS=, mountpoints=($2); unset IFS; shift 2 ;;
+ -n) dry_run=true; dry_run_arg=-n; shift ;;
+ -p) progress_arg="--progress"; shift ;;
+ # btrbk arg: Resume only. Skips snapshot creation.
+ -r) resume_arg=-r; shift ;;
+ # empty is valid for just doing local snapshot. we have default hosts
+ # we will populate
+ -t) IFS=, targets=($2); unset IFS; shift 2 ;;
+ -v) verbose=true; verbose_arg=-v; shift ;;
+ -h|--help) usage ;;
+ --) shift; break ;;
+ *) echo "$0: Internal error!" ; exit 1 ;;
+ esac
done
if [[ -s $default_args_file ]]; then
- echo "$0: warning: default btrbk-run options set in $default_args_file (sleeping 5 seconds):"
- cat $default_args_file
- sleep 5
+ echo "$0: warning: default btrbk-run options set in $default_args_file (sleeping 5 seconds):"
+ cat $default_args_file
+ sleep 5
fi
echo -e "$0: options: conf_only=$conf_only\ndry_run=$dry_run\nresume_arg=$resume_arg\nrate_limit=$rate_limit\nverbose=$verbose"
# set default targets
if [[ ! -v targets ]]; then
- case $HOSTNAME in
- x2|kw)
- if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
- targets=($HOME_DOMAIN)
- fi
- ;;
- tp)
- targets=(frodo)
- if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
- if timeout -s 9 10 ssh x2 :; then
- targets+=(x2)
- fi
- fi
- ;;
- frodo)
- targets=()
- ;;
- *)
- echo "$0: error: no default targets for this host, use -t"
- exit 1
- ;;
- esac
+ case $HOSTNAME in
+ x2|kw)
+ if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
+ targets=($HOME_DOMAIN)
+ fi
+ ;;
+ tp)
+ targets=(frodo)
+ if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
+ if timeout -s 9 10 ssh x2 :; then
+ targets+=(x2)
+ fi
+ fi
+ ;;
+ frodo)
+ targets=()
+ ;;
+ *)
+ echo "$0: error: no default targets for this host, use -t"
+ exit 1
+ ;;
+ esac
fi
echo "targets: ${targets[*]}"
-if (( ${#mountpoints[@]} )); then
- for mp in ${mountpoints[@]}; do
- if [[ -e /nocow/btrfs-stale/$mp ]]; then
- echo "$0: warning: $mp stale. Sleeping for 3 seconds in case you want to cancel."
- sleep 3
- fi
- done
-else # set default mountpoints
- case $HOSTNAME in
- frodo)
- prospective_mps=(/i)
- ;;
- *)
- prospective_mps=(/a /q)
- if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
- prospective_mps+=(/o)
- fi
- ;;
- esac
- case ${targets[0]} in
- kw|kww)
- prospective_mps=(/a)
- ;;
- esac
-
- for mp in ${prospective_mps[@]}; do # default mountpoints to sync
- if [[ -e /nocow/btrfs-stale/$mp ]]; then
- echo "$0: warning: $mp stale, not adding to default mountpoints"
- continue
- fi
- if awk '{print $2}' /etc/fstab | grep -xF $mp &>/dev/null; then
- mountpoints+=($mp)
- fi
- done
-fi
+# set default mountpoints
+case $HOSTNAME in
+ frodo)
+ prospective_mps=(/i)
+ ;;
+ *)
+ prospective_mps=(/a /q)
+ if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
+ prospective_mps+=(/o)
+ fi
+ ;;
+esac
+case ${targets[0]} in
+ kw|kww)
+ prospective_mps=(/a)
+ ;;
+esac
+
+for mp in ${prospective_mps[@]}; do # default mountpoints to sync
+ if [[ -e /nocow/btrfs-stale/$mp ]]; then
+ echo "$0: warning: $mp stale, not adding to default mountpoints"
+ continue
+ fi
+ if awk '{print $2}' /etc/fstab | grep -xF $mp &>/dev/null; then
+ mountpoints+=($mp)
+ fi
+done
echo "mountpoints: ${mountpoints[*]}"
##### end command line parsing ########
rsync-dirs() {
- local host=$1
- local path=$2
- m rsync $dry_run_arg -ahi --relative --delete "$path" "root@$host:/"
+ local host=$1
+ local path=$2
+ m rsync $dry_run_arg -ahi --relative --delete "$path" "root@$host:/"
}
vol-conf() {
- cat >>/etc/btrbk.conf <<EOF
+ cat >>/etc/btrbk.conf <<EOF
volume $vol
EOF
}
sub-conf() {
- cat >>/etc/btrbk.conf <<EOF
+ cat >>/etc/btrbk.conf <<EOF
subvolume $sub
EOF
}
tg-conf() {
- cat >>/etc/btrbk.conf <<EOF
+ cat >>/etc/btrbk.conf <<EOF
target send-receive ssh://$tg$vol/btrbk
EOF
}
if ! which btrbk &>/dev/null; then
- echo "$0: error: no btrbk binary found"
+ echo "$0: error: no btrbk binary found"
+ exit 1
fi
+# if our mountpoints are from stale snapshots,
+# it doesn't make sense to do a backup.
+check-subvol-stale ${mountpoints[@]} || exit 1
+
cat >/etc/btrbk.conf <<EOF
ssh_identity /root/.ssh/home
# transaction info.
transaction_syslog local7
+# 20%ish speedup[]
+stream_buffer 512m
+
# so we only run one at a time
lockfile /var/lock/btrbk.lock
EOF
-# if our mountpoints are from stale snapshots,
-# it doesn't make sense to do a backup.
-check-subvol-stale ${mountpoints[@]} || exit 1
for tg in ${targets[@]}; do
- # for an initial run, btrbk requires the dir to exist
- ssh root@$tg mkdir -p /mnt/root/btrbk
+ # for an initial run, btrbk requires the dir to exist.
+ # also use this opportunity to kill emacs, because it doesn't
+ # notice that the file has changed out from underneath it
+ ssh root@$tg mkdir -p /mnt/root/btrbk
done
for m in ${mountpoints[@]}; do
- # for /i, some special cases. there is just one static target and direction.
- if [[ $m == /i ]]; then
- vol=/mnt/iroot
- vol-conf
- sub=i
- sub-conf
- tg=frodo
- vol=/mnt/root
- tg-conf
- else
- vol=/mnt/root
- vol-conf
- sub=${m##*/}
- sub-conf
- for tg in ${targets[@]}; do
- tg-conf
- done
- fi
+ # for /i, some special cases. there is just one static target and direction.
+ if [[ $m == /i ]]; then
+ vol=/mnt/iroot
+ vol-conf
+ sub=i
+ sub-conf
+ tg=frodo
+ vol=/mnt/root
+ tg-conf
+ else
+ vol=/mnt/root
+ vol-conf
+ sub=${m##*/}
+ sub-conf
+ for tg in ${targets[@]}; do
+ tg-conf
+ done
+ fi
done
if $conf_only; then
- exit
+ exit
fi
if $dry_run; then
- m btrbk -v -n $resume_arg run
+ m btrbk -v -n $resume_arg run
else
- # -q and just using the syslog option seemed nice,
- # but it doesn't show when a send has a parent and when it doesn't.
- m btrbk $verbose_arg $progress_arg $resume_arg run
+ # -q and just using the syslog option seemed nice,
+ # but it doesn't show when a send has a parent and when it doesn't.
+ m btrbk $verbose_arg $progress_arg $resume_arg run
fi
# if we have it, sync to systems which don't
if mountpoint $rsync_mountpoint >/dev/null; then
- for tg in ${targets[@]}; do
- case $tg in
- tp|li|lk)
- for x in /p/c/machine_specific/*.hosts; do
- if grep -qxF $tg $x; then
- dir=${x%.hosts}
- rsync-dirs $tg $dir
- fi
- done
- ;;
- esac
- done
+ for tg in ${targets[@]}; do
+ case $tg in
+ tp|li|lk)
+ for x in /p/c/machine_specific/*.hosts; do
+ if grep -qxF $tg $x; then
+ dir=${x%.hosts}
+ rsync-dirs $tg $dir
+ fi
+ done
+ ;;
+ esac
+ done
fi
if ! $dry_run; then
- m $script_dir/mount-latest-remote ${targets[@]}
+ m $script_dir/mount-latest-remote ${targets[@]}
fi
# See the License for the specific language governing permissions and
# limitations under the License.
-# usage: $0 SUBVOL_MOUNTPOINT...
-#
-# 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 touch
-# /nocow/btrfs-stale/$subvol
-#
-# Either SUBVOL_MOUNTPOINT is a snapshot of the latest, or
-# the latest snapshot is snapshot of SUBVOL_MOUNTPOINT.
[[ $EUID == 0 ]] || exec sudo -E "$BASH_SOURCE" "$@"
shopt -s nullglob
+usage() {
+ cat <<EOF
+usage: $0 SUBVOL_MOUNTPOINT...
+
+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 touch
+/nocow/btrfs-stale/\$subvol
+
+Either SUBVOL_MOUNTPOINT is a snapshot of the latest, or
+the latest snapshot is snapshot of SUBVOL_MOUNTPOINT.
+
+-d Enable debug output
+-h|--help Print help and exit.
+
+Note: Uses GNU getopt options parsing style
+EOF
+ exit $1
+}
+
+##### begin command line parsing ########
+
+debug=false # default
+temp=$(getopt -l help,d hd "$@") || usage 1
+eval set -- "$temp"
+while true; do
+ case $1 in
+ -d) debug=true; shift ;;
+ -h|--help) usage ;;
+ --) shift; break ;;
+ *) echo "$0: Internal error! unexpected args: $*" ; exit 1 ;;
+ esac
+done
+
if [[ ! $@ ]]; then
echo "$0: error: expected mountpoint argument"
fi
fi
}
+d() {
+ if $debug; then
+ printf "%s\n" "$*"
+ fi
+}
ret=0
for d; do
vol=${d##*/}
dev=$(sed -rn "s,^\s*([^#]\S*)\s+$d\s.*,\1,p" /etc/fstab|head -n1)
+ d dev=$dev
subvol_dir=$(sed -rn "s,^\s*[^#]\S*\s+$d\s.*\bsubvol=([a-zA-A/]+).*,\1,p" /etc/fstab|head -n1)
+ d subvol_dir=$subvol_dir
# note, we need $dev because $d might not be mounted, and we do this loop
# because the device in fstab for the rootfs can be different.
for devx in $(btrfs fi show $dev| sed -rn 's#.*path (/\S+)$#\1#p'); do
if [[ $root_dir ]]; then break; fi
done
svp=$root_dir/$subvol_dir # subvolume path
+ d svp=$svp
snaps=($root_dir/btrbk/$subvol_dir.20*) # Assumes we are in the 21st century.
if [[ ! $snaps ]]; then
fi
# get info on last received sub
- last_received_gen=0
+ last_received_cgen=0
for f in ${snaps[@]}; do
show="$(btrfs sub show $f)"
if echo "$show" | grep -E "Received UUID:\s+[[:alnum:]]" &>/dev/null; then
cgen=$(echo "$show" | sed -rn 's,^\s*Gen at creation:\s+([0-9]+).*,\1,p')
- if [[ $cgen -gt $last_received_gen ]]; then
+ if [[ $cgen -gt $last_received_cgen ]]; then
last_received_cgen=$cgen
last_received=$f
fi
fi
done
+ d last_received_cgen=$cgen
+ d last_received=$f
# Get last_snap by date.
# when a btrbk bugfix makes it into the distro,
# if there is a last_received, we can assume stale or fresh if we are newer/older
if [[ $last_received ]]; then
svp_cgen=$(btrfs sub show $svp | sed -rn 's,^\s*Gen at creation:\s+([0-9]+).*,\1,p')
+ d svp_cgen=$svp_cgen
if [[ $svp_cgen -ge $last_received_cgen ]]; then
stale=false
else
#!/bin/bash
-source /a/bin/errhandle/errcatch-function
-source /a/bin/errhandle/bash-trace-function
-
-errcatch
+source /a/bin/errhandle/err
m() {
- echo "$*"
- "$@"
+ echo "$*"
+ "$@"
}
s() { sudo "$@"; }
lnf() { /a/exe/lnf "$@"; }
# Also note, under filesystem/, symlinks are expanded.
subdir-link-r() {
- local root="$1"
- local targets=()
- if [[ $2 ]]; then
- targets=( "$2"/!(.git|..|.) )
- else
- for f in "$1"/!(.git|..|.); do
- [[ -d $f ]] && targets+=("$f") ||:
- done
- fi
- local below="$( readlink -f "$root/..")"
- for path in "${targets[@]}"; do
- local fullpath="$(readlink -f "$path")"
- #e $fullpath $below # debug
- if [[ -f $path || $(dirname $(readlink -f "$fullpath")) == "$below" ]]; then
- m lnf -T "$path" "$HOME/${path#$root/}"
- elif [[ -d "$path" ]]; then
- subdir-link-r "$root" "$path"
- fi
+ local root="$1"
+ local targets=()
+ if [[ $2 ]]; then
+ targets=( "$2"/!(.git|..|.) )
+ else
+ for f in "$1"/!(.git|..|.); do
+ [[ -d $f ]] && targets+=("$f") ||:
done
+ fi
+ local below="$( readlink -f "$root/..")"
+ for path in "${targets[@]}"; do
+ local fullpath="$(readlink -f "$path")"
+ #e $fullpath $below # debug
+ if [[ -f $path || $(dirname $(readlink -f "$fullpath")) == "$below" ]]; then
+ m lnf -T "$path" "$HOME/${path#$root/}"
+ elif [[ -d "$path" ]]; then
+ subdir-link-r "$root" "$path"
+ fi
+ done
}
common-file-setup() {
- local dir fs x bdir f dst
- for dir in "$@"; do
- fs=$dir/filesystem
- if [[ -e $fs && $USER =~ ^iank?$ ]]; then
- # note, symlinks get resolved, not copied.
- s tar --mode=g-s --owner=0 --group=0 -cz -C $fs . | s tar -xz -C /
- fi
-
- if [[ -e $dir/subdir_files ]]; then
- m subdir-link-r $dir/subdir_files
- fi
- local x=( $dir/!(binds|subdir_files|filesystem|machine_specific|..|.) )
- (( ${#x[@]} >= 1 )) || continue
- m lnf ${x[@]} ~
- done
+ local dir fs x bdir f dst
+ for dir in "$@"; do
+ fs=$dir/filesystem
+ if [[ -e $fs && $USER =~ ^iank?$ ]]; then
+ # note, symlinks get resolved, not copied.
+ s tar --mode=g-s --owner=0 --group=0 -cz -C $fs . | s tar -xz -C /
+ fi
+
+ if [[ -e $dir/subdir_files ]]; then
+ m subdir-link-r $dir/subdir_files
+ fi
+ local x=( $dir/!(binds|subdir_files|filesystem|machine_specific|..|.) )
+ (( ${#x[@]} >= 1 )) || continue
+ m lnf ${x[@]} ~
+ done
}
all_dirs=({/a/c,/p/c}{,/machine_specific/$HOSTNAME})
# note, we assume a group of hosts does not have the
# same name as a single host, which is no problem on our scale.
for x in /p/c/machine_specific/*.hosts; do
- if grep -qxF $HOSTNAME $x; then all_dirs+=( ${x%.hosts} ); fi
+ if grep -qxF $HOSTNAME $x; then all_dirs+=( ${x%.hosts} ); fi
done
c_dirs=(/a/c{,/machine_specific/$HOSTNAME})
case $USER in
- ian|iank)
- # p needs to go first so .ssh link is created, then config link inside it
- m common-file-setup ${all_dirs[@]}
-
- #### begin special extra stuff ####
- install -d -m700 ~/gpg-agent-socket
- if [[ -d /etc/bind/bind-writable ]]; then
- # need bind writable dir for nsupdate, or else we get
- # named[20823]: /etc/bind/db.iank.pw.jnl: create: permission denied
- m s chgrp bind /etc/bind/bind-writable
- fi
- files=(/etc/bind/[Kk]*)
- if [[ -e $files ]]; then
- m s chgrp bind ${files[@]}
- fi
- if [[ -e /etc/davpass ]] && getent group www-data &>/dev/null; then
- s chgrp www-data /etc/davpass
- fi
- if [[ -e /var/lib/znc ]] && getent group znc; then
- s chown -R znc:znc /var/lib/znc
- fi
- /a/exe/lnf -T /p/arbtt-capture.log ~/.arbtt/capture.log
- ##### end special extra stuff #####
-
- sudo bash -c 'cd /etc/openvpn; for f in client/*; do ln -sf $f .; done'
-
- m sudo -H -u traci "$BASH_SOURCE"
- ;;
- traci)
- m common-file-setup ${c_dirs[@]}
- ;;
- *)
- echo "$0: error: unexpected user"; exit 1
- ;;
+ ian|iank)
+ # p needs to go first so .ssh link is created, then config link inside it
+ m common-file-setup ${all_dirs[@]}
+
+ #### begin special extra stuff ####
+ install -d -m700 ~/gpg-agent-socket
+
+ files=(/var/lib/bind)
+ if [[ -e $files ]]; then
+ # reset to the original permissions.
+ m s chgrp -R bind ${files[@]}
+ m s chmod g+w ${files[@]}
+ fi
+ if [[ -e /etc/davpass ]] && getent group www-data &>/dev/null; then
+ s chgrp www-data /etc/davpass
+ fi
+ if [[ -e /var/lib/znc ]] && getent group znc; then
+ s chown -R znc:znc /var/lib/znc
+ fi
+ /a/exe/lnf -T /p/arbtt-capture.log ~/.arbtt/capture.log
+ ##### end special extra stuff #####
+
+ sudo bash -c 'cd /etc/openvpn; for f in client/*; do ln -sf $f .; done'
+ sudo bash -c 'chmod 600 /etc/openvpn/client/*.key'
+
+ m sudo -H -u traci "$BASH_SOURCE"
+ ;;
+ traci)
+ m common-file-setup ${c_dirs[@]}
+ ;;
+ *)
+ echo "$0: error: unexpected user"; exit 1
+ ;;
esac
EOF
ser restart nfs-kernel-server
-if [[ $HOSTNAME == treetowl ]]; then
+if [[ $HOSTNAME == kd ]]; then
# persistent one time steps for webdav:
# create persistent password, put it in ~/.kodi/userdata/advancedsettings.xml,
# per http://kodi.wiki/view/MySQL/Sync_other_parts_of_Kodi
# this is from distro-end
-if [[ $HOSTNAME == treetowl ]]; then
+if [[ $HOSTNAME == kd ]]; then
pi samba
# note samba re-reads it\'s config every 1 minute
case $distro in
### 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 ;;
##### 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 frodo tp li lj demohost kw fz; do
eval "$f() { [[ $HOSTNAME == $f ]]; }"
done
has_p() { ! linode; } # when tp is tracis, then not tp either
$(debian-codename-compat) \
stable"
p update
- pi docker-ce
- sgo docker
+ # docker eats up a fair amount of cpu when doing nothing, so don't enable it unless
+ # we really need it.
+ pi-nostart docker-ce
+ case $HOSTNAME in
+ li|lj) sgo docker ;;
+ esac
# other distros unknown
fi
### end docker install ####
############### !!!!!!!!!!!!!!!!!
############### manual steps:
- # only following 2 people atm, so not bothering to figure out backups
+ # only following a few people atm, so not bothering to figure out backups
# when mastodon has not documented it at all.
#
# fsf@status.fsf.org
# alo would be nice if erc supported
# https://wiki.znc.in/self-message
# https://wiki.znc.in/Query_buffers \
- #
+ #
s useradd --create-home -d /var/lib/znc --system --shell /sbin/nologin --comment "Account to run ZNC daemon" --user-group znc || [[ $? == 9 ]] # 9 if it exists already
chmod 700 /var/lib/znc
s chown -R znc:znc /var/lib/znc
s add-apt-repository -y ppa:ansible/ansible
p update
fi
- pi ansible
+ s pip install --upgrade pip
+ # newer 2.7 versions have a bug that incorrectly detects trisquel version. fixed once 2.8 arrives
+ # in 2019
+ pip install --user ansible=2.7.4
+ #pi ansible
;;
esac
####### begin misc packages ###########
+# sakura config is owned by ian
reset-sakura
-sudo -u traci -i reset-sakura
reset-konsole
sudo -u traci -i reset-konsole
+# traci xscreensaver we don't want to reset
reset-xscreensaver
# others unknown
esac
+case $(debian-codename) in
+ # needed for debootstrap scripts for fai since fai requires debian
+ flidas)
+ s dd of=/etc/apt/preferences.d/flidas-xenial <<EOF
+Package: *
+Pin: release a=xenial
+Pin-Priority: -100
+
+Package: *
+Pin: release a=xenial-updates
+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
+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
+ s cp ./usr/share/debootstrap/scripts/* /usr/share/debootstrap/scripts
+
+ ;;
+esac
+
# /run and /dev/shm are listed as required for pulseaudio. All 4 in the group
# listed in the default config as suggested.
# /run/usr/1000 i noticed was missing for pulseaudio
EOF
mkschroot() {
+ distro=$1
+ shift
+ case $distro in
+ ubuntu)
+ repo=http://archive.ubuntu.com/ubuntu/
+ ;;
+ debian)
+ repo=http://deb.debian.org/debian/
+ ;;
+ esac
n=$1
shift
apps=($@)
cd; s schroot -c $n -- apt-get install --allow-unauthenticated -y ${apps[@]}
else
s mkdir -p $d
- s debootstrap $n $d http://deb.debian.org/debian/
+
+ s debootstrap $n $d $repo
cd; s schroot -c $n -- apt-get install --allow-unauthenticated -y ${apps[@]}
fi
s cp -P {,$d}/etc/localtime
# for my roommate
case $distro in
trisquel)
- mkschroot stretch firefox-esr pulseaudio chromium
+ mkschroot debian stretch firefox-esr pulseaudio chromium
;;
esac
s mkdir -p /nocow/user
s chown $USER:$USER /nocow/user
case $distro in
- debian)
- case $(debian-codename) in
- jessie)
- pi anki
- ;;
- *)
- mkschroot jessie anki pulsaudio mplayer
- ;;
- esac
- ;;
trisquel|ubuntu)
pi anki
;;
sgo org.cups.cupsd.service
;;
debian|trisquel|ubuntu)
+ pi cups
s gpasswd -a $USER lpadmin # based on ubuntu wiki
spa hplip
;;
# in arch, I had to pick out the 6L driver.
-case $distro in
- trisquel|ubuntu|debian) pi --no-install-recommends mairix notmuch ;;
- fedora|arch) spa mairix notmuch ;;
-esac
-
# allow user to run vms, from debian handbook
for x in iank traci; do s usermod -a -G libvirt,kvm $x; done
# bridge networking as user fails. google lead here, but it doesn\'t work:
########### misc stuff
+# make my /etc/fonts/conf.d/ get used.
+# I have a new sans-serif font there because the default one
+# displays l and I as the same char, grrrrr.
+s fc-cache
/a/bin/distro-setup/mymimes
# compilers.
spa unison unison-gtk
;;
- arch)
- spa unison gtk2
- ;;
+arch)
+ spa unison gtk2
+ ;;
esac
case $distro in
;;
esac
-
+# networkmanager has this nasty behavior on flidas: if the machine
+# crashes with dnsmasq running, on subsequent boot, it adds an entry to
+# resolvconf for 127.0.0.1 in some stupid attempt to restore
+# nameservers.
+# This can be manually fixed by stoping dnsmasq,
+# then based on whats in /run/dnsmasq/, i see we can run
+# s resolvconf -d NetworkManager
+# oh ya, and stoping NetworkManager leaves this crap behind without cleaning it up.
+ser stop NetworkManager
+ser disable NetworkManager
if [[ $HOSTNAME == frodo ]]; then
#!/bin/bash -l
-errcatch
+err-catch
usage() {
--- /dev/null
+<?xml version="1.0"?>
+<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+<fontconfig>
+ <alias>
+ <family>sans-serif</family>
+ <prefer>
+ <family>Noto Sans</family>
+ </prefer>
+ </alias>
+</fontconfig>
section: screens
- treetowl:
+ kd:
frodo:
tp:
end
section: links
tp:
right = frodo
- treetowl:
+ kd:
left = frodo
frodo:
left = tp
- right = treetowl
+ right = kd
end
--- /dev/null
+[Service]
+TimeoutStartSec=20
+++ /dev/null
-#!/bin/bash
-
-# commented, because relying on cronjob
-#offlineimap -a fsf
-
-# delete based on http://deflexion.com/2006/05/imap-way-of-deleting-message
-sieve-filter -eW -o mail_location=maildir:/nocow/user/fsfmd:LAYOUT=fs:INBOX=/nocow/user/fsfmd/INBOX ~/sieve/fsf.sieve INBOX delete &>>/tmp/fsfsieve.log
-
-# mu indexing happens after this, and if offlineimap is running,
-# it can index messages which are in the wrong folder.
-# Just run it again if this happens.
-
-# to test new rules, update fsf-test.sieve, run these commands, then copy new fsf-test.sieve to fsf.sieve
-# sieve-filter -o mail_location=maildir:/nocow/user/fsfmd:LAYOUT=fs:INBOX=/nocow/user/fsfmd/INBOX ~/sieve/fsf-test.sieve INBOX &>/tmp/testfsfsieve.log
-# sed -rn '/^Performed actions:/{n;n;p}' /tmp/testfsfsieve.log | sort -u
#!/bin/bash
-source /a/bin/errhandle/errcatch-function
-source /a/bin/errhandle/bash-trace-function
-errcatch
+source /a/bin/errhandle/err
e() { echo "$*"; "$@"; }
lnf() { /a/bin/lnf/lnf "$@"; }
-treetowl
+kd
frodo
\ No newline at end of file
zone "b8.nz" {
type master;
-file "/etc/bind/bind-writable/db.b8.nz";
+file "/var/lib/bind/db.b8.nz";
update-policy {
// allow host to update themselves with a key having their own name
grant b8.nz. name b8.nz. A TXT;
#!/bin/bash
# Copyright (C) 2016 Ian Kelling
-
+set -x
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
[[ $EUID == 0 ]] || exec sudo "$BASH_SOURCE" "$@"
-source /a/bin/errhandle/errcatch-function
-source /a/bin/errhandle/errallow-function
-source /a/bin/errhandle/bash-trace-function
-errcatch
+source /a/bin/errhandle/err
usage() {
- cat <<'EOF'
+ cat <<'EOF'
Usage: mail-route up|down|show
Marks tcp packets on port 25 and 143 to be routed through
Is idempotent.
EOF
- exit $1
+ exit $1
}
if (( $# < 1 )); then
- usage 1
+ usage 1
fi
up() {
- start=true
- stop=false
- iptables_op=-A
- ip_op=add
- if [[ ! $tun_dev ]]; then
- # delays because I was running this outside of openvpn before
- found=false
- for ((i=1; i<=30; i++)); do
- tun_dev=$(ip a show to 10.8.0.4/24 | sed -rn '1s/^\S+\s+([^:]+).*/\1/p')
- if [[ $tun_dev == tun* ]]; then
- found=true
- break
- fi
- sleep 1
- done
- if ! $found; then
- echo "$0: error: timeout waiting for valid tun_dev, currently:$tun_dev"
- exit 1
- fi
+ start=true
+ stop=false
+ iptables_op=-A
+ ip_op=add
+ timeout_secs=20
+ if [[ ! $tun_dev ]]; then
+ # delays because I was running this outside of openvpn before
+ found=false
+ for ((i=1; i<=timeout_secs; i++)); do
+ tun_dev=$(ip a show to 10.8.0.4/24 | sed -rn '1s/^\S+\s+([^:]+).*/\1/p')
+ if [[ $tun_dev == tun* ]]; then
+ found=true
+ break
+ fi
+ sleep 1
+ done
+ if ! $found; then
+ echo "$0: error: timeout after $timeout_secs waiting for valid tun_dev, currently:$tun_dev"
+ exit 1
fi
- e() { echo "$0: $*"; "$@"; }
- _errcatch_cleanup=stop
- modify
- # we leave it as is even when stopping, because we would like it to be default, but the only way
- # to change the default is for every device, and I want to avoid that, even though I wouldn't mind, others users of this script might.
+ fi
+ e() { echo "$0: $*"; "$@"; }
+ _errcatch_cleanup=stop
+ modify
+ # we leave it as is even when stopping, because we would like it to be default, but the only way
+ # to change the default is for every device, and I want to avoid that, even though I wouldn't mind, others users of this script might.
+ val=$(sysctl -n net.ipv4.conf.$tun_dev.rp_filter)
+ if [[ $val != 2 ]]; then
+ echo "net.ipv4.conf.$tun_dev.rp_filter = $val"
e sysctl net.ipv4.conf.$tun_dev.rp_filter=2
+ fi
+
}
down() {
- start=false
- stop=true
- iptables_op=-D
- ip_op=del
- # note, this is not going to work if the interface has been deleted.
- # we could also check for an iptable rule that on some tun interface like the one
- # we use, but meh, the way I'm using the script now, tun_dev is supplied by openvpn
- if [[ ! tun_dev ]]; then
+ start=false
+ stop=true
+ iptables_op=-D
+ ip_op=del
+ # note, this is not going to work if the interface has been deleted.
+ # we could also check for an iptable rule that on some tun interface like the one
+ # we use, but meh, the way I'm using the script now, tun_dev is supplied by openvpn
+ if [[ ! tun_dev ]]; then
tun_dev=$(ip a show to 10.8.0.4/24 | sed -rn '1s/^\S+\s+([^:]+).*/\1/p')
- fi
- e() { echo "$0: $*"; "$@" || printf "maybe ok failure: %s\n" "$*"; }
- modify
+ fi
+ e() { echo "$0: $*"; "$@" || printf "maybe ok failure: %s\n" "$*"; }
+ modify
}
show() {
- e() { printf "${0##*/}: %s\n" "$*"; "$@"; }
- e iptables -t mangle -S
- e iptables -t nat -S
- e ip rule
- e ip route show table 1
-
- tun_dev=$(ip a show to 10.8.0.4/24 | sed -rn '1s/^\S+\s+([^:]+).*/\1/p')
- if [[ $tun_dev == tun* ]]; then
- e sysctl net.ipv4.conf.$tun_dev.rp_filter
- else
- echo "$0: note, no tun device found"
- fi
- exit 0
+ e() { printf "${0##*/}: %s\n" "$*"; "$@"; }
+ e iptables -t mangle -S
+ e iptables -t nat -S
+ e ip rule
+ e ip route show table 1
+
+ tun_dev=$(ip a show to 10.8.0.4/24 | sed -rn '1s/^\S+\s+([^:]+).*/\1/p')
+ if [[ $tun_dev == tun* ]]; then
+ e sysctl net.ipv4.conf.$tun_dev.rp_filter
+ else
+ echo "$0: note, no tun device found"
+ fi
+ exit 0
}
runtest() {
- # debugging:
- #echo start=$start stop=$stop exists=$exists
- { $start && ! $exists; } || { $stop && $exists; }
+ # debugging:
+ #echo start=$start stop=$stop exists=$exists
+ { $start && ! $exists; } || { $stop && $exists; }
}
iptmod() { #iptables modify
- local check cmd="$*" exists=true
- ${cmd/-[AD]/-C} &>/dev/null || exists=false
- if runtest; then e $cmd; fi
+ local check cmd="$*" exists=true
+ ${cmd/-[AD]/-C} &>/dev/null || exists=false
+ if runtest; then e $cmd; fi
}
# code common to start and stop.
modify() {
- # match source or dest port. note, when we send to a port, it picks a random high port as
- # the source.
- for port in 25 143; do # smtp and imap.
- iptcommon="OUTPUT -m tcp -p tcp -m multiport --ports $port -j MARK --set-mark"
- iptmod iptables -t mangle $iptables_op $iptcommon 0x1
- iptmod iptables -t mangle $iptables_op $iptcommon 0x0 -d 10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
- # note, we could have used a custom chain and returned instead of setting the mark again.
- # in case anyone was ever curious, the inverse of private ips is: #0.0.0.0/5,8.0.0.0/7,11.0.0.0/8,12.0.0.0/6,16.0.0.0/4,32.0.0.0/3,64.0.0.0/2,128.0.0.0/3,160.0.0.0/5,168.0.0.0/6,172.0.0.0/12,172.32.0.0/11,172.64.0.0/10,172.128.0.0/9,173.0.0.0/8,174.0.0.0/7,176.0.0.0/4,192.0.0.0/9,192.128.0.0/11,192.160.0.0/13,192.169.0.0/16,192.170.0.0/15,192.172.0.0/14,192.176.0.0/12,192.192.0.0/10,193.0.0.0/8,194.0.0.0/7,196.0.0.0/6,200.0.0.0/5,208.0.0.0/4,224.0.0.0/3
- done
+ # match source or dest port. note, when we send to a port, it picks a random high port as
+ # the source.
+ for port in 25 143; do # smtp and imap.
+ iptcommon="OUTPUT -m tcp -p tcp -m multiport --ports $port -j MARK --set-mark"
+ iptmod iptables -t mangle $iptables_op $iptcommon 0x1
+ iptmod iptables -t mangle $iptables_op $iptcommon 0x0 -d 10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
+ # note, we could have used a custom chain and returned instead of setting the mark again.
+ # in case anyone was ever curious, the inverse of private ips is: #0.0.0.0/5,8.0.0.0/7,11.0.0.0/8,12.0.0.0/6,16.0.0.0/4,32.0.0.0/3,64.0.0.0/2,128.0.0.0/3,160.0.0.0/5,168.0.0.0/6,172.0.0.0/12,172.32.0.0/11,172.64.0.0/10,172.128.0.0/9,173.0.0.0/8,174.0.0.0/7,176.0.0.0/4,192.0.0.0/9,192.128.0.0/11,192.160.0.0/13,192.169.0.0/16,192.170.0.0/15,192.172.0.0/14,192.176.0.0/12,192.192.0.0/10,193.0.0.0/8,194.0.0.0/7,196.0.0.0/6,200.0.0.0/5,208.0.0.0/4,224.0.0.0/3
+ done
- if [[ $tun_dev ]]; then
- # when $tun_dev goes away, so does this rul
- iptmod iptables -t nat $iptables_op POSTROUTING -o $tun_dev -m mark --mark 0x1 -j SNAT --to-source 10.8.0.4
- fi
+ if [[ $tun_dev ]]; then
+ # when $tun_dev goes away, so does this rul
+ iptmod iptables -t nat $iptables_op POSTROUTING -o $tun_dev -m mark --mark 0x1 -j SNAT --to-source 10.8.0.4
+ fi
- iprulecmd="fwmark 1 table 1"
- exists=true; ip rule show $iprulecmd | grep . &>/dev/null || exists=false
- if runtest; then e ip rule $ip_op $iprulecmd; fi
+ iprulecmd="fwmark 1 table 1"
+ exists=true; ip rule show $iprulecmd | grep . &>/dev/null || exists=false
+ if runtest; then e ip rule $ip_op $iprulecmd; fi
- iproutecmd="default via 10.8.0.1 table 1"
- exists=true; ip route show $iproutecmd | grep . &>/dev/null || exists=false
- if runtest; then e ip route $ip_op $iproutecmd; fi
+ iproutecmd="default via 10.8.0.1 table 1"
+ exists=true; ip route show $iproutecmd | grep . &>/dev/null || exists=false
+ if runtest; then e ip route $ip_op $iproutecmd; fi
- # on debian this is 0 (no filter), on ubuntu it\'s 1, which is no good. 0 or 2 both work fine.
- # 2 drops it if the packet is not routable, martian address, or my default route is screwed up,
- # so, eh, might as well. some rhel docs recommend using it.
+ # on debian this is 0 (no filter), on ubuntu it\'s 1, which is no good. 0 or 2 both work fine.
+ # 2 drops it if the packet is not routable, martian address, or my default route is screwed up,
+ # so, eh, might as well. some rhel docs recommend using it.
}
if (( $# > 1 )); then
-tun_dev=$1
-$script_type
+ tun_dev=$1
+ $script_type
else
- case $1 in
- up|down|show) $1 ;;
- *) usage 1 ;;
- esac
+ case $1 in
+ up|down|show) $1 ;;
+ *) usage 1 ;;
+ esac
fi
trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
[[ $EUID == 0 ]] || exec sudo -E "$BASH_SOURCE" "$@"
+if [[ ! $SUDO_USER ]]; then
+ echo "$0: error: requires running as nonroot or sudo"
+ exit 1
+fi
+u=$SUDO_USER
+
usage() {
cat <<EOF
usage 1
fi
-if [[ ! $SUDO_USER ]]; then
- echo "$0: error: requires running as nonroot or sudo"
-fi
-u=$SUDO_USER
####### begin perstent password instructions ######
# Please enter a semicolon-separated list of recipient domains for which this machine
# should consider itself the final destination. These domains are commonly called
-# 'local domains'. The local hostname (treetowl.lan) and 'localhost' are always added
+# 'local domains'. The local hostname (kd.lan) and 'localhost' are always added
# to the list given here.
# By default all local domains will be treated identically. If both a.example and
# failing message on mail-tester.com:
-# We check if there is a server (A Record) behind your hostname treetowl.
-# You may want to publish a DNS record (A type) for the hostname treetowl or use a different hostname in your mail software
+# We check if there is a server (A Record) behind your hostname kd.
+# You may want to publish a DNS record (A type) for the hostname kd or use a different hostname in your mail software
# https://serverfault.com/questions/46545/how-do-i-change-exim4s-primary-hostname-on-a-debian-box
# and this one seemed appropriate from grepping config.
# I originally set this to li.iankelling.org, but then ended up with errors when li tried to send
-# mail to treetowl, so this should basically be a name that no host has as their
+# mail to kd, so this should basically be a name that no host has as their
# canonical hostname since the actual host sits behind a nat and changes.
# Seems logical for this to be the same as mailname.
MAIN_HARDCODE_PRIMARY_HOSTNAME = mail.iankelling.org
# i have the spool directory be common to distro multi-boot, so
# we need the uid to be the same. 608 cuz it's kind of in the middle
# of the free system uids.
- IFS=:; read _ _ uid _ < <(getent passwd Debian-exim ); unset IFS
- IFS=:; read _ _ gid _ < <(getent group Debian-exim ); unset IFS
+ IFS=:; read _ _ uid _ < <(getent passwd Debian-exim ||:) ||:; unset IFS
+ IFS=:; read _ _ gid _ < <(getent group Debian-exim ||:) ||:; unset IFS
if [[ ! $uid ]]; then
# from /var/lib/dpkg/info/exim4-base.postinst, plus uid and gid options
- adduser --uid 608 --gid 608 --system --group --quiet --home /var/spool/exim4 \
+ adduser --uid 608 --system --group --quiet --home /var/spool/exim4 \
--no-create-home --disabled-login --force-badname Debian-exim
elif [[ $uid != 608 ]]; then
systemctl stop exim4 ||:
# todo: decipher /mnt/root, like we do in check-subvol-stale
cd /mnt/root
if [[ -e $vol ]]; then
- e mv $vol $vol.leaf.$(date +%Y%m%dT%H%M%S%z)
+ e mv $vol $vol.leaf.$(date +%Y-%m-%dT%H:%M:%S-%z)
fi
# Note, we make a few assumptions in this script, like
# $d was not a different subvol id than $vol, and
done
### disabled
-if [[ $HOSTNAME == treetowlxxxxxxxxx ]]; then
+if [[ $HOSTNAME == kdxxxxxxxxx ]]; then
# partitioned it with fai partitioner outside of fai,
# because it\'s worth it to have 1% space reserved for boot and
# swap partitions in case I ever want to boot off those drives.
EOF
fi
tu /etc/crypttab <<EOF
-crypt_dev_$dev /dev/disk/by-id/$dev /q/root/luks/host-treetowl discard,luks
+crypt_dev_$dev /dev/disk/by-id/$dev /q/root/luks/host-kd discard,luks
EOF
if [[ ! -e /dev/mapper/crypt_dev_$dev ]]; then
cryptdisks_start crypt_dev_$dev
set -eE -o pipefail
trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
+# mail-route can get messed up a bit randomly, I don't know why.
+#/b/ds/mail-route up | /b/log-quiet/log-once -1 mail-route
+
offlineimap -u quiet
shopt -s nullglob
dst="$2"
found_files=false
for x in new cur; do
- files=("$src_base"/"$src"/$x/*)
+ files=($src_base/"$src"/$x/*)
if [[ $files ]]; then
found_files=true
mv "${files[@]}" /m/md/"$dst"/$x
# figure out if that is the same speed, or if we can make it faster.
#mu index &>/dev/null ||:
fi
+
+
+# qemu-devel is our biggest list by far, so occasionally
+# I want to hop into conversations about our mailing
+# systems there, but I don't need many old messages.
+find /nocow/user/fsfmd/l/qemu-devel/new -type f -mtime +14 -execdir rm -- '{}' +
+
+find /nocow/user/fsfmd/{sec,Spam,Drafts,{rtcc,sysadmin,l/outreachy-mentors}/new} -type f -mtime +100 -execdir rm -- '{}' +
+
+find /nocow/user/fsfmd/log -type f -mtime +300 -execdir rm -- '{}' +
+
+
+# delete based on http://deflexion.com/2006/05/imap-way-of-deleting-message
+sieve-filter -eW -o mail_location=maildir:/nocow/user/fsfmd:LAYOUT=fs:INBOX=/nocow/user/fsfmd/INBOX ~/sieve/fsf.sieve INBOX delete &>>/tmp/fsfsieve.log
+
+# to test new rules, update fsf-test.sieve, run these commands, then copy new fsf-test.sieve to fsf.sieve
+# sieve-filter -o mail_location=maildir:/nocow/user/fsfmd:LAYOUT=fs:INBOX=/nocow/user/fsfmd/INBOX ~/sieve/fsf-test.sieve INBOX &>/tmp/testfsfsieve.log
+# sed -rn '/^Performed actions:/{n;n;p}' /tmp/testfsfsieve.log | sort -u
trash-cli
cryptsetup
lvm2
+ mbuffer
+ screen
)
p2=(
# 2nd
rdiff-backup
ruby
ruby-rest-client
+ traceroute
tree
vim
wcd
# guvcview also adjusts webcam
# pv is used by btrbk
# libterm-readkey-perl for rt cli tool
+# fonts pkgs are an attempt to get less block characters
p4=(
adb
apache2
apt-listchanges
apt-rdepends
aptitude-doc-en
+ asciidoc
+ backupninja
bash-doc
beets
beets-doc
cloc
cpulimit
cron
+ debian-archive-keyring
debootstrap
debconf-doc
dirmngr
feh
filelight
flashrom
+ fonts-noto
+ fonts-roboto
+ fonts-thai-tlwg
+ fonts-thai-tlwg-otf
+ xfonts-intl-asian
+ fonts-sil-lateef
gawk-doc
gcc-doc
gdb
geoip-bin
git-doc
git-email
+ git-svn
gitk
glibc-doc
goaccess
gnome-screenshot
+ gnupg-doc
guvcview
i3lock
- inetutils-traceroute
+ iputils-tracepath
iperf3
iproute2-doc
jq
mpv
mumble
nagstamon
+ needrestart
ncdu
nginx-doc
nmap
pianobar
pidgin
pidgin-otr
+ pip
pry
pv
python-autopep8
rng-tools
sakura
schroot
+ sig2dot
+ sipcalc
sqlite3-doc
squashfs-tools
strace
telnet
transmission-remote-gtk
vlc
+ w3m
whois
wondershaper
xawtv
xbacklight
+ xdot
+ xloadimage
xprintidle
xscreensaver
xscreensaver-data-extra
# davdroid from f-druid.
# login with url and user name
-# url https://cal.iankelling.org
+# url https://cal.iankelling.org/ian
# username ian
-# pass, see password manager
+# pass, see password manager for radicale
#
# add account dialog:
#
[d]
loop-file=inf
shuffle
+#vo=gpu
# because something keeps deleting that directory
# default keyserver
-keyserver hkp://pool.sks-keyservers.net
\ No newline at end of file
+#
+#keyserver hkp://pgp.mit.edu
+# this one seems more reliable, but it's down now
+keyserver hkp://pool.sks-keyservers.net
+
+# more secure, but had problems with my gpg version
+#keyserver hkps://hkps.pool.sks-keyservers.net
-- primary firefox profile here. I'd rather have a command which
-- sets which is the pimary for opening links. It could alter a file,
-- and we could launch firefox with a wrapper script which looks at that file.
- , ((modm, xK_3), spawn "firefox -P sfw")
- , ((modm, xK_4), spawn "firefox -no-remote -P firefox-main-profile")
+ , ((modm, xK_3), spawn "abrowser -P sfw")
+ , ((modm, xK_4), spawn "abrowser -no-remote -P firefox-main-profile")
, ((modm, xK_5), spawn "/a/exe/input-setup l")
, ((modm, xK_1), spawn "/a/exe/input-setup k")
if anyof (
address :is "from" "sysadmin@gnu.org",
+ address :is "from" "sysadmin-nonrt@gnu.org",
address :is "to" "sysadmin-nonrt@gnu.org",
address :is "from" "sysadmin-comment@gnu.org"
) {
stop;
}
+if anyof (
+ header :contains "list-id" "<mentors.lists.outreachy.org>"
+ ) {
+ fileinto :create "l/outreachy-mentors";
+ stop;
+ }
+
if anyof (
header :contains "list-id" "<bbdb-info.lists.sourceforge.net>",
header :contains "list-id" "<bug-bash.gnu.org>",
header :contains "list-id" "<activists_masspirates.org.lists.mayfirst.org>",
header :contains "list-id" "<gnu-prog-discuss.gnu.org>",
header :contains "list-id" "<gnu-prog.gnu.org>",
- header :contains "list-id" "<discuss.blu.org>"
+ header :contains "list-id" "<gnu-community-private.gnu.org>",
+ header :contains "list-id" "<gvc.gnu.org>",
+ header :contains "list-id" "<discuss.blu.org>",
+ header :contains "list-id" "<Spdx-tech.lists.spdx.org>",
+ header :contains "list-id" "<Spdx-legal.lists.spdx.org>",
+ header :contains "list-id" "<info-gnu.gnu.org>",
+ header :contains "from" "<general-info@artisansasylum.com>",
+ header :contains "list-id" "<spdx.lists.spdx.org>"
+
) {
fileinto :create "community";
stop;
echo | $wrt_shell cedit mail_host /etc/hosts || [[ $? == 1 ]] # 1 means file changed.
else
$wrt_shell bash -s <<EOFOUTER
- cedit mail_host /etc/hosts <<EOF || /etc/init.d/dnsmasq restart
+ if ! cedit mail_host /etc/hosts <<EOF; then
\$(grep "\b$new_host\b" /etc/hosts | awk '{print \$1}') mail.iankelling.org
EOF
+/etc/init.d/dnsmasq restart
EOFOUTER
fi
# this pulls from host $1 to the current host.
# not currently used, but it might be useful at some point
-source /a/bin/errhandle/errcatch-function
-source /a/bin/errhandle/bash-trace-function
-errcatch
+source /a/bin/errhandle/err
cd /