Switch backup system to autorestic

This commit is contained in:
Tobias Reisinger 2024-10-05 00:42:21 +02:00
parent c6fafa34c9
commit 6da8d4336b
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
6 changed files with 4 additions and 77 deletions

View file

@ -5,8 +5,8 @@ declare -A mapper=(
[".t"]="$HOME/.bin/.t" [".t"]="$HOME/.bin/.t"
["alacritty"]="$HOME/.config/alacritty/alacritty.toml" ["alacritty"]="$HOME/.config/alacritty/alacritty.toml"
["autoinstall.conf"]="$HOME/.config/autoinstall.conf" ["autoinstall.conf"]="$HOME/.config/autoinstall.conf"
["autorestic"]="$HOME/.config/autorestic/.autorestic.yml"
["autostart.toml"]="$HOME/.config/autostart.toml" ["autostart.toml"]="$HOME/.config/autostart.toml"
["backup"]="$HOME/.bin/host-backup-$(cat /proc/sys/kernel/hostname)"
["bash"]="$HOME/.bashrc" ["bash"]="$HOME/.bashrc"
["bspwm"]="$HOME/.config/bspwm/bspwmrc" ["bspwm"]="$HOME/.config/bspwm/bspwmrc"
["completions"]="$HOME/.config/completionsrc" ["completions"]="$HOME/.config/completionsrc"

View file

@ -1,36 +0,0 @@
#!/usr/bin/env sh
set -e
_hostname="$(cat /proc/sys/kernel/hostname)"
_host_backup_file="host-backup-$_hostname"
if [ -x "$( which "$_host_backup_file")" ]
then
# shellcheck disable=SC1090
. "$_host_backup_file"
else
echo "No host-backup file found: $_host_backup_file"
exit 1
fi
if [ -z "$1" ]
then
host_backup_run
sleep 3
exit 0
fi
case "$1" in
"_forget")
host-backup forget --prune --group-by "host" \
--keep-last 14 \
--keep-daily 60 \
--keep-weekly 24 \
--keep-monthly 36 \
--keep-yearly 10
;;
*)
restic "$@"
;;
esac

View file

@ -1,39 +0,0 @@
#!/usr/bin/env bash
modes="monitor-std
monitor-single
monitor-single-sec
zellij"
portalo_mode_monitor () {
echo "Loading portalo monitor layout ${1:-std}"
yadm config --unset-all local.class monitor-*
if [ -n "$1" ]; then
yadm config --add local.class "$1"
fi
swaymsg reload
}
portalo_mode_zellij () {
layout_dir="$HOME/.config/zellij/layouts"
layouts=$(\ls -1 "$layout_dir")
layout=$(echo "$layouts" | $DMENU -p "layout")
if [ -n "$layout" ]; then
$TERMINAL -e zellij --layout="$layout_dir/$layout"
fi
}
if [ -z "$1" ]; then
mode=$(echo "$modes" | $DMENU -p "mode")
else
mode=$1
fi
case $mode in
"monitor-std") portalo_mode_monitor ;;
"monitor-"*) portalo_mode_monitor "$mode" ;;
"zellij") portalo_mode_zellij ;;
*) echo "'$mode' is not a valid mode (single, std)" ;;
esac

View file

@ -9,7 +9,7 @@ autostart"
action=$(echo "$actions" | $DMENU) action=$(echo "$actions" | $DMENU)
_menu_shutdown_backup() { _menu_shutdown_backup() {
alacritty -e "host-backup" alacritty -e sh -c "autorestic backup -av && sleep 3"
} }
if [ -z "$action" ]; then if [ -z "$action" ]; then

View file

@ -13,6 +13,7 @@
]; ];
home.packages = with pkgs; [ home.packages = with pkgs; [
autorestic
cargo # rust cargo # rust
#ckb-next # corsair hardware control #ckb-next # corsair hardware control
#rustdesk # remote desktop tool # disabled for nightly from aur #rustdesk # remote desktop tool # disabled for nightly from aur

View file

@ -1,4 +1,5 @@
.bin/host-backup-portalo .bin/host-backup-portalo
.config/autorestic/.autorestic.yml##hostname.portalo,default
.config/env.d/99-secrets .config/env.d/99-secrets
.config/projectsrc .config/projectsrc
.config/rclone/rclone.conf .config/rclone/rclone.conf