From b6ae2318e3f7d5312fda72ca91c64c4173cc3a32 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Thu, 11 Nov 2021 11:44:26 -0600 Subject: [PATCH] Improve backup scripts --- common/bin/backupify | 10 ++++++++-- common/bin/unbackupify | 15 ++++++++++++++- common/neovim/coc-settings.json | 7 +------ common/neovim/lua/keymap.lua | 4 +++- os/linux/sway/config | 1 + 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/common/bin/backupify b/common/bin/backupify index 16e45ab..1623895 100755 --- a/common/bin/backupify +++ b/common/bin/backupify @@ -33,12 +33,18 @@ pushd (dirname $target) >/dev/null set remote_path "$BACKUP_REMOTE_DIR/$backup_file_name$BACKUP_FILE_EXT" echo "Streaming PGP encrypted backup of $friendly_target to SSH host $BACKUP_REMOTE_HOST at $remote_path" - ssh $BACKUP_REMOTE_HOST "mkdir -p $BACKUP_REMOTE_DIR" + ssh $BACKUP_REMOTE_HOST "mkdir -p $BACKUP_REMOTE_DIR" || begin + echo "Failed to SSH to $BACKUP_REMOTE_HOST and create remote dir $BACKUP_REMOTE_DIR" + exit 3 + end # TODO: progress indicator? tar cf - . | zstd --ultra -T2 -22 | gpg --encrypt --recipient daniel@lyte.dev | - ssh $BACKUP_REMOTE_HOST "cat - > $remote_path" + ssh $BACKUP_REMOTE_HOST "cat - > $remote_path" || begin + echo "Failed to stream backup" + exit 4 + end popd >/dev/null # TODO: checksum? diff --git a/common/bin/unbackupify b/common/bin/unbackupify index aa05137..bfd2c20 100755 --- a/common/bin/unbackupify +++ b/common/bin/unbackupify @@ -21,6 +21,16 @@ else if test (count $argv) -lt 1 exit 1 end +ssh $BACKUP_REMOTE_HOST "echo 1" &>/dev/null || begin + echo "Cannot ssh to $BACKUP_REMOTE_HOST" + exit 6 +end + +ssh $BACKUP_REMOTE_HOST "test -d $BACKUP_REMOTE_DIR/$target" || begin + echo "Remote directory $BACKUP_REMOTE_DIR/$target does not exist on $BACKUP_REMOTE_HOST (use --list-backup-files to show)" + exit 5 +end + # TODO: autocomplete? # TODO: checksum? # TODO: progress indicator? @@ -36,7 +46,10 @@ pushd $local_dir >/dev/null ssh $BACKUP_REMOTE_HOST "cat $BACKUP_REMOTE_DIR/$target" | gpg --decrypt 2>/dev/null | zstd --ultra -T2 -22 -dc | - tar -xf - + tar -xf - || begin + echo "Failed to stream backup" + exit 4 + end popd >/dev/null diff --git a/common/neovim/coc-settings.json b/common/neovim/coc-settings.json index f2edd32..e2cbd22 100644 --- a/common/neovim/coc-settings.json +++ b/common/neovim/coc-settings.json @@ -4,15 +4,10 @@ "nim": { "command": "nimlsp", "filetypes": ["nim"] - }, - "arduino": { - "command":"/home/daniel/.home/.go/bin/arduino-language-server", - "rootPatterns":["*.ino"], - "filetypes":["arduino"], - "args":["-cli", "/usr/bin/arduino-cli", "-clangd", "/usr/bin/clangd", "-cli-config", "/path/to/arduino-cli.yaml"] } }, "elixir.pathToElixirLS": "~/.elixir-ls/release/language_server.sh", + "rust-analyzer.checkOnSave.command": "clippy", "diagnostic-languageserver.filetypes": { "elixir": ["mix_credo", "mix_credo_compile"], "eelixir": ["mix_credo", "mix_credo_compile"] diff --git a/common/neovim/lua/keymap.lua b/common/neovim/lua/keymap.lua index 7db7ec9..aa228b7 100644 --- a/common/neovim/lua/keymap.lua +++ b/common/neovim/lua/keymap.lua @@ -25,7 +25,9 @@ local keymap = { [''] = ':TmuxNavigateRight', [' n'] = "'Nn'[v:searchforward]", [' N'] = "'nN'[v:searchforward]", - [''] = ':lua SynGroup()' + [''] = ':lua SynGroup()', + ['g]'] = '(coc-diagnostic-next)', + ['g['] = '(coc-diagnostic-prev)', }, t = {}, [''] = { diff --git a/os/linux/sway/config b/os/linux/sway/config index e1e7353..9f712f8 100644 --- a/os/linux/sway/config +++ b/os/linux/sway/config @@ -176,6 +176,7 @@ bar { } exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway +exec systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP exec mako exec pipewire exec /usr/lib/kdeconnectd