}
# mail related
# shellcheck disable=SC2120 # we expect to pass arguments in use outside this file
-etail() {
+etailbg() {
ngset
ta /var/log/exim4/mainlog /var/log/exim4/*main /var/log/exim4/paniclog /var/log/exim4/*panic -n 200 "$@"
ngreset
}
-etailm() {
- ta /var/log/exim4/mainlog -n 200 "$@"
+
+etail() {
+ tail -F /var/log/exim4/mainlog /var/log/exim4/*main /var/log/exim4/paniclog /var/log/exim4/*panic -n 200 "$@"
+ }
+etail1() {
+ tail -F /var/log/exim4/mainlog -n 200 "$@"
}
etail2() {
- ta /var/log/exim4/nonnmain -n 200 "$@"
+ tail -F /var/log/exim4/nonnmain -n 200 "$@"
}
+
# shortcut for tail -F + highlighting if we have it.
tailf() {
if type -t batcat >/dev/null; then
for f in $(awk '{print $1}' /etc/crypttab | grep -v '#'); do
m cryptdisks_start $f
done
- }
+}
# note: this is incomplete and untested.
# https://wiki.archlinux.org/index.php/Install_Arch_Linux_from_existing_Linux#Creating_a_chroot
m sl mail.fsf.org pull-iankfsf
fi
}
+
+
+dummy-pkg() {
+ local ver="$1"
+ local pkg="$2"
+ if ! pcheck $pkg; then
+ e "warning: this will overwrite an installed package"
+ fi
+ local tmpdir="$(mktemp -d)"
+ # it puts the deb in .., so use a subdir to stay contained
+ mkdir $tmpdir/sub
+ cd "$tmpdir/sub"
+ # edited from output of equivs-control ubuntu-system-adjustments
+ cat >$pkg <<EOF
+Section: misc
+Priority: optional
+Version: $ver
+Standards-Version: 3.9.2
+Package: $pkg
+Description: $pkg-dummy
+EOF
+ equivs-build $pkg
+ sudo dpkg -i /tmp/user/$EUID/${pkg}_${ver}_all.deb
+ cd
+ rm -r "$tmpdir"
+}
[[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@"
-set -e; . /usr/local/lib/bash-bear; set +e
+source /a/c/fsf-script-lib
# inspired from
# https://github.com/kdave/btrfsmaintenance
dusage="5 10"
musage="5"
-e() {
- echo "btrfsmaint: $*"
- if ! $dryrun; then
- "$@"
- fi
-}
-
check-idle() {
type -p xscreensaver-command &>/dev/null || return 0
export XAUTHORITY=/home/iank/.Xauthority
nonidle user and run in a loop every 20 seconds for 10
minutes.
---dryrun Just print out what we would do.
+--dry_run Just print out what we would do.
--force Run regardless of user idle status on all disks and do scrub
regardless of when it was last run.
[[ $ret == 4 ]] || { echo "Install util-linux for enhanced getopt" >&2; exit 1; }
check=false
-dryrun=false
+dry_run=false
force=false
stats=true
-temp=$(getopt -l help,check,dryrun,force,no-stats h "$@") || usage 1
+temp=$(getopt -l help,check,dry_run,force,no-stats h "$@") || usage 1
eval set -- "$temp"
while true; do
case $1 in
--check) check=true ;;
- --dryrun) dryrun=true ;;
+ --dry_run) dry_run=true ;;
--force) force=true ;;
--no-stats) stats=false ;;
-h|--help) usage ;;
esac
shift
done
-readonly check dryrun force stats
+readonly check dry_run force stats
##### end command line parsing ########
if $check; then
if ! $locked; then
- if $dryrun; then
+ if $dry_run; then
echo "$0: not idle. if this wasnt a dry run, btrfs scrub cancel $mnt"
else
+ echo "btrfsmaint: canceling scrub of $mnt"
btrfs scrub cancel $mnt &>/dev/null ||:
fi
fi
# e df -H $mnt
if btrfs filesystem df $mnt | grep -q "Data+Metadata"; then
for usage in $dusage; do
- e ionice -c 3 btrfs balance start -dusage=$usage -musage=$usage $mnt
+ dr ionice -c 3 btrfs balance start -dusage=$usage -musage=$usage $mnt
done
else
- e ionice -c 3 btrfs balance start -dusage=0 $mnt
+ dr ionice -c 3 btrfs balance start -dusage=0 $mnt
for usage in $dusage; do
- e ionice -c 3 btrfs balance start -dusage=$usage $mnt
+ dr ionice -c 3 btrfs balance start -dusage=$usage $mnt
done
- e ionice -c 3 btrfs balance start -musage=0 $mnt
+ dr ionice -c 3 btrfs balance start -musage=0 $mnt
for usage in $musage; do
- e ionice -c 3 btrfs balance start -musage=$usage $mnt
+ dr ionice -c 3 btrfs balance start -musage=$usage $mnt
done
fi
date=
)
fi
if ! $force && [[ $date ]]; then
- if $dryrun; then
+ if $dry_run; then
echo "$0: last scrub finish for $mnt: $date"
fi
date=$(date --date="$date" +%s)
# the wiki recommends 30 days or so, but
# I'm going with 60 days.
if (( date > EPOCHSECONDS - 60*60*24*60 )); then
- if $dryrun; then
+ if $dry_run; then
echo "$0: skiping scrub of $mnt, last was $(( (EPOCHSECONDS - date) / 60/60/24 )) days ago, < 30 days"
fi
continue
fi
fi
# btrfsmaintenance does -c 2 -n 4, but I want lowest pri.
- e btrfs scrub start -Bd -c 3 $mnt
+ dr btrfs scrub start -Bd -c 3 $mnt
# We normally only do one disk since this is meant to be run in
# downtime and if we try to do all disks, we invariably end up doing
- # a scrub after downtime. So, just do one disk per day.
+xc # a scrub after downtime. So, just do one disk per day.
if ! $force; then
return 0
fi
m() { printf "$pre %s\n" "$*"; "$@"; }
e() { printf "$pre %s\n" "$*"; }
-dummy-pkg() {
- ver="$1"
- pkg="$2"
- if ! pcheck $pkg; then
- return 0
- fi
- tmpdir="$(mktemp -d)"
- # it puts the deb in .., so use a subdir to stay contained
- mkdir $tmpdir/sub
- cd "$tmpdir/sub"
- # edited from output of equivs-control ubuntu-system-adjustments
- cat >$pkg <<EOF
-Section: misc
-Priority: optional
-Version: $ver
-Standards-Version: 3.9.2
-Package: $pkg
-Description: $pkg-dummy
-EOF
- equivs-build $pkg
- sudo dpkg -i /tmp/user/$EUID/${pkg}_${ver}_all.deb
- cd
- rm -r "$tmpdir"
-}
distro=$(distro-name)
codename=$(debian-codename)
##### postgres #####
-case $HOSTNAME in
- frodo)
- # based on https://www.postgresql.org/download/linux/ubuntu/
- if [[ ! -e /etc/apt/sources.list.d/pgdg.sources ]]; then
- pi postgresql-common
- sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y noble
- pi postgresql-17
- sudo -u postgres createuser -d iank
- sudo usermod -a -G postgres iank
- fi
- ;;
-esac
+ver=18
+if [[ $HOSTNAME == frodo ]]; then
+ ver=17
+fi
+# based on https://www.postgresql.org/download/linux/ubuntu/
+if [[ ! -e /etc/apt/sources.list.d/pgdg.sources ]]; then
+ pi postgresql-common
+ sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y noble
+ pi-nostart postgresql-$ver
+ # when we run it, do:
+ #sudo -u postgres createuser -d iank
+ sudo usermod -a -G postgres iank
+fi
#####
fi
# we may be booted into a bootstrap fs or something
- min_root_kb=$(( 1024 * 1024 * 70 )) # 70 gb
+ min_root_kb=$(( 1024 * 1024 * 70 )) # 70 gb
tmp=$(( root_size < min_root_kb ))
if (( tmp )); then
e "warning: $h: root_size=$root_size < 200gb, perhaps it is booted to bootstrap vol. skipping for now"
#
# Run COMMAND if not $dry_run == true, in that case print it.
dr() {
+ local dr_pre
if [[ $dry_run == true ]]; then
+ if [[ $pre ]]; then
+ dr_pre="$pre"
+ elif [[ $script_name ]]; then
+ dr_pre="$script_name:"
+ elif [[ $- != *i* ]]; then
+ dr_pre="${0##*/}:"
+ fi
+ if [[ $dr_pre ]]; then
+ printf "%s " "$dr_pre"
+ fi
printf "%s\n" "$*"
else
"$@"
[Service]
Type=oneshot
-ExecStart=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns -n 10.174.29 start %i
-# no need to stop
-#ExecStop=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns stop %i
+ExecStart=/usr/bin/flock -w 20 /tmp/newns.flock /usr/local/bin/newns/newns -n 10.174.29 start %i
+ExecStop=/usr/bin/flock -w 20 /tmp/newns.flock /usr/local/bin/newns/newns stop %i
RemainAfterExit=yes
[Install]
Description=WireGuard via wg-quick(8) for %I
After=network-online.target nss-lookup.target wg-quick-tr-pre@%i.service
Wants=network-online.target nss-lookup.target wg-quick-tr-pre@%i.service
-PartOf=wg-quick.target
Documentation=man:wg-quick(8)
Documentation=man:wg(8)
ExecStopPost=/usr/sbin/ip r del 10.8.0.0/24 via 10.174.29.1 dev veth1-client
NetworkNamespacePath=/var/run/netns/%i
BindReadOnlyPaths=/etc/tr-resolv:/run/systemd/resolve:norbind /etc/basic-nsswitch:/etc/resolved-nsswitch:norbind
+# copied from wg-quick@.service
+Environment=WG_ENDPOINT_RESOLUTION_RETRIES=infinity
[Install]
WantedBy=multi-user.target
[Service]
Type=oneshot
-ExecStart=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns -n 10.174.34 start %i
-# no need to stop
-#ExecStop=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns stop %i
+ExecStart=/usr/bin/flock -w 20 /tmp/newns.flock /usr/local/bin/newns/newns -n 10.174.34 start %i
+ExecStop=/usr/bin/flock -w 20 /tmp/newns.flock /usr/local/bin/newns/newns stop %i
RemainAfterExit=yes
[Install]
Description=WireGuard via wg-quick(8) for %I
After=network-online.target nss-lookup.target wg-quick-tr-pre@%i.service
Wants=network-online.target nss-lookup.target wg-quick-tr-pre@%i.service
-PartOf=wg-quick.target
Documentation=man:wg-quick(8)
Documentation=man:wg(8)
ExecStopPost=/usr/sbin/ip r del 10.8.0.0/24 via 10.174.34.1 dev veth1-client
NetworkNamespacePath=/var/run/netns/%i
BindReadOnlyPaths=/etc/tr-resolv:/run/systemd/resolve:norbind /etc/basic-nsswitch:/etc/resolved-nsswitch:norbind
+# copied from wg-quick@.service
+Environment=WG_ENDPOINT_RESOLUTION_RETRIES=infinity
[Install]
WantedBy=multi-user.target
[Service]
Type=oneshot
-ExecStart=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns -n 10.174.2 start %i
-# no need to stop
-#ExecStop=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns stop %i
+ExecStart=/usr/bin/flock -w 20 /tmp/newns.flock /usr/local/bin/newns/newns -n 10.174.2 start %i
+ExecStop=/usr/bin/flock -w 20 /tmp/newns.flock /usr/local/bin/newns/newns stop %i
RemainAfterExit=yes
[Install]
Description=WireGuard via wg-quick(8) for %I
After=network-online.target nss-lookup.target wg-quick-tr-pre@%i.service
Wants=network-online.target nss-lookup.target wg-quick-tr-pre@%i.service
-PartOf=wg-quick.target
Documentation=man:wg-quick(8)
Documentation=man:wg(8)
ExecStopPost=/usr/sbin/ip r del 10.8.0.0/24 via 10.174.2.1 dev veth1-client
NetworkNamespacePath=/var/run/netns/%i
BindReadOnlyPaths=/etc/tr-resolv:/run/systemd/resolve:norbind /etc/basic-nsswitch:/etc/resolved-nsswitch:norbind
+# copied from wg-quick@.service
+Environment=WG_ENDPOINT_RESOLUTION_RETRIES=infinity
[Install]
WantedBy=multi-user.target
[Service]
Type=oneshot
-ExecStart=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns -n 10.174.97 start %i
-# no need to stop
-#ExecStop=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns stop %i
+ExecStart=/usr/bin/flock -w 20 /tmp/newns.flock /usr/local/bin/newns/newns -n 10.174.97 start %i
+ExecStop=/usr/bin/flock -w 20 /tmp/newns.flock /usr/local/bin/newns/newns stop %i
RemainAfterExit=yes
[Install]
Description=WireGuard via wg-quick(8) for %I
After=network-online.target nss-lookup.target wg-quick-tr-pre@%i.service
Wants=network-online.target nss-lookup.target wg-quick-tr-pre@%i.service
-PartOf=wg-quick.target
Documentation=man:wg-quick(8)
Documentation=man:wg(8)
ExecStopPost=/usr/sbin/ip r del 10.8.0.0/24 via 10.174.97.1 dev veth1-client
NetworkNamespacePath=/var/run/netns/%i
BindReadOnlyPaths=/etc/tr-resolv:/run/systemd/resolve:norbind /etc/basic-nsswitch:/etc/resolved-nsswitch:norbind
+# copied from wg-quick@.service
+Environment=WG_ENDPOINT_RESOLUTION_RETRIES=infinity
[Install]
WantedBy=multi-user.target
[Service]
Type=oneshot
-ExecStart=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns -n 10.174.99 start %i
-# no need to stop
-#ExecStop=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns stop %i
+ExecStart=/usr/bin/flock -w 20 /tmp/newns.flock /usr/local/bin/newns/newns -n 10.174.99 start %i
+ExecStop=/usr/bin/flock -w 20 /tmp/newns.flock /usr/local/bin/newns/newns stop %i
RemainAfterExit=yes
[Install]
Description=WireGuard via wg-quick(8) for %I
After=network-online.target nss-lookup.target wg-quick-tr-pre@%i.service
Wants=network-online.target nss-lookup.target wg-quick-tr-pre@%i.service
-PartOf=wg-quick.target
Documentation=man:wg-quick(8)
Documentation=man:wg(8)
ExecStopPost=/usr/sbin/ip r del 10.8.0.0/24 via 10.174.99.1 dev veth1-client
NetworkNamespacePath=/var/run/netns/%i
BindReadOnlyPaths=/etc/tr-resolv:/run/systemd/resolve:norbind /etc/basic-nsswitch:/etc/resolved-nsswitch:norbind
+# copied from wg-quick@.service
+Environment=WG_ENDPOINT_RESOLUTION_RETRIES=infinity
[Install]
WantedBy=multi-user.target
[Service]
Type=oneshot
-ExecStart=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns -n 10.174.3 start %i
-# no need to stop
-#ExecStop=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns stop %i
+ExecStart=/usr/bin/flock -w 20 /tmp/newns.flock /usr/local/bin/newns/newns -n 10.174.3 start %i
+ExecStop=/usr/bin/flock -w 20 /tmp/newns.flock /usr/local/bin/newns/newns stop %i
RemainAfterExit=yes
[Install]
Description=WireGuard via wg-quick(8) for %I
After=network-online.target nss-lookup.target wg-quick-tr-pre@%i.service
Wants=network-online.target nss-lookup.target wg-quick-tr-pre@%i.service
-PartOf=wg-quick.target
Documentation=man:wg-quick(8)
Documentation=man:wg(8)
ExecStopPost=/usr/sbin/ip r del 10.8.0.0/24 via 10.174.3.1 dev veth1-client
NetworkNamespacePath=/var/run/netns/%i
BindReadOnlyPaths=/etc/tr-resolv:/run/systemd/resolve:norbind /etc/basic-nsswitch:/etc/resolved-nsswitch:norbind
+# copied from wg-quick@.service
+Environment=WG_ENDPOINT_RESOLUTION_RETRIES=infinity
[Install]
WantedBy=multi-user.target
[Service]
Type=oneshot
-ExecStart=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns -n 10.174.7 start %i
-# no need to stop
-#ExecStop=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns stop %i
+ExecStart=/usr/bin/flock -w 20 /tmp/newns.flock /usr/local/bin/newns/newns -n 10.174.7 start %i
+ExecStop=/usr/bin/flock -w 20 /tmp/newns.flock /usr/local/bin/newns/newns stop %i
RemainAfterExit=yes
[Install]
Description=WireGuard via wg-quick(8) for %I
After=network-online.target nss-lookup.target wg-quick-tr-pre@%i.service
Wants=network-online.target nss-lookup.target wg-quick-tr-pre@%i.service
-PartOf=wg-quick.target
Documentation=man:wg-quick(8)
Documentation=man:wg(8)
ExecStopPost=/usr/sbin/ip r del 10.8.0.0/24 via 10.174.7.1 dev veth1-client
NetworkNamespacePath=/var/run/netns/%i
BindReadOnlyPaths=/etc/tr-resolv:/run/systemd/resolve:norbind /etc/basic-nsswitch:/etc/resolved-nsswitch:norbind
+# copied from wg-quick@.service
+Environment=WG_ENDPOINT_RESOLUTION_RETRIES=infinity
[Install]
WantedBy=multi-user.target
[Service]
Type=oneshot
-ExecStart=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns -n 10.174.28 start %i
-# no need to stop
-#ExecStop=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns stop %i
+ExecStart=/usr/bin/flock -w 20 /tmp/newns.flock /usr/local/bin/newns/newns -n 10.174.28 start %i
+ExecStop=/usr/bin/flock -w 20 /tmp/newns.flock /usr/local/bin/newns/newns stop %i
RemainAfterExit=yes
[Install]
Description=WireGuard via wg-quick(8) for %I
After=network-online.target nss-lookup.target wg-quick-tr-pre@%i.service
Wants=network-online.target nss-lookup.target wg-quick-tr-pre@%i.service
-PartOf=wg-quick.target
Documentation=man:wg-quick(8)
Documentation=man:wg(8)
ExecStopPost=/usr/sbin/ip r del 10.8.0.0/24 via 10.174.28.1 dev veth1-client
NetworkNamespacePath=/var/run/netns/%i
BindReadOnlyPaths=/etc/tr-resolv:/run/systemd/resolve:norbind /etc/basic-nsswitch:/etc/resolved-nsswitch:norbind
+# copied from wg-quick@.service
+Environment=WG_ENDPOINT_RESOLUTION_RETRIES=infinity
[Install]
WantedBy=multi-user.target
[Service]
Type=oneshot
-ExecStart=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns -n 10.174.8 start %i
-# no need to stop
-#ExecStop=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns stop %i
+ExecStart=/usr/bin/flock -w 20 /tmp/newns.flock /usr/local/bin/newns/newns -n 10.174.8 start %i
+ExecStop=/usr/bin/flock -w 20 /tmp/newns.flock /usr/local/bin/newns/newns stop %i
RemainAfterExit=yes
[Install]
Description=WireGuard via wg-quick(8) for %I
After=network-online.target nss-lookup.target wg-quick-tr-pre@%i.service
Wants=network-online.target nss-lookup.target wg-quick-tr-pre@%i.service
-PartOf=wg-quick.target
Documentation=man:wg-quick(8)
Documentation=man:wg(8)
ExecStopPost=/usr/sbin/ip r del 10.8.0.0/24 via 10.174.8.1 dev veth1-client
NetworkNamespacePath=/var/run/netns/%i
BindReadOnlyPaths=/etc/tr-resolv:/run/systemd/resolve:norbind /etc/basic-nsswitch:/etc/resolved-nsswitch:norbind
+# copied from wg-quick@.service
+Environment=WG_ENDPOINT_RESOLUTION_RETRIES=infinity
[Install]
WantedBy=multi-user.target
at
adb
ansible
+ ansifilter
apache2
apache2-doc
apg
ccache
cheese
cloc
+ cmake
+ colordiff
# pretty complex config. i just setup to ignore my password managerf
# according to the docs, and C-M-v to open the main window
copyq
# was exfat-utils before aramo
exfatprogs
expect
- # for ftp upload dejagnu test
- libdate-manip-perl libemail-messageid-perl
+ ipset
+
+ ### perl section ###
+ libdate-manip-perl
+ libemail-messageid-perl
libdata-printer-perl
libautovivification-perl
libdata-types-perl
libdbd-pg-perl
libfile-libmagic-perl
libcrypt-urandom-perl
+ libb-lint-perl
+ libclass-dbi-perl
+ libclass-dbi-pg-perl
+ libdata-compare-perl
+ libdata-show-perl
+ libfile-tail-perl
+ libfile-tee-perl
+ libimage-size-perl
+ libio-tee-perl
+ libperl-critic-perl
+ libperl-dev
+ libsereal-perl
+ libsmart-comments-perl
+ libstatistics-descriptive-perl
+ perl-tk
+
+
fakeroot
fail2ban
fdupes
libreoffice
libreoffice-help-en-us
linphone-desktop
+ linux-doc
lshw
make-doc
manpages
mmdebstrap
mp3gain
mpv
+ mtools
mumble
mupdf
mutt
pass
pdfgrep
perl-doc
+ pgtop
pianobar
pinentry-tty
pinentry-gtk2
sox
# used by emacs package sqlformat with the same name.
sqlfluff
+ sqlite3
sqlite3-doc
squashfs-tools
strace