Improve backup scripts

This commit is contained in:
Daniel Flanagan 2021-11-11 11:44:26 -06:00
parent df56dc051f
commit b6ae2318e3
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
5 changed files with 27 additions and 10 deletions

View file

@ -33,12 +33,18 @@ pushd (dirname $target) >/dev/null
set remote_path "$BACKUP_REMOTE_DIR/$backup_file_name$BACKUP_FILE_EXT" 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" 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? # TODO: progress indicator?
tar cf - . | tar cf - . |
zstd --ultra -T2 -22 | zstd --ultra -T2 -22 |
gpg --encrypt --recipient daniel@lyte.dev | 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 popd >/dev/null
# TODO: checksum? # TODO: checksum?

View file

@ -21,6 +21,16 @@ else if test (count $argv) -lt 1
exit 1 exit 1
end 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: autocomplete?
# TODO: checksum? # TODO: checksum?
# TODO: progress indicator? # TODO: progress indicator?
@ -36,7 +46,10 @@ pushd $local_dir >/dev/null
ssh $BACKUP_REMOTE_HOST "cat $BACKUP_REMOTE_DIR/$target" | ssh $BACKUP_REMOTE_HOST "cat $BACKUP_REMOTE_DIR/$target" |
gpg --decrypt 2>/dev/null | gpg --decrypt 2>/dev/null |
zstd --ultra -T2 -22 -dc | zstd --ultra -T2 -22 -dc |
tar -xf - tar -xf - || begin
echo "Failed to stream backup"
exit 4
end
popd >/dev/null popd >/dev/null

View file

@ -4,15 +4,10 @@
"nim": { "nim": {
"command": "nimlsp", "command": "nimlsp",
"filetypes": ["nim"] "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", "elixir.pathToElixirLS": "~/.elixir-ls/release/language_server.sh",
"rust-analyzer.checkOnSave.command": "clippy",
"diagnostic-languageserver.filetypes": { "diagnostic-languageserver.filetypes": {
"elixir": ["mix_credo", "mix_credo_compile"], "elixir": ["mix_credo", "mix_credo_compile"],
"eelixir": ["mix_credo", "mix_credo_compile"] "eelixir": ["mix_credo", "mix_credo_compile"]

View file

@ -25,7 +25,9 @@ local keymap = {
['<c-l>'] = ':TmuxNavigateRight<cr>', ['<c-l>'] = ':TmuxNavigateRight<cr>',
['<expr> n'] = "'Nn'[v:searchforward]", ['<expr> n'] = "'Nn'[v:searchforward]",
['<expr> N'] = "'nN'[v:searchforward]", ['<expr> N'] = "'nN'[v:searchforward]",
['<c-m>'] = ':lua SynGroup()<cr>' ['<c-m>'] = ':lua SynGroup()<cr>',
['g]'] = '<Plug>(coc-diagnostic-next)',
['g['] = '<Plug>(coc-diagnostic-prev)',
}, },
t = {}, t = {},
[''] = { [''] = {

View file

@ -176,6 +176,7 @@ bar {
} }
exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway 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 mako
exec pipewire exec pipewire
exec /usr/lib/kdeconnectd exec /usr/lib/kdeconnectd