From bc755776edfd25cb1dae9cf9a342ac95833301e0 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Fri, 13 Feb 2026 17:50:41 -0500 Subject: [PATCH] mainly fixes --- .mailcap | 2 +- brc | 55 ++++++++++++++----- distro-begin | 2 +- distro-end | 6 -- filesystem/usr/local/bin/ikclip | 26 --------- filesystem/usr/local/bin/ssh-askpass-hack | 3 + .../usr/share/applications/ikclip.desktop | 4 +- .../frodo/filesystem/etc/btrbk/f2.conf | 18 ++++++ .../etc/systemd/system/btrbkf2.service | 7 +++ .../etc/systemd/system/btrbkf2.timer | 8 +++ mymimes | 3 - 11 files changed, 80 insertions(+), 54 deletions(-) delete mode 100755 filesystem/usr/local/bin/ikclip create mode 100644 machine_specific/frodo/filesystem/etc/btrbk/f2.conf create mode 100644 machine_specific/frodo/filesystem/etc/systemd/system/btrbkf2.service create mode 100644 machine_specific/frodo/filesystem/etc/systemd/system/btrbkf2.timer diff --git a/.mailcap b/.mailcap index e0e4a99..9151126 100644 --- a/.mailcap +++ b/.mailcap @@ -1,2 +1,2 @@ -# google mailcap for more info. text/plain; g '%s'; edit=g '%s'; compose=g '%s'; needsterminal +inode/directory; ikclip %s; diff --git a/brc b/brc index 0b5b6f7..72f1e96 100644 --- a/brc +++ b/brc @@ -348,7 +348,6 @@ mysrc /a/c/fsf-script-lib mysrc /a/bin/small-misc-bash/ll-function mysrc /a/bin/distro-functions/src/package-manager-abstractions mysrc /a/bin/fai/fai/config/distro-install-common/bash-misc-funcs -mysrc /a/c/fzf-brc @@ -1735,6 +1734,14 @@ faf() { -o -name .undo-tree-history -prune \) \! -type d 2>/dev/null } +# like faf, but sort by modification time. like lt() +faft() { + find "$@" -not \( -name .svn -prune -o -name .git -prune \ + -o -name .hg -prune -o -name .editor-backups -prune \ + -o -name .undo-tree-history -prune \) \! -type d \ + -printf "%T@ %P\n" | sort -n | cut -d' ' -f2- +} + # ffmpeg concat files. # usage ffconcat FILES_TO_CONCAT OUTPUT_FILE ffconcat() { @@ -3094,19 +3101,29 @@ slowdo() { # sets $host_type, and maybe some related vars: $pre_synced, $extra_info _sl-get-host-type() { - local tmp tmp2 testbool testcmd - local -a tmpa + local f tmp tmp2 testbool testcmd + if [[ $sl_local_test_cmd ]]; then host_type=$($sl_local_test_cmd "$remote") + if [[ $host_type == skip ]]; then return; fi fi - if [[ $host_type ]]; then return; fi - tmpa=($SL_INFO_DIR/??????????-????-"$remote") - sshinfo=${tmpa[0]} + sshinfo_files=($SL_INFO_DIR/??????????-????-"$remote") + # there should only be one, but just in case, remove all but 1. + if (( ${#sshinfo_files[@]} >= 2 )); then + mq rm ${sshinfo_files[@]::${#sshinfo_files[@]}-1} + sshinfo_files=($SL_INFO_DIR/??????????-????-"$remote") + fi + sshinfo="${sshinfo_files[0]}" + + # if $verbose; then e "sshinfo: '$sshinfo'"; fi # debug if [[ -e $sshinfo ]]; then - tmp=${sshinfo[0]##*/} + tmp=${sshinfo##*/} tmp2=${tmp:11} # skip 11 chars - host_type=${tmp2%%-*} + if [[ ! $host_type ]]; then + host_type=${tmp2%%-*} + fi + if [[ $host_type == skip ]]; then return; fi extra_info=$(cat $sshinfo) ### block to see if past sync is up to date @@ -3181,10 +3198,11 @@ _sl-get-host-type() { # SL_TEST_CMD / --sl-test-cmd CMD: Env var or cli option. If set, we run # this string on the remote host the first time sl is run (or if we run -# slr). Its standard out is passed to SL_TEST_HOOK which gets run -# locally. It is meant to be used to vary the files synced depending on -# the remote host. For example, export SL_TEST_CMD=". /etc/os-release ; -# echo \${VERSION//[^a-zA-Z0-9]/}". cli option overrides env var. +# slr) and there is no SL_LOCAL_TEST_CMD. Its standard out is passed to +# SL_TEST_HOOK which gets run locally. It is meant to be used to vary +# the files synced depending on the remote host. For example, export +# SL_TEST_CMD=". /etc/os-release ; echo \${VERSION//[^a-zA-Z0-9]/}". cli +# option overrides env var. The internal var is "extra_info". # SL_TEST_HOOK / --sl-test-hook HOOK: Env var or cli option. See SL_TEST_CMD # above. It is run unquoted (with expansion). This can set $SL_FILES_DIR @@ -3226,7 +3244,7 @@ sl() { local verbose now args remote sshinfo tmp host_type info_sec force_rsync local sync_dirname extra_info files_sec sl_test_cmd sl_test_hook pre_synced local sl_rsync_cmd sl_test_cmd sl_test_hook sl_local_test_cmd - local -a args + local -a args sshinfo_files args=($SL_SSH_ARGS) @@ -3286,6 +3304,7 @@ sl() { esac shift done + # verbose=true # debug while [[ $1 ]]; do case "$1" in @@ -3327,7 +3346,7 @@ sl() { pre_synced=false _sl-get-host-type - if [[ $sl_test_hook ]]; then + if [[ $sl_test_hook && $extra_info ]]; then mq RSYNC_RSH="ssh ${args[*]}" $sl_test_hook "$extra_info" "$remote" fi @@ -3339,11 +3358,14 @@ sl() { if [[ $host_type == sync ]] && ! $pre_synced; then m RSYNC_RSH="ssh ${args[*]}" $sl_rsync_cmd -rptL --delete $SL_FILES_DIR "$remote": - + mq rm-maybe "$sshinfo" sshinfo=$SL_INFO_DIR/$EPOCHSECONDS-$host_type-"$remote" [[ -e $SL_INFO_DIR ]] || mkdir -p $SL_INFO_DIR printf "%s\n" "$extra_info" >$sshinfo chmod 666 $sshinfo + if $verbose; then + m ls -la $sshinfo + fi fi if [[ $host_type == sync ]]; then @@ -4742,6 +4764,9 @@ if ! type -p fzf &>/dev/null; then fi fi +# in fzf-brc, _fzf_handle_dynamic_completion is returning 1. +err_catch_ignore+=( '*/fzf-brc' ) +mysrc /a/c/fzf-brc # ensure no bad programs appending to this file will have an affect return 0 diff --git a/distro-begin b/distro-begin index 9e7e01f..0bc240c 100755 --- a/distro-begin +++ b/distro-begin @@ -597,7 +597,7 @@ mnt-fstab() { case $HOSTNAME in $d_host) sudo /a/exe/teeu /etc/fstab <<'EOF' -/dev/mapper/crypt_dev_ata-Samsung_SSD_870_QVO_8TB_S5VUNG0N900656V-part6 /d btrfs nofail,x-systemd.device-timeout=30s,x-systemd.mount-timeout=30s,noatime,compress=zstd,subvol=d 0 0 +/mnt/rbackup/d /d none bind 0 0 /d/m /i none bind,compress=zstd 0 0 EOF if ! mountpoint /d &>/dev/null; then diff --git a/distro-end b/distro-end index 85d1a65..cad9622 100755 --- a/distro-end +++ b/distro-end @@ -1258,12 +1258,6 @@ if mountpoint /p &>/dev/null; then # this guesses at the appropriate directory, adjust if needed perldir=(/usr/lib/x86_64-linux-gnu/perl/5.*) m sudo ln -sf ../../../perl/5.18.2/SPD/ ${perldir[0]} - # newer distro had gpg2 as default, older one, flidas, need to make it that way - gpgpath=$(which gpg2) ||: - if [[ $gpgpath ]]; then - sudo mkdir -p /usr/local/spdhackfix - s lnf -T $gpgpath /usr/local/spdhackfix/gpg - fi fi ### end spd install diff --git a/filesystem/usr/local/bin/ikclip b/filesystem/usr/local/bin/ikclip deleted file mode 100755 index 50d428d..0000000 --- a/filesystem/usr/local/bin/ikclip +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# I, Ian Kelling, follow the GNU license recommendations at -# https://www.gnu.org/licenses/license-recommendations.en.html. They -# recommend that small programs, < 300 lines, be licensed under the -# Apache License 2.0. This file contains or is part of one or more small -# programs. If a small program grows beyond 300 lines, I plan to change -# to a recommended GPL license. - -# Copyright 2024 Ian Kelling - -# 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 - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -printf "%s" "$*" >> /tmp/ikclip.log -# both! -printf "%s" "$*" | xclip -printf "%s" "$*" | xclip -selection clipboard diff --git a/filesystem/usr/local/bin/ssh-askpass-hack b/filesystem/usr/local/bin/ssh-askpass-hack index d6554bc..568cd47 100755 --- a/filesystem/usr/local/bin/ssh-askpass-hack +++ b/filesystem/usr/local/bin/ssh-askpass-hack @@ -22,6 +22,9 @@ if [[ ! $DISPLAY ]]; then if [[ $RSYNC_SSH_DISPLAY_HACK ]]; then + if [[ $VERBOSE && $VERBOSE != false ]]; then + echo export "DISPLAY=$RSYNC_SSH_DISPLAY_HACK" + fi export "DISPLAY=$RSYNC_SSH_DISPLAY_HACK" fi fi diff --git a/filesystem/usr/share/applications/ikclip.desktop b/filesystem/usr/share/applications/ikclip.desktop index dfca0b9..7c65411 100644 --- a/filesystem/usr/share/applications/ikclip.desktop +++ b/filesystem/usr/share/applications/ikclip.desktop @@ -1,12 +1,12 @@ #!/usr/bin/env xdg-open -# copied from emacsmail and gwenview [Desktop Entry] Version=1.0 Type=Application Terminal=false Name[en]=ikclip -Exec=/usr/local/bin/ikclip %u +Exec=/usr/local/bin/ikclip %U Name=ikclip Categories=Office;Network;Email;Graphics;Viewer;Photography; MimeType=inode/directory;image/avif;image/gif;image/heif;image/jpeg;image/jxl;image/png;image/bmp;image/x-eps;image/x-icns;image/x-ico;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-xbitmap;image/x-xpixmap;image/tiff;image/x-psd;image/x-webp;image/webp;image/x-tga;image/x-xcf;application/x-krita;image/x-kde-raw;image/x-canon-cr2;image/x-canon-crw;image/x-kodak-dcr;image/x-adobe-dng;image/x-kodak-k25;image/x-kodak-kdc;image/x-minolta-mrw;image/x-nikon-nef;image/x-olympus-orf;image/x-pentax-pef;image/x-fuji-raf;image/x-panasonic-rw;image/x-sony-sr2;image/x-sony-srf;image/x-sigma-x3f;image/x-sony-arw;image/x-panasonic-rw2 NoDisplay=false +InitialPreference=40 diff --git a/machine_specific/frodo/filesystem/etc/btrbk/f2.conf b/machine_specific/frodo/filesystem/etc/btrbk/f2.conf new file mode 100644 index 0000000..ba81c58 --- /dev/null +++ b/machine_specific/frodo/filesystem/etc/btrbk/f2.conf @@ -0,0 +1,18 @@ +transaction_syslog local7 + +lockfile /var/lock/btrbk-f2.lock + +timestamp_format long-iso + +snapshot_create onchange + +snapshot_preserve 18h 14d 8w 12m +snapshot_preserve_min 2d +snapshot_dir btrbk + +target_preserve 18h 14d 8w 12m +target_preserve_min 2d + +rate_limit no +volume /mnt/f2 +subvolume ro2 diff --git a/machine_specific/frodo/filesystem/etc/systemd/system/btrbkf2.service b/machine_specific/frodo/filesystem/etc/systemd/system/btrbkf2.service new file mode 100644 index 0000000..894a35c --- /dev/null +++ b/machine_specific/frodo/filesystem/etc/systemd/system/btrbkf2.service @@ -0,0 +1,7 @@ +[Unit] +Description=Btrbk to f2 +After=multi-user.target + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/sysd-mail-once btrbkf2 btrbk -c /etc/btrbk/f2.conf run diff --git a/machine_specific/frodo/filesystem/etc/systemd/system/btrbkf2.timer b/machine_specific/frodo/filesystem/etc/systemd/system/btrbkf2.timer new file mode 100644 index 0000000..d026fbc --- /dev/null +++ b/machine_specific/frodo/filesystem/etc/systemd/system/btrbkf2.timer @@ -0,0 +1,8 @@ +[Unit] +Description=Btrbk f2 timer + +[Timer] +OnCalendar=*-*-* 13:00:00 America/New_York + +[Install] +WantedBy=timers.target diff --git a/mymimes b/mymimes index 760b56c..af06e43 100755 --- a/mymimes +++ b/mymimes @@ -44,8 +44,5 @@ echo x-scheme-handler/mailto=emacsmail.desktop >>/etc/xdg/defaults.list # https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html cp /etc/xdg/defaults.list /etc/xdg/mimeapps.list -for f in /usr/share/applications/!(defaults).list; do - cp /etc/xdg/defaults.list /etc/xdg/${f##*/} -done update-desktop-database -- 2.30.2